2020-12-08 17:44:52 +08:00
|
|
|
<% if can_manage_asset?(asset) %>
|
|
|
|
<div class="dropdown asset-context-menu">
|
2023-06-19 21:45:22 +08:00
|
|
|
<button class="btn btn-light btn-xs dropdown-toggle icon-btn" type="button" id="dropdownAssetContextMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
2023-06-08 14:33:37 +08:00
|
|
|
<i class="sn-icon sn-icon-more-hori"></i>
|
2020-12-08 17:44:52 +08:00
|
|
|
</button>
|
|
|
|
<ul class="dropdown-menu dropdown-menu-right"
|
|
|
|
aria-labelledby="dropdownAssetContextMenu"
|
|
|
|
data-asset-id="<%= asset.id %>"
|
|
|
|
data-toggle-view-url="<%= toggle_view_mode_path(asset) %>">
|
|
|
|
<% if editable %>
|
|
|
|
<% if wopi_enabled? && wopi_file?(asset) %>
|
|
|
|
<li>
|
|
|
|
<% edit_supported, title = wopi_file_edit_button_status(asset) %>
|
2023-06-21 20:13:20 +08:00
|
|
|
<%= render partial: 'assets/wopi/file_wopi_controls',
|
2020-12-08 17:44:52 +08:00
|
|
|
locals: {
|
|
|
|
asset: asset,
|
|
|
|
edit_supported: edit_supported,
|
|
|
|
title: title
|
|
|
|
} %>
|
|
|
|
</li>
|
|
|
|
<li role="separator" class="divider"></li>
|
|
|
|
<% elsif asset.file.metadata[:asset_type] == 'marvinjs' %>
|
|
|
|
<li>
|
|
|
|
<a class="btn btn-light marvinjs-edit-button"
|
|
|
|
data-sketch-id="<%= asset.id %>"
|
|
|
|
data-update-url="<%= marvin_js_asset_path(asset) %>"
|
|
|
|
data-sketch-start-edit-url="<%= start_editing_marvin_js_asset_path(asset) %>"
|
|
|
|
data-sketch-name="<%= asset.file.metadata[:name] %>"
|
|
|
|
data-sketch-description="<%= asset.file.metadata[:description] %>"
|
|
|
|
>
|
2021-08-19 19:28:35 +08:00
|
|
|
<%= image_tag 'icon_small/marvinjs.svg' %>
|
2020-12-08 17:44:52 +08:00
|
|
|
<%= t('assets.file_preview.edit_in_marvinjs') %>
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li role="separator" class="divider"></li>
|
|
|
|
<% elsif asset.editable_image? %>
|
|
|
|
<li>
|
|
|
|
<a class="btn btn-light image-edit-button"
|
|
|
|
data-image-id="<%= asset.id %>"
|
|
|
|
data-image-name="<%= asset.file_name %>"
|
|
|
|
data-image-url="<%= asset_file_url_path(asset) %>"
|
|
|
|
data-image-quality="<%= asset.file_image_quality || 80 %>"
|
|
|
|
data-image-mime-type="<%= asset.file.content_type %>"
|
|
|
|
data-image-start-edit-url="<%= start_edit_image_path(asset) %>"
|
|
|
|
>
|
2023-06-08 14:33:37 +08:00
|
|
|
<span class="sn-icon sn-icon-edit"></span>
|
2020-12-08 17:44:52 +08:00
|
|
|
<%= t('assets.file_preview.edit_in_scinote') %>
|
|
|
|
</a>
|
|
|
|
</li>
|
2022-07-12 21:24:12 +08:00
|
|
|
<li>
|
|
|
|
<a class="btn btn-light file-download-link" href="<%= rails_blob_path(asset.file, disposition: 'attachment') %>" data-turbolinks="false">
|
2023-06-08 14:33:37 +08:00
|
|
|
<span class="sn-icon sn-icon-export"></span>
|
2022-07-12 21:24:12 +08:00
|
|
|
<%= t('Download') %>
|
|
|
|
</a>
|
|
|
|
</li>
|
2020-12-08 17:44:52 +08:00
|
|
|
<li role="separator" class="divider"></li>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<li class="divider-label"><%= t("assets.context_menu.set_view_size") %></li>
|
|
|
|
<% ['inline', 'thumbnail', 'list'].each do |view_mode| %>
|
2020-11-04 20:08:40 +08:00
|
|
|
<li>
|
2020-12-08 17:44:52 +08:00
|
|
|
<a class="change-preview-type <%= 'selected' if view_mode == asset.view_mode %>" data-preview-type="<%= view_mode %>">
|
|
|
|
<%= t("assets.context_menu.#{view_mode}_html") %>
|
2020-11-04 20:08:40 +08:00
|
|
|
</a>
|
|
|
|
</li>
|
2020-12-08 17:44:52 +08:00
|
|
|
<% end %>
|
|
|
|
<% if deletable %>
|
2020-11-04 20:08:40 +08:00
|
|
|
<li role="separator" class="divider"></li>
|
|
|
|
<li>
|
2020-12-08 17:44:52 +08:00
|
|
|
<a class="delete-asset" href="<%= asset_destroy_path(asset) %>" data-file-name="<%= asset.render_file_name %>">
|
2023-06-08 14:33:37 +08:00
|
|
|
<i class="sn-icon sn-icon-delete"></i>
|
2020-12-08 17:44:52 +08:00
|
|
|
<%= t("assets.context_menu.delete") %>
|
2020-11-04 20:08:40 +08:00
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<% end %>
|
2020-12-08 17:44:52 +08:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<% end %>
|