Skip to content

Commit

Permalink
Display module label and count in basic modal
Browse files Browse the repository at this point in the history
  • Loading branch information
falkodev committed Aug 4, 2023
1 parent 131c5ad commit 2c8ddba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 2 additions & 3 deletions modules/@apostrophecms/import-export-doc-type/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ module.exports = {
action: 'export',
context: 'update',
label: 'aposImportExport:export',
modal: 'AposExportPiecesModal',
currentModuleName: true
modal: 'AposExportPiecesModal'
};

if (self.options.export === false) {
Expand All @@ -23,6 +22,6 @@ module.exports = {
};
}

self.apos.doc.addContextOperation(self.__meta.name, criteria);
self.apos.doc.addContextOperation(criteria);
}
};
13 changes: 11 additions & 2 deletions ui/apos/components/AposExportPiecesModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
<AposModalBody>
<template #bodyMain>
<h2 class="apos-export-pieces__heading">
{{ $t('aposImportExport:export') }} {{ moduleName }}
{{ $t('aposImportExport:export') }} {{ moduleLabel }}
</h2>
<p
class="apos-export-pieces__description"
>
{{ $t('aposImportExport:exportModalDescription', { count, type: moduleName }) }}
{{ $t('aposImportExport:exportModalDescription', { count, type: moduleLabel }) }}
</p>
<div class="apos-export-pieces__btns">
<AposButton
Expand Down Expand Up @@ -63,9 +63,18 @@ export default {
};
},
computed: {
moduleLabel() {
const moduleOptions = window.apos.modules[this.moduleName];
const label = this.count > 1 ? moduleOptions.pluralLabel : moduleOptions.label;
return this.$t(label).toLowerCase();
}
},
async mounted() {
this.modal.active = true;
},
methods: {
ready() {
this.$refs.exportPieces.$el.querySelector('button').focus();
Expand Down

0 comments on commit 2c8ddba

Please sign in to comment.