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, 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 which are defined elsewhere. This separation allows you define an action once and use it in many places, not only in the action bar.

Here is the action bar from the Contacts app.

Node name

Value

 browser

 

 actionbar

 

 sections

 

 root

 

 groups

 

 addActions

 

 items

 

 addContact

 

 addFolder

 

 importExportActions

 

 availability

 

 nodes

false 

 root

true 

 label

Contacts 

 deletedContact

 

 deletedFolder

 

 contact

 

 folder

 

 defaultAction

editContact

 

Properties:

  • actionbar
    • sections
      • <section name>: Name your sections after what the user has selected, such as folder when a folder is selected.
        • groups: Groups are actions that belong together. They are separated by horizontal lines in the action bar.
          • <group name>: Name your groups after what is common to the actions. For example, create an addActions group for actions like addFolder and addContact.
            • items
              • <action name>: Name of the action. Must be the same as defined in the action definition.
        • availability: Defines whether the section is displayed to the user. This typically depends on what type of node the user has selected.
        • label: The section label is the green text displayed to users on the action bar.
      • defaultAction: Name of the action executed when the user double-clicks an item.

 

Availability

Action bar availability defines whether a particular section of the action bar is available. If the section is available, then action availability is checked.

For example, in the action bar configuration in the Contacts app:

  • Actions in the root section display on the root node only. The user sees the Add contact, Add folder and Import actions defined in the groups in the root section.
  • Actions in the contact section display on selection of a mgnl:contact node type.
  • Actions in the deletedContact section display on selection of a mgnl:contact node type, but the IsDeletedRule rule class limits action availability when a contact has been marked for deletion to the Publish deletion and Restore previous version actions. This rule returns true if the item is a node and has the mgnl:deleted mixin type.
Node nameValue

 actionbar

 

 sections

 

 root

 

 groups

 

 availability

 

 nodes

false

 root

true

 deletedContact

 

 groups

 

 availability

 

 nodeTypes

 

 contact

mgnl:contact

 ruleClass

info.magnolia.ui.api.availability.IsDeletedRule

 deletedFolder

 

 contact

 

 groups

 

 availability

 

 nodeTypes

 

 contact

mgnl:contact

Properties

  • availability
    • access: Section is available if the current user has one of the listed roles.
      • roles
        • <role>: Name of the role that is permitted to execute the action.
    • nodes: Section is available if the selected item is a node.
    • nodeTypes: Sectionis available if the selected item is one of the node types listed.
      • <node type>: A valid node type such as mgnl:folder.
    • ruleClass: Class that contains custom logic to check if the action is permitted on the selected item. A common example is info.magnolia.ui.api.availability.IsNotDeletedRule which checks that the item is not marked for deletion. Your custom class must extend AbstractAvailabilityRule .
    • root: Action is available at the workspace root level if true.
    • properties: Action is available if the selected item is a property.

Here's the action bar:

  • With no selection.
  • When a contact is selected.
  • After a contact is deleted.

   

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. 

 

#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
  • No labels