mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-29 14:01:48 +00:00
53 lines
1.3 KiB
Text
53 lines
1.3 KiB
Text
<h1>Editing File</h1>
|
|
|
|
<%= form_for(@file, html: { class: 'square' }) do |f| %>
|
|
<%= render 'shared/errors', messages: @file.errors.full_messages %>
|
|
|
|
<%= cascade @file, ["name", "size_s", "md5_s"] %>
|
|
|
|
<div class="fields horizontal">
|
|
<%= f.label :description %>
|
|
<%= f.text_field :description %>
|
|
</div>
|
|
|
|
<div class="fields horizontal">
|
|
<%= f.label :directory_id %>
|
|
<%= f.select :directory_id, Directory.all.collect { |c| ["#{c.path} - #{c.name}", c.id] } %>
|
|
</div>
|
|
|
|
<div class="controls">
|
|
<%= f.submit 'Update' %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<h3>Related Files</h3>
|
|
|
|
<table class="striped">
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Size</th>
|
|
<th>Action</th>
|
|
</tr>
|
|
<% @file.related_files.each do |related| %>
|
|
<tr>
|
|
<td>
|
|
<%= h related.name.filename %>
|
|
</td>
|
|
<td>
|
|
<%= related.size_s %> MB
|
|
</td>
|
|
<td>
|
|
<%= link_to "Remove", controller: "data_files", action: "delFile", id: @file, "related_id" => related %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</table>
|
|
|
|
<%= form_for @file, url: { action: "addFile", id: @file } do |f| %>
|
|
<div class="fields">
|
|
<%= f.select :related_id, @file.directory.files.not(@file).collect {|file| [file, file.id]} %>
|
|
</div>
|
|
<div class="controls">
|
|
<%= f.submit "Add" %>
|
|
</div>
|
|
<% end %>
|