Difference between revisions of "AppSuite:Files App Actions"

(Created page with "<div class="title">Adding actions to the files detail area</div> To add an action to the files app detail area the extensionpoint io.ox/files/links/inline is used. Use the Li...")
 
Line 1: Line 1:
 +
{{Stability-experimental}}
 +
 
<div class="title">Adding actions to the files detail area</div>
 
<div class="title">Adding actions to the files detail area</div>
  

Revision as of 14:25, 25 April 2013

API status: In Development

Adding actions to the files detail area

To add an action to the files app detail area the extensionpoint io.ox/files/links/inline is used. Use the Link pattern in io.ox/core/extPatterns/links.js to extend this point. Try via console:

 
require(['io.ox/core/extensions', 'io.ox/core/extPatterns/links'], function (ext, links) {

  new links.Action('io.ox/files/actions/testlink', {
    requires: function (e) {
      e.collection.has('some') && capabilities.has('webmail');
    },
    multiple: function (baton) {
      console.log(baton);
    }
  });

  ext.point('io.ox/files/links/inline').extend(new links.Link({
    id: 'testlink',
    index: 400,
    label: 'labelname',
    ref: 'io.ox/files/actions/testlink'
  }));
});

Action

The first argument is the unique id of the action.

requires - checks for the needed components and the collection status. (some is used for multiple elements, one for an single one)

  • If the action is used only on a single element use action.
  • If the action should be applied to multiple elements use multiple.
  • In both cases the baton is available to the action.

Link

  • id - must be unique
  • index - the position/order of the link
  • label - the label for the link
  • ref - the reference to the action id