Module: alfresco/renderers/Actions

alfresco/renderers/Actions

This renderer generates a menu bar containing a drop-down menu of menu items representing an action set.

Actions are either derived from the "actions" attribute on the "currentItem" (which is typically populated through a REST API call to Share and it should be noted that calls to the Repository REST APIs will not include actions), or are defined by the customActions and widgetsForActions attributes.

Custom actions take precedence over all other actions and the widgetsForActions attribute will only be used when neither customActions or "actions" on the "currentItem" can be found. The purpose of the widgetsForActions is to provide a set of default actions that are rendered based on the metadata of a node. The default set of actions can be replaced through configuration if required.

It is possible to filter actions by configuring the filterActions to true and then providing either an allowedActions array or allowedActionsString string. Filtering only applied to actions on defined on the "currentItem" or in the customActions array.

It is also possible to merge all types of actions by configured the mergeActions attribute to be true

Author:
  • Dave Draper
License:
Source:

Examples

Example of filtering currentItem actions

{
  name: "alfresco/renderers/Actions",
  config: {
    filterActions: true,
    allowedActions: [
      "folder-manage-rules",
       "folder-download",
       "folder-view-details"
    ]
  }
}

Example of merging a custom action with currentItem actions (hiding all widgetsForActions)

{
  name: "alfresco/renderers/Actions",
  config: {
    mergeActions: true,
    customActions: [
      {
        id: "CUSTOM",
        label: "Custom Action",
        publishTopic: "CUSTOM_ACTION_TOPIC",
        publishPayloadType: "CURRENT_ITEM",
        type: "javascript"
      },
    ],
    widgetsForActions: []
  }
}

Example of overriding widgetsForActions

{
  name: "alfresco/renderers/Actions",
  config: {
    widgetsForActions: [
      {
        name: "alfresco/renderers/actions/ManageAspects"
      }
    ]
  }
}

Mixes In

Members

_button :object

This will hold a reference to the button that when clicked will display a drop-down menu containing the available actions. This should not be referenced by extending widgets as it may not always be available depending upon how implementation of widget changes.
Type:
  • object
Since:
  • 1.0.62
Default Value:
  • null
Source:

cssRequirements :object[]

An array of the CSS files to use with this widget.
Type:
  • object[]
Default Value:
  • [{cssFile:"./css/Actions.css"}]
Source:

i18nRequirements :object

The array of file(s) containing internationalised strings.
Type:
  • object
Default Value:
  • [{i18nFile: "./i18n/Actions.properties"}]
Source:

label :string

The label to display to as the actions renderer.
Type:
  • string
Since:
  • 1.0.46
Default Value:
  • "alf.renderers.Actions.menuLabel"
Source:

onlyShowOnHover :boolean

Indicates that this should only be displayed when the item (note: NOT the renderer) is hovered over.
Type:
  • boolean
Default Value:
  • false
Source:

Methods

createWidgetDom()

Overrides the inherited function to construct the DOM for the widget using native browser capabilities.
Since:
  • 1.0.101
Source:

destroy(preserveDom)

Ensures that the menu is destroyed.
Parameters:
Name Type Description
preserveDom boolean Indicates whether or not the DOM should be preserved.
Since:
  • 1.0.46
Source:

onKeyPress(evt)

Handles key press events on the actions renderer and opens the menu if
Parameters:
Name Type Description
evt object The key press event
Since:
  • 1.0.46
Source:

postCreate()

Overrides the default to create a popup containing a group containing all the actions for the current item.
Source:

postMixInProperties()

Sets the local appropriate label.
Since:
  • 1.0.46
Source: