2014-04-26 20:21:11 +00:00
|
|
|
<h1>Editing File</h1>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-04-26 20:21:11 +00:00
|
|
|
<%= form_for(@file, html: { class: 'square' }) do |f| %>
|
|
|
|
<%= render 'shared/errors', messages: @file.errors.full_messages %>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-04-26 20:21:11 +00:00
|
|
|
<%= cascade @file, ["name", "size_s", "md5_s"] %>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-04-26 20:21:11 +00:00
|
|
|
<div class="fields horizontal">
|
|
|
|
<%= f.label :description %>
|
|
|
|
<%= f.text_field :description %>
|
|
|
|
</div>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-04-26 20:21:11 +00:00
|
|
|
<div class="fields horizontal">
|
|
|
|
<%= f.label :directory_id %>
|
|
|
|
<%= f.select :directory_id, Directory.all.collect { |c| ["#{c.path} - #{c.name}", c.id] } %>
|
|
|
|
</div>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-04-26 20:21:11 +00:00
|
|
|
<div class="controls">
|
|
|
|
<%= f.submit 'Update' %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-04-26 20:21:11 +00:00
|
|
|
<h3>Related Files</h3>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-04-26 20:21:11 +00:00
|
|
|
<table class="striped">
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Size</th>
|
|
|
|
<th>Action</th>
|
|
|
|
</tr>
|
|
|
|
<% @file.related_files.each do |related| %>
|
2014-03-23 00:22:25 +00:00
|
|
|
<tr>
|
2014-04-26 20:21:11 +00:00
|
|
|
<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>
|
2014-03-23 00:22:25 +00:00
|
|
|
</tr>
|
|
|
|
<% end %>
|
2014-04-26 20:21:11 +00:00
|
|
|
</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 %>
|