scinote-web/app/views/reports/elements/_result_asset_element.html.erb

46 lines
1.8 KiB
Text
Raw Normal View History

2016-02-12 23:52:43 +08:00
<% if result.blank? and @result.present? then result = @result end %>
<% asset = result.asset %>
<% is_image = result.asset.is_image? %>
<% comments = result.comments %>
2016-07-21 19:11:15 +08:00
<% timestamp = asset.created_at %>
2016-02-12 23:52:43 +08:00
<% name = result.name %>
<% icon_class = is_image ? "glyphicon-picture" : "glyphicon-file" %>
<div class="report-element report-result-element report-result-asset-element" data-ts="<%= timestamp.to_i %>" data-type="result_asset" data-id="<%= result.id %>" data-modal-title="<%=t "projects.reports.elements.modals.result_contents.head_title", result: result.name %>" data-name="<%= name %>" data-icon-class="<%= icon_class %>">
<div class="report-element-header">
<div class="row">
<div class="pull-left result-icon">
<span class="glyphicon <%= icon_class %>"></span>
</div>
<div class="pull-left result-name">
<%= name %>
</div>
<div class="pull-left file-name">
<em><%=t "projects.reports.elements.result_asset.file_name",
file: truncate(asset.file_file_name,
length: Constants::FILENAME_TRUNCATION_LENGTH)
%>
</em>
2016-02-12 23:52:43 +08:00
</div>
<div class="pull-left user-time">
<%=t "projects.reports.elements.result_asset.user_time", user: result.user.full_name, timestamp: l(timestamp, format: :full) %>
</div>
<div class="pull-right controls">
<%= render partial: "reports/elements/element_controls.html.erb" %>
2016-02-12 23:52:43 +08:00
</div>
</div>
</div>
2016-07-21 19:11:15 +08:00
<div class="row"></div>
<% if is_image %>
<div class="report-element-body">
<div class="row">
<div class="col-xs-12 file-image">
<%= report_image_asset_url(asset) %>
</div>
2016-02-12 23:52:43 +08:00
</div>
2016-07-21 19:11:15 +08:00
</div>
<% end %>
2016-02-12 23:52:43 +08:00
<div class="report-element-children">
<%= children if (defined? children and children.present?) %>
</div>
</div>