Actions Widget

The Actions and ActionsHelper widgets allow for creating arbitrary collections of behavioral links and situating them in DOM elements on the page. In the absence of a label attribute, they can be presented with CSS sprites for graphical representation. When actions are running, they have their primary linkClassName CSS class replaced with lazr-waiting, which can be styled as needed (spinner, hidden, greyed-out, &c). Each action can be governed by a permission, which will fire at the time of rendering and, if failing, decorate the action with the lazr-action-disabled class, which can be styled as needed (hidden, greyed-out, &c).


Permissions

Can Read File?
Can Delete File?
Sample file.txt

Sample Code

    actions_helper = new Y.lazr.actions.ActionsHelper(
        {
            actions: [
                new Y.lazr.actions.Action(
                    {title: "File Information",
                     linkClassName: "info-button",
                     action: function() { alert('Some info about the file.'); },
                     permission: permission_factory('can_read')}),
                new Y.lazr.actions.Action(
                    {title: "Delete File",
                     linkClassName: "delete-button",
                     itemClassName: "destructive"
                     action: function() { alert('Delete file?'); },
                     permission: permission_factory('can_delete')}),
                ],
            actionsId: "file-inline-actions"
        }
    );