mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACA-1830] create menu enhancements (#670)
* nested menus for create button * evaluate sub-menu permissions * demo plugin * "create library" action * unit tests and proper effect name
This commit is contained in:
@@ -196,7 +196,8 @@ export class AppExtensionService implements RuleContext {
|
||||
|
||||
getCreateActions(): Array<ContentActionRef> {
|
||||
return this.createActions
|
||||
.filter(action => this.filterByRules(action))
|
||||
.map(action => this.copyAction(action))
|
||||
.map(action => this.buildMenu(action))
|
||||
.map(action => {
|
||||
let disabled = false;
|
||||
|
||||
@@ -211,6 +212,39 @@ export class AppExtensionService implements RuleContext {
|
||||
});
|
||||
}
|
||||
|
||||
private buildMenu(actionRef: ContentActionRef): ContentActionRef {
|
||||
if (
|
||||
actionRef.type === ContentActionType.menu &&
|
||||
actionRef.children &&
|
||||
actionRef.children.length > 0
|
||||
) {
|
||||
const children = actionRef.children
|
||||
.filter(action => this.filterByRules(action))
|
||||
.map(action => this.buildMenu(action));
|
||||
|
||||
actionRef.children = children
|
||||
.map(action => {
|
||||
let disabled = false;
|
||||
|
||||
if (action.rules && action.rules.enabled) {
|
||||
disabled = !this.extensions.evaluateRule(
|
||||
action.rules.enabled,
|
||||
this
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
...action,
|
||||
disabled
|
||||
};
|
||||
})
|
||||
.reduce(reduceEmptyMenus, [])
|
||||
.reduce(reduceSeparators, []);
|
||||
}
|
||||
|
||||
return actionRef;
|
||||
}
|
||||
|
||||
// evaluates content actions for the selection and parent folder node
|
||||
getAllowedToolbarActions(): Array<ContentActionRef> {
|
||||
return this.toolbarActions
|
||||
|
Reference in New Issue
Block a user