Skip to content

Commit

Permalink
add utility operations in page manager (#4261)
Browse files Browse the repository at this point in the history
  • Loading branch information
ETLaurent authored Aug 10, 2023
1 parent f4cb69a commit 0d626b0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Add `@apostrophecms/log` module to allow structured logging. All modules have `logDebug`, `logInfo`, `logWarn` and `logError` methods now. See the [documentation](https://v3.docs.apostrophecms.org/guide/logging.html) for more details.
* Add `@apostrophecms/settings` translations.
* Add the ability to have custom modals for batch operations.
* Add the possibility to display utility operations inside a 3-dots menu on the page manager, the same way it is done for the docs manager.

### Changes

Expand Down
10 changes: 9 additions & 1 deletion modules/@apostrophecms/page/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { SemanticAttributes } = require('@opentelemetry/semantic-conventions');
const expressCacheOnDemand = require('express-cache-on-demand')();

module.exports = {
cascades: [ 'batchOperations' ],
cascades: [ 'batchOperations', 'utilityOperations' ],
options: {
alias: 'page',
types: [
Expand Down Expand Up @@ -659,6 +659,13 @@ database.`);
};
}
}
},
composeUtilityOperations() {
self.utilityOperations = Object.entries(self.utilityOperations || {})
.map(([ action, properties ]) => ({
action,
...properties
}));
}
},
'apostrophe:ready': {
Expand Down Expand Up @@ -830,6 +837,7 @@ database.`);
browserOptions.localized &&
Object.keys(self.apos.i18n.locales).length > 1 &&
Object.values(self.apos.i18n.locales).some(locale => locale._edit);
browserOptions.utilityOperations = self.utilityOperations;
return browserOptions;
},
// Returns a query that finds pages the current user can edit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
/>
</template>
<template #primaryControls>
<AposUtilityOperations
:module-options="moduleOptions"
:has-relationship-field="!!relationshipField"
/>
<AposContextMenu
v-if="relationshipField"
:menu="moreMenu"
Expand Down

0 comments on commit 0d626b0

Please sign in to comment.