ensl.org/app/views/data_files/show.html.erb

50 lines
1.5 KiB
Text
Raw Normal View History

<div id="file">
2020-03-22 17:47:24 +00:00
<h1><%=h @file %></h1>
2020-03-22 17:47:24 +00:00
<%= cascade @file, [["Filename", "name.identifier".to_sym], "size_s", "directory", ["Directory path", "directory.path".to_sym], "md5_s", ["Modified", "created_at"]] %>
2020-03-22 17:47:24 +00:00
<% if cuser and cuser.admin? %>
<div class="actions">
2020-03-22 17:47:24 +00:00
<% if @file.can_update? cuser %>
<%= link_to 'Edit', edit_data_file_path(@file), class: 'button tiny' %>
<% end; if @file.can_destroy? cuser %>
<%= link_to 'Destroy', @file, confirm: 'Are you sure?', method: :delete, class: 'button tiny' %>
2020-03-22 17:47:24 +00:00
<% end %>
</div>
2020-03-22 17:47:24 +00:00
<% end %>
2020-03-22 17:47:24 +00:00
<%= link_to "Download", @file.url, class: 'button' %>
2020-03-22 17:47:24 +00:00
<% if @file.related_files.count > 0 %>
<div class="files-list">
<h4>Related Files</h4>
2020-03-22 17:47:24 +00:00
<table class="striped">
<tr>
<th>Name</th>
<th>Size</th>
<th>MD5</th>
<th>Modified</th>
</tr>
<% @file.related_files.each do |related| %>
<tr>
<td>
<%= link_to (h related.name.filename), related.name.url %>
</td>
<td>
<%= related.size_s %> MB
</td>
<td>
<%= related.md5_s %>
</td>
<td>
<%= shorttime related.created_at %>
</td>
</tr>
<% end %>
</table>
</div>
<% end %>
</div>
2020-03-22 17:47:24 +00:00
<%= add_comments @file %>