2019-06-11 16:08:33 +08:00
|
|
|
<% assets = ordered_assets(step) %>
|
2019-04-09 16:00:56 +08:00
|
|
|
<div class="col-xs-12">
|
2019-05-11 22:04:28 +08:00
|
|
|
<hr>
|
2019-04-09 16:00:56 +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>
|
2019-05-11 22:04:28 +08:00
|
|
|
<div>
|
2019-04-09 16:00:56 +08:00
|
|
|
<div class="attachemnts-header pull-right">
|
2019-05-27 20:58:10 +08:00
|
|
|
<% if !(preview) && (can_manage_protocol_in_module?(@protocol) ||
|
|
|
|
can_manage_protocol_in_repository?(@protocol)) %>
|
2019-05-13 16:45:12 +08:00
|
|
|
<%= render partial: '/assets/wopi/create_wopi_file_button.html.erb',
|
|
|
|
locals: { element_id: step.id, element_type: 'Step' } %>
|
|
|
|
<% end %>
|
2019-04-09 16:00:56 +08:00
|
|
|
<div class="dropdown attachments-order" id="dd-att-step-<%= step.id %>">
|
|
|
|
<button class="btn btn-default dropdown-toggle" type="button" id="sortMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
2019-06-11 16:08:33 +08:00
|
|
|
<span id="dd-att-step-<%= step.id %>-label">
|
|
|
|
<%= t("protocols.steps.attachments.sort.#{step.current_view_state(current_user).state.dig('assets', 'sort')}_html") %>
|
|
|
|
</span>
|
2019-04-09 16:00:56 +08:00
|
|
|
<span class="caret"></span>
|
|
|
|
</button>
|
2019-06-11 16:08:33 +08:00
|
|
|
<ul class="dropdown-menu" aria-labelledby="sortMenu" data-state-save-path="<%= update_view_state_step_path(step.id) %>">
|
2019-04-09 18:28:42 +08:00
|
|
|
<% ['new', 'old', 'atoz', 'ztoa'].each do |sort| %>
|
2019-04-09 16:00:56 +08:00
|
|
|
<li>
|
2019-06-11 16:08:33 +08:00
|
|
|
<a data-order="<%= sort %>" onClick="reorderAttachments(this, '<%= step.id %>', '<%= sort %>')">
|
|
|
|
<%= t("protocols.steps.attachments.sort.#{sort}_html") %>
|
|
|
|
</a>
|
2019-04-09 16:00:56 +08:00
|
|
|
</li>
|
|
|
|
<% end %>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2019-05-13 22:53:58 +08:00
|
|
|
<div class="col-xs-12 attachments" id="att-<%= step.id %>">
|
2019-04-09 16:00:56 +08:00
|
|
|
<% assets.each_with_index do |asset, i| %>
|
2019-06-11 16:08:33 +08:00
|
|
|
<% order_atoz = az_ordered_assets_index(assets, asset.id) %>
|
|
|
|
<% order_ztoa = assets.length - az_ordered_assets_index(assets, asset.id) %>
|
2019-04-09 18:28:42 +08:00
|
|
|
<%= render partial: 'steps/attachments/item.html.erb',
|
2019-06-11 16:08:33 +08:00
|
|
|
locals: { asset: asset, i: i, assets_count: assets.length, step: step, order_atoz: order_atoz, order_ztoa: order_ztoa } %>
|
2019-04-09 16:00:56 +08:00
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<hr>
|