mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-8706] split context menu to allow injecting actions (#4203)
* ACS-8706 split context menu to allow injecting actions * ACS-8706 fix class naming, add context menu components unit tests * ACS-8706 add context menu service, effects and directive unit tests * ACS-8706 review remarks - redundant condition, directive unit tests * ACS-8706 improve unit testing approach, remove unnecessary class attributes * ACS-8706 documentation * ACS-8706 fix sonar issues * ACS-8706 replace takeUntil with takeUntilDestroyed * ACS-8706 fix sonar lint issue * ACS-8706 change incorrect import path
This commit is contained in:
committed by
GitHub
parent
38e667b334
commit
71764b09e2
@@ -26,3 +26,4 @@ This application simplifies the complexity of Content Management and provides co
|
||||
- [Search results](/features/search-results)
|
||||
- [Search forms](/features/search-forms)
|
||||
- [Application Hook](/extending/application-hook)
|
||||
- [Context Menu actions](context-menu-actions)
|
||||
|
69
docs/features/context-menu-actions.md
Normal file
69
docs/features/context-menu-actions.md
Normal file
@@ -0,0 +1,69 @@
|
||||
---
|
||||
Title: Context Menu Actions
|
||||
---
|
||||
|
||||
# Context Menu Actions
|
||||
|
||||
Context Menu Component, appearing on right-clicking a document list item, contains Actions executable on particular file or folder. This entry describes two ways of populating Context Menu.
|
||||
|
||||
**Important:** Those two ways are ***mutually exclusive***.
|
||||
|
||||
## Default behavior
|
||||
|
||||
When using `acaContextActions` directive as shown below, Context Menu actions are loaded from `app.extensions.json` by default.
|
||||
|
||||
```html
|
||||
<adf-document-list
|
||||
#documentList
|
||||
acaContextActions>
|
||||
</adf-document-list>
|
||||
```
|
||||
|
||||
*Note:* To learn more, see [Extensibility features](../extending/extensibility-features.md) and [Extension format](../extending/extension-format.md).
|
||||
|
||||
## Injecting Context Menu Actions
|
||||
|
||||
In order to inject custom actions into Context Menu, assign an array of rules, formatted as described in [Extension format](../extending/extension-format.md), to an attribute of a Component using [Document List Component](https://github.com/Alfresco/alfresco-ng2-components/blob/develop/docs/content-services/components/document-list.component.md).
|
||||
|
||||
```ts
|
||||
const contextMenuAction = [
|
||||
{
|
||||
"id": "custom.action.id",
|
||||
"title": "CUSTOM_ACTION",
|
||||
"order": 1,
|
||||
"icon": "adf:custom-icon",
|
||||
"actions": {
|
||||
"click": "CUSTOM_ACTION"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "show.custom.action"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "another.custom.action.id"
|
||||
|
||||
...
|
||||
}
|
||||
]
|
||||
|
||||
...
|
||||
|
||||
@Component({...})
|
||||
export class ComponentWithDocumentList {
|
||||
customContextMenuActions = contextMenuActions;
|
||||
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Next, pass them to `customActions` input of `acaContextActions` directive inside component's template.
|
||||
|
||||
```html
|
||||
<adf-document-list
|
||||
#documentList
|
||||
acaContextActions
|
||||
customActions="customContextMenuActions">
|
||||
</adf-document-list>
|
||||
```
|
||||
|
||||
*Note:* Refer to [Application Actions](../extending/application-actions.md) and [Rules](../extending/rules.md) for information on creating custom *"actions"* and *"rules"* for Context Menu actions.
|
Reference in New Issue
Block a user