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

58 lines
1.2 KiB
Text

<div class="box wide">
<h1>
<%= h @file %>
</h1>
<%= cascade @file, [["Filename", "name.filename".to_sym], "size_s", "directory", "md5_s", ["Modified", "created_at"]] %>
<% if cuser and cuser.admin? %>
<p>
[
<% if @file.can_update? cuser %>
<%= link_to 'Edit', edit_data_file_path(@file) %>
<% end; if @file.can_destroy? cuser %>
<%= link_to 'Destroy', @file, :confirm => 'Are you sure?', :method => :delete %>
<% end %>
]
</p>
<% end %>
<br />
<h2 class="center">
<%= link_to "Download", @file.url %>
</h2>
</div>
<div class="wide box">
<h3>
Related Files
</h3>
<table class="data">
<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>
<%= add_comments @file %>