Class ZmActionController
Manages an undo stack (ZmActionStack) and the "Undo" toast messages
Optimally there should only be one object of this class, globally reachable
Defined in: ZmActionController.js.
Class Summary
Constructor Attributes |
Constructor Name and Description |
|
|
Method Summary
Method Attributes |
Method Name and Description |
|
Logs a raw action, dismissing any current undo message, interpreting the params and creates a ZmAction object that is pushed onto the stack and returned
See also @link ZmActionStack.prototype.logAction
|
|
Dismisses the popped up toast
|
|
Returns the HTML code for a link that will undo the specified action
|
|
Undoes the specified action
|
Class Detail
ZmActionController()
Method Detail
actionPerformed(op, attrs, items, item, ids, id)
Logs a raw action, dismissing any current undo message, interpreting the params and creates a ZmAction object that is pushed onto the stack and returned
See also @link ZmActionStack.prototype.logAction
- Parameters:
-
{String} op
- operation to perform. Currently supported are "move", "trash", "spam" and "!spam"
-
{Hash} attrs
Optional
- attributes for the operation. Pretty much the same as what the backend expects, e.g. "l" for the destination folderId of a move
-
{String} items
Optional
- array of items to perform the action for. Valid types are specified in ZmActionStack.validTypes. Only one of [items],[item],[ids] or [id] should be specified; the first one found is used, ignoring the rest.
-
{String} item
Optional
- item to perform the action for, if there is only one item. Accomplishes the same as putting the item in an array and giving it as [items]
-
{String} ids
Optional
- array of ids of items to perform the action for.
-
{String} id
Optional
- id of item to perform the action for, if there is only one. Accomplishes the same as putting the id in an array and giving it as [ids].
dismiss()
Dismisses the popped up toast
getUndoLink(actionElement, text)
Returns the HTML code for a link that will undo the specified action
- Parameters:
-
{ZmAction} actionElement
- undoable action to be called when the link is pressed
-
{String} text
Optional
- optional custom text for the link body. Defaults to ZmMsg.undo
undo(action)
Undoes the specified action
- Parameters:
-
{ZmAction} action
- the action to undo
|