2020-12-04 19:07:25 +08:00
|
|
|
<% assets = step.assets.joins(file_attachment: :blob) %>
|
2020-09-25 21:06:09 +08:00
|
|
|
<% current_order = step.current_view_state(current_user).state.dig('assets', 'sort') %>
|
2020-05-15 03:53:00 +08:00
|
|
|
<div class="col-xs-12">
|
2019-05-11 22:04:28 +08:00
|
|
|
<hr>
|
2020-05-15 03:53:00 +08:00
|
|
|
</div>
|
|
|
|
<div class="col-xs-12 attachments-actions">
|
2019-05-27 20:58:10 +08:00
|
|
|
|
2019-05-11 22:04:28 +08:00
|
|
|
<div class="title">
|
|
|
|
<h4>
|
2019-06-11 16:08:33 +08:00
|
|
|
<%= t('protocols.steps.files', count: assets.length) %>
|
2019-05-11 22:04:28 +08:00
|
|
|
</h4>
|
2019-04-09 16:00:56 +08:00
|
|
|
</div>
|
2020-12-08 17:44:52 +08:00
|
|
|
<% if !(preview) && (can_manage_protocol_in_module?(@protocol) ||
|
|
|
|
can_manage_protocol_in_repository?(@protocol)) %>
|
2020-11-25 20:13:06 +08:00
|
|
|
<div class="actions">
|
|
|
|
<div class="dropdown sci-dropdown">
|
|
|
|
<button class="btn btn-light dropdown-toggle" type="button" id="dropdownAttachmentsOptions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
|
|
|
<span><%= t("protocols.steps.attachments.manage") %></span>
|
|
|
|
<span class="caret pull-right"></span>
|
|
|
|
</button>
|
|
|
|
<ul class="dropdown-menu dropdown-menu-right dropdown-attachment-options"
|
|
|
|
aria-labelledby="dropdownAttachmentsOptions"
|
|
|
|
data-view-mode-url="<%= update_asset_view_mode_step_path(step) %>"
|
|
|
|
data-step-id="<%= step.id %>"
|
|
|
|
data-state-save-url="<%= update_view_state_step_path(step.id) %>">
|
2020-12-08 17:44:52 +08:00
|
|
|
<li class="divider-label"><%= t("protocols.steps.attachments.add") %></li>
|
|
|
|
<li>
|
|
|
|
<%= render partial: '/assets/marvinjs/create_marvin_sketch_li.html.erb',
|
|
|
|
locals: { element_id: step.id, element_type: 'Step', sketch_container: ".attachments[data-step-id=#{step.id}]" } %>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<%= render partial: '/assets/wopi/create_wopi_file_li.html.erb',
|
|
|
|
locals: { element_id: step.id, element_type: 'Step' } %>
|
|
|
|
</li>
|
|
|
|
<li role="separator" class="divider"></li>
|
2020-11-25 20:13:06 +08:00
|
|
|
<li class="divider-label"><%= t("protocols.steps.attachments.sort_by") %></li>
|
|
|
|
<% ['new', 'old', 'atoz', 'ztoa'].each do |sort| %>
|
|
|
|
<li>
|
|
|
|
<a data-order="<%= sort %>" class="action-link change-order <%= 'selected' if current_order == sort %>">
|
|
|
|
<%= t("general.sort_new.#{sort}") %>
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<% end %>
|
2020-11-03 01:47:08 +08:00
|
|
|
<li role="separator" class="divider"></li>
|
2020-11-25 20:13:06 +08:00
|
|
|
<li class="divider-label"><%= t("protocols.steps.attachments.attachments_view_mode") %></li>
|
|
|
|
<% ['inline', 'thumbnail', 'list'].each do |view_mode| %>
|
2020-11-03 01:47:08 +08:00
|
|
|
<li>
|
2020-11-25 20:13:06 +08:00
|
|
|
<a class="attachments-view-mode action-link <%= 'selected' if view_mode == step.assets_view_mode %>" data-assets-view-mode="<%= view_mode %>">
|
|
|
|
<%= t("protocols.steps.attachments.view_mode.#{view_mode}_html") %>
|
2020-11-03 01:47:08 +08:00
|
|
|
</a>
|
|
|
|
</li>
|
2020-11-25 20:13:06 +08:00
|
|
|
<% end %>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2019-04-09 16:00:56 +08:00
|
|
|
</div>
|
2020-11-25 20:13:06 +08:00
|
|
|
<% end %>
|
2019-04-09 16:00:56 +08:00
|
|
|
</div>
|
|
|
|
|
2020-11-25 20:13:06 +08:00
|
|
|
<div class="col-xs-12 attachments" data-preview="<%= preview %>" data-step-id="<%= step.id %>" data-order="<%= current_order %>">
|
2019-04-09 16:00:56 +08:00
|
|
|
<% assets.each_with_index do |asset, i| %>
|
2020-10-22 19:41:17 +08:00
|
|
|
<%= render partial: 'assets/asset.html.erb', locals: { asset: asset, gallery_view_id: step.id } %>
|
2019-04-09 16:00:56 +08:00
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<hr>
|