new FileActions()
Construct a new FileActions instance
- Source:
Members
$el
Dummy jquery element, for events
- Source:
currentFile
- Deprecated:
- Yes
- Source:
Methods
_defaultRenderAction(actionSpec, isDefault, context)
Default function to render actions
Parameters:
Name | Type | Description |
---|---|---|
actionSpec |
OCA.Files.FileAction | file action spec |
isDefault |
boolean | true if the action is a default one, false otherwise |
context |
OCA.Files.FileActionContext | action context |
- Source:
_makeActionLink(params)
Renders the action link element
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | action params |
- Source:
_notifyUpdateListeners(eventName, data)
Notifies the event handlers
Parameters:
Name | Type | Description |
---|---|---|
eventName |
String | event name |
data |
Object | data |
- Source:
_renderInlineAction(actionSpec, isDefault, context)
Renders the action element by calling actionSpec.render() and
registers the click event to process the action.
Parameters:
Name | Type | Description |
---|---|---|
actionSpec |
OCA.Files.FileAction | file action to render |
isDefault |
boolean | true if the action is a default action, false otherwise |
context |
OCA.Files.FileActionContext | rendering context |
- Source:
_renderMenuTrigger($tr, context)
Renders the menu trigger on the given file list row
Parameters:
Name | Type | Description |
---|---|---|
$tr |
Object | file list row element |
context |
OCA.Files.FileActionContext | rendering context |
- Source:
_showMenu(fileName, context)
Displays the file actions dropdown menu
Parameters:
Name | Type | Description |
---|---|---|
fileName |
string | file name |
context |
OCA.Files.FileActionContext | rendering context |
- Source:
clear()
Clears all registered file actions.
- Source:
display(parent, triggerEvent, fileList)
Display file actions for the given element
Parameters:
Name | Type | Description |
---|---|---|
parent |
"td" element of the file for which to display actions | |
triggerEvent |
if true, triggers the fileActionsReady on the file list afterwards (false by default) | |
fileList |
OCA.Files.FileList instance on which the action is done, defaults to OCA.Files.App.fileList |
- Source:
get(mime, type, permissions) → {Object.<string, OCA.Files.FileActions~actionHandler>}
Returns a map of file actions handlers matching the given conditions
Parameters:
Name | Type | Description |
---|---|---|
mime |
string | mime type |
type |
string | "dir" or "file" |
permissions |
int | permissions |
- Source:
Returns:
map of action name to action spec
- Type
- Object.<string, OCA.Files.FileActions~actionHandler>
getActions(mime, type, permissions) → {Array.<OCA.Files.FileAction>}
Returns an array of file actions matching the given conditions
Parameters:
Name | Type | Description |
---|---|---|
mime |
string | mime type |
type |
string | "dir" or "file" |
permissions |
int | permissions |
- Source:
Returns:
array of action specs
- Type
- Array.<OCA.Files.FileAction>
getDefault(mime, type, permissions) → {OCA.Files.FileActions~actionHandler}
Returns the default file action handler for the given conditions
Parameters:
Name | Type | Description |
---|---|---|
mime |
string | mime type |
type |
string | "dir" or "file" |
permissions |
int | permissions |
- Deprecated:
- use getDefaultFileAction instead
- Source:
Returns:
action handler
getDefaultFileAction(mime, type, permissions) → {OCA.Files.FileActions~actionHandler}
Returns the default file action handler for the given conditions
Parameters:
Name | Type | Description |
---|---|---|
mime |
string | mime type |
type |
string | "dir" or "file" |
permissions |
int | permissions |
- Since:
- 8.2
- Source:
Returns:
action handler
(private) initialize()
- Source:
merge(fileActions)
Merges the actions from the given fileActions into
this instance.
Parameters:
Name | Type | Description |
---|---|---|
fileActions |
OCA.Files.FileActions | instance of OCA.Files.FileActions |
- Source:
off(eventName, Function)
Removes an event handler
Parameters:
Name | Type | Description |
---|---|---|
eventName |
String | event name |
Function |
callback |
- Source:
on(eventName, callback)
Adds an event handler
Parameters:
Name | Type | Description |
---|---|---|
eventName |
String | event name |
callback |
function |
- Source:
register()
- Deprecated:
- use #registerAction() instead
- Source:
registerAction(action)
Register action
Parameters:
Name | Type | Description |
---|---|---|
action |
OCA.Files.FileAction | object |
- Source:
registerDefaultActions()
Register the actions that are used by default for the files app.
- Source:
setDefault(mime, name)
Sets the default action for a given mime type.
Parameters:
Name | Type | Description |
---|---|---|
mime |
String | mime type |
name |
String | action name |
- Source:
triggerAction(actionName, fileInfoModel, fileListopt) → {boolean}
Trigger the given action on the given file.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
actionName |
string | action name | |
fileInfoModel |
OCA.Files.FileInfoModel | file info model | |
fileList |
OCA.Files.FileList |
<optional> |
file list, for compatibility with older action handlers [DEPRECATED] |
- Since:
- 8.2
- Source:
Returns:
true if the action handler was called, false otherwise
- Type
- boolean