Action bar definition
An action bar organizes actions into sections and groups. The bar is typically displayed on the right hand side of an app. In content apps, the browser subapp has an action bar that allows the user to manage content items (add, edit or delete).
The action bar also defines availability rules that determine which section of the action bar is displayed to the user. For example, when the user selects a content item, you want to only display actions that are relevant for that item.
The action bar references actions that are defined elsewhere. This separation allows you to define an action once and use it in many places, not only in the action bar.
Example definition
Action bar in the Contacts app:
browser:
actionbar:
defaultAction: editContact
sections:
- name: root
# group definition
- name: deletedContact
# group definition
- name: deletedFolder
# groups definition
- name: contact
groups:
- name: addActions
items:
- name: addContact
- name: confirmDeleteContact
- name: editActions
items:
- name: editContact
- name: renameContact
- name: activationActions
items:
- name: activate
- name: deactivate
- name: importExportActions
items:
- name: export
- name: versionsActions
items:
- name: showVersions
- name: restoreVersion
availability:
nodeTypes:
- mgnl:contact
Action bar properties
Property | Description |
---|---|
|
required Action bar configuration. |
|
required Sections defined in the bar. |
|
required Name of the section. Name your sections after what the user has
selected, such as |
|
required Actions that belong together. Separated by horizontal lines in the action bar. |
|
required Name of the group. |
|
required Node containing the action names. |
|
required Name of the action. Must be the same as the name defined in Dialog definition. |
|
optional Defines whether the section is displayed to the user. Typically depends on what type of node the user has selected. |
|
optional Green text displayed to users in the action bar. |
|
optional Name of the action executed when the user double-clicks an item. |
Action bar availability
Action bar availability defines whether a particular section of the action bar is available.
Action bar availability is different from action availability where availability rules are defined on an individual action level and apply to each use of the action. |
For example, in the action bar configuration in the Contacts app:
-
Actions in the
root
section appear on the root node only. The user sees the Add contact, Add folder and Import actions defined in the groups in theroot
section. -
Actions in the
contact
section appear on selection of amgnl:contact
node type. -
Actions in the
deletedContact
section appear on selection of amgnl:contact
node type, but theIsDeletedRule
rule class limits action availability to the Request permanent deletion and Restore previous version actions when a contact has been marked for deletion. This rule returnstrue
if the item is a node and has themgnl:deleted
mixin type.
actionbar:
defaultAction: editContact
sections:
- name: root
groups:
# group definitions
availability:
nodes: false
root: true
- name: deletedContact
groups:
# group definitions
availability:
nodeTypes:
- mgnl:contact
rules:
- name: isDeletedRule
- name: deletedFolder
# groups definition
- name: contact
groups:
# group definitions
availability:
nodeTypes:
- mgnl:contact
Availability properties
Property | Description | ||
---|---|---|---|
|
required Name of the section. |
||
|
required Defines the availability configuration for the section. |
||
|
optional Section is available if the current user has one of the listed roles. |
||
|
required Section is available to users assigned the list of roles. |
||
|
required Name of the role that is permitted to execute the action. Add one property for each role. |
||
|
optional, default is Section is available if the selected item is a node. |
||
|
optional Section is available if the selected item is one of the node types listed. |
||
|
required Valid node type such as
|
||
|
optional Section is available if the selected item matches every availability rule class. |
||
|
required It gives the node a name that describes the rule class. One node for each rule, and the node name is arbitrary. |
||
|
required (unless Action availability definition class. The class must implement the info.magnolia.ui.api.availability.AvailabilityDefinition interface. Set the value to the fully qualified class name. |
||
|
You can use this as a shortcut for |
||
|
required The class that contains custom logic to check if the action is permitted on the selected item and implements info.magnolia.ui.availability.rule.AvailabilityRule. Your custom class must extend info.magnolia.ui.availability.rule.AbstractAvailabilityRule. A default implementation class is typically hard-coded in the definition class. You only need to add this property if you want to override the default implementation. |
||
|
optional Section is available at the workspace root level if |
||
|
optional, default is Action is available for folders only if
|
||
|
optional, default is Section is available if the selected item is a property. |
||
|
optional, default is Defines whether the action is available for multiple items. For more information, see Actions on multiple items. |
||
|
optional, default is Set to |