Skip to content

Commit

Permalink
PRO 6870 Export Templates / pass module labels to AposDocContextMenu …
Browse files Browse the repository at this point in the history
…for modals (#4834)

* allows to pass type to doc context menu to use for operations
* checkedTypes is null by default, if it exists it's used
* adds moduleLabels optional prop in AposDocContextMenu to pass to opened modals
  • Loading branch information
ValJed authored Jan 9, 2025
1 parent 2dc106c commit 64559bf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

* Ability to disable the color spectrum UI of a color picker
* Accessibility improvement for the rich text editor Typography toolbar item.
* Adds `moduleLabels` prop to `AposDocContextMenu` to pass it to opened modals from custom operations (used by templates to define labels to display on the export modal).

### Changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ export default {
localeSwitched: {
type: Boolean,
default: false
},
moduleLabels: {
type: Object,
default: null
}
},
emits: [ 'menu-open', 'menu-close', 'close' ],
Expand Down Expand Up @@ -207,7 +211,8 @@ export default {

ifProps = ifProps || {};
moduleIf = moduleIf || {};
const canSeeOperation = checkIfConditions(this.doc, ifProps) && checkIfConditions(this.moduleOptions, moduleIf);
const canSeeOperation = checkIfConditions(this.doc, ifProps) &&
checkIfConditions(this.moduleOptions, moduleIf);

if (!canSeeOperation) {
return false;
Expand All @@ -219,9 +224,8 @@ export default {
moduleName() {
if (apos.modules[this.context.type].action === apos.modules['@apostrophecms/page'].action) {
return '@apostrophecms/page';
} else {
return this.context.type;
}
return this.context.type;
},
moduleOptions() {
return apos.modules[this.moduleName];
Expand Down Expand Up @@ -446,6 +450,7 @@ export default {
}
const props = {
moduleName: operation.moduleName || this.moduleName,
moduleLabels: this.moduleLabels,
// For backwards compatibility
doc,
...docProps(doc),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export default {
},
checkedTypes: {
type: Array,
default: () => []
default: null
},
checkedCount: {
type: Number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ export default {
return this.moduleOptions.canCreate;
},
checkedTypes() {
return this.checkedDocs.map(doc => doc.type);
const types = this.checkedDocs.map(doc => doc.type);
return [ ...new Set(types) ];
}
},
created() {
Expand Down

0 comments on commit 64559bf

Please sign in to comment.