Remove form_asset partial

This commit is contained in:
Urban Rotnik 2019-04-23 13:35:10 +02:00
parent b1dabaca15
commit 7a2bfc12ce
4 changed files with 17 additions and 29 deletions

View file

@ -86,7 +86,7 @@
.attacments {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
justify-content: space-evenly;
}
.attachment-placeholder {

View file

@ -62,8 +62,9 @@
<div id="new-step-assets-group" class="form-group">
<div class="col-xs-12 attacments edit">
<%= f.nested_fields_for :assets do |ff| %>
<%= render "form_assets.html.erb", ff: ff, step: step %>
<% end %>
<%= render partial: 'steps/attachments/placeholder.html.erb',
locals: { edit_page: true, asset: ff.object, ff: ff } %>
<% end %>
</div>
</div>
</div>

View file

@ -1,5 +1,3 @@
<% image_preview = asset.is_image? ? asset.url(:medium) : nil %>
<%= link_to download_asset_path(asset),
class: 'file-preview-link',
id: "modal_link#{asset.id}",
@ -12,19 +10,6 @@
'order-new': assets_count - i,
} do %>
<div class="attachment-placeholder pull-left">
<div class="attachment-thumbnail <%= image_preview ? '' : 'no-shadow' %>">
<% if image_preview %>
<%= image_tag image_preview %>
<% else %>
<i class="fas <%= file_fa_icon_class_v2(asset) %>"></i>
<% end %>
</div>
<div class="attachment-label"><%= truncate(asset.file_file_name,
length: Constants::FILENAME_TRUNCATION_LENGTH) %></div>
<div class="spencer-bonnet-modif">
<%= t('protocols.steps.attachments.modified_label') %> <%= l(asset.updated_at, format: :full_date) %> <br>
<%= number_to_human_size(asset.file.size) %>
</div>
</div>
<%= render partial: 'steps/attachments/placeholder.html.erb',
locals: { edit_page: false, asset: asset } %>
<% end %>

View file

@ -1,4 +1,3 @@
<% asset = ff.object %>
<% image_preview = asset.is_image? ? asset.url(:medium) : nil %>
<div class="attachment-placeholder pull-left">
@ -6,20 +5,23 @@
<% if image_preview %>
<%= image_tag image_preview %>
<% else %>
<i class="fas fa-image"></i>
<i class="fas <%= file_fa_icon_class_v2(asset) if asset.file_file_name %>"></i>
<% end %>
</div>
<div class="attachment-label"><%= truncate(asset.file_file_name,
length: Constants::FILENAME_TRUNCATION_LENGTH) %></div>
<div class="spencer-bonnet-modif">
Modified: <%= l(asset.updated_at, format: :full_date) if asset.updated_at %> <br>
<%= t('protocols.steps.attachments.modified_label') %> <%= l(asset.updated_at, format: :full_date) if asset.updated_at %> <br>
<%= number_to_human_size(asset.file.size) %>
</div>
<div class="remove-icon pull-right">
<% unless ff.object.file.exists? && ff.object.locked? %>
<%= ff.remove_nested_fields_link do %>
<span class="fas fa-trash"></span>
<% if edit_page %>
<div class="remove-icon pull-right">
<% unless ff.object.file.exists? && ff.object.locked? %>
<%= ff.remove_nested_fields_link do %>
<span class="fas fa-trash"></span>
<% end %>
<% end %>
<% end %>
</div>
</div>
<% end %>
</div>