new linter fixes

This commit is contained in:
Giga Chubinidze 2024-01-04 03:13:21 +04:00
parent 23ede59730
commit 509024458d
2 changed files with 44 additions and 42 deletions

View file

@ -1,7 +1,9 @@
<template>
<div class="sn-open-locally-menu">
<div v-if="!this.canOpenLocally && (this.attachment.wopi && this.attachment.urls.edit_asset)">
<a :href="`${this.attachment.urls.edit_asset}`" target="_blank" class="block whitespace-nowrap rounded px-3 py-2.5 hover:!text-sn-blue hover:no-underline cursor-pointer hover:bg-sn-super-light-grey">
<a :href="`${this.attachment.urls.edit_asset}`" target="_blank"
class="block whitespace-nowrap rounded px-3 py-2.5
hover:!text-sn-blue hover:no-underline cursor-pointer hover:bg-sn-super-light-grey">
{{ this.attachment.wopi_context.button_text }}
</a>
</div>
@ -19,47 +21,47 @@
</template>
<script>
import OpenLocallyMixin from './mixins/open_locally.js'
import MenuDropdown from '../../menu_dropdown.vue'
import OpenLocallyMixin from './mixins/open_locally.js';
import MenuDropdown from '../../menu_dropdown.vue';
export default {
name: 'OpenLocallyMenu',
mixins: [OpenLocallyMixin],
components: { MenuDropdown },
props: {
data: { type: String, required: true }
},
created() {
window.openLocallyMenu = this;
this.attachment = JSON.parse(this.data)
},
beforeUnmount() {
delete window.openLocallyMenuComponent;
},
computed: {
menu() {
let menu = [];
export default {
name: 'OpenLocallyMenu',
mixins: [OpenLocallyMixin],
components: { MenuDropdown },
props: {
data: { type: String, required: true },
},
created() {
window.openLocallyMenu = this;
this.attachment = JSON.parse(this.data);
},
beforeUnmount() {
delete window.openLocallyMenuComponent;
},
computed: {
menu() {
const menu = [];
if (this.attachment.wopi && this.attachment.urls.edit_asset) {
menu.push({
text: this.attachment.wopi_context.button_text,
url: this.attachment.urls.edit_asset,
url_target: '_blank'
})
}
if (this.canOpenLocally) {
const text = this.localAppName
? this.i18n.t('attachments.open_locally_in', { application: this.localAppName })
: this.i18n.t('attachments.open_locally')
menu.push({
text: text,
emit: 'open_locally'
})
}
return menu;
if (this.attachment.wopi && this.attachment.urls.edit_asset) {
menu.push({
text: this.attachment.wopi_context.button_text,
url: this.attachment.urls.edit_asset,
url_target: '_blank',
}),
}
}
}
if (this.canOpenLocally) {
const text = this.localAppName
? this.i18n.t('attachments.open_locally_in', { application: this.localAppName })
: this.i18n.t('attachments.open_locally');
menu.push({
text,
emit: 'open_locally',
});
}
return menu;
},
},
};
</script>

View file

@ -46,7 +46,7 @@ const entryList = {
vue_components_export_stock_consumption_modal: './app/javascript/packs/vue/export_stock_consumption_modal.js',
vue_components_manage_stock_value_modal: './app/javascript/packs/vue/manage_stock_value_modal.js',
vue_legacy_datetime_picker: './app/javascript/packs/vue/legacy/datetime_picker.js',
vue_open_locally_menu: './app/javascript/packs/vue/open_locally_menu.js'
vue_open_locally_menu: './app/javascript/packs/vue/open_locally_menu.js',
}
// Engine pack loading based on https://github.com/rails/webpacker/issues/348#issuecomment-635480949