From 7de19c31ece361494063765c77269f7f3dad0195 Mon Sep 17 00:00:00 2001 From: Giga Chubinidze Date: Wed, 13 Dec 2023 23:54:41 +0400 Subject: [PATCH] Implement the Open Locally button on file previews [SCI-9757] --- app/javascript/packs/vue/open_locally_menu.js | 10 +++ .../content/attachments/open_locally_menu.vue | 65 +++++++++++++++++++ .../shared/file_preview/_content.html.erb | 11 ++-- config/webpack/webpack.config.js | 1 + 4 files changed, 80 insertions(+), 7 deletions(-) create mode 100644 app/javascript/packs/vue/open_locally_menu.js create mode 100644 app/javascript/vue/shared/content/attachments/open_locally_menu.vue diff --git a/app/javascript/packs/vue/open_locally_menu.js b/app/javascript/packs/vue/open_locally_menu.js new file mode 100644 index 000000000..4fa8be201 --- /dev/null +++ b/app/javascript/packs/vue/open_locally_menu.js @@ -0,0 +1,10 @@ +/* global notTurbolinksPreview */ + +import { createApp } from 'vue/dist/vue.esm-bundler.js'; +import OpenLocallyMenu from '../../vue/shared/content/attachments/open_locally_menu.vue'; +import { mountWithTurbolinks } from './helpers/turbolinks.js'; + +const app = createApp({}); +app.component('OpenLocallyMenu', OpenLocallyMenu); +app.config.globalProperties.i18n = window.I18n; +mountWithTurbolinks(app, '#openLocallyMenu'); diff --git a/app/javascript/vue/shared/content/attachments/open_locally_menu.vue b/app/javascript/vue/shared/content/attachments/open_locally_menu.vue new file mode 100644 index 000000000..a59f1521b --- /dev/null +++ b/app/javascript/vue/shared/content/attachments/open_locally_menu.vue @@ -0,0 +1,65 @@ + + + diff --git a/app/views/shared/file_preview/_content.html.erb b/app/views/shared/file_preview/_content.html.erb index 36fbbf188..31fd8e0d8 100644 --- a/app/views/shared/file_preview/_content.html.erb +++ b/app/views/shared/file_preview/_content.html.erb @@ -3,13 +3,9 @@
<% if can_edit && !preview %> <% if wopi_enabled? && wopi_file?(asset) %> - <% 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 - } %> +
+ +
<% elsif asset.file.metadata[:asset_type] == 'marvinjs' %>