mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-18 23:21:30 +08:00
78 lines
3.4 KiB
Text
78 lines
3.4 KiB
Text
<% if can_manage_asset?(asset) %>
|
|
<div class="dropdown asset-context-menu">
|
|
<button class="btn btn-light btn-xs dropdown-toggle icon-btn" type="button" id="dropdownAssetContextMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
|
<i class="sn-icon sn-icon-more-hori"></i>
|
|
</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) %>
|
|
<%= render partial: 'assets/wopi/file_wopi_controls',
|
|
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] %>"
|
|
>
|
|
<%= image_tag 'icon_small/marvinjs.svg' %>
|
|
<%= 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) %>"
|
|
>
|
|
<span class="sn-icon sn-icon-edit"></span>
|
|
<%= t('assets.file_preview.edit_in_scinote') %>
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a class="btn btn-light file-download-link" href="<%= rails_blob_path(asset.file, disposition: 'attachment') %>" data-turbolinks="false">
|
|
<span class="sn-icon sn-icon-export"></span>
|
|
<%= t('Download') %>
|
|
</a>
|
|
</li>
|
|
<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| %>
|
|
<li>
|
|
<a class="change-preview-type <%= 'selected' if view_mode == asset.view_mode %>" data-preview-type="<%= view_mode %>">
|
|
<%= t("assets.context_menu.#{view_mode}_html") %>
|
|
</a>
|
|
</li>
|
|
<% end %>
|
|
<% if deletable %>
|
|
<li role="separator" class="divider"></li>
|
|
<li>
|
|
<a class="delete-asset" href="<%= asset_destroy_path(asset) %>" data-file-name="<%= asset.render_file_name %>">
|
|
<i class="sn-icon sn-icon-delete"></i>
|
|
<%= t("assets.context_menu.delete") %>
|
|
</a>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
</div>
|
|
<% end %>
|