4 /* globals gettext, interpolate */
7 var insertTemplateAction = {
10 fragment: {type: 'context', name: 'fragment'},
11 template: {type: 'select', options: []},
12 ctrl: {type: 'key', key: 'ctrl'}
17 execute: function(params) {
18 var node = params.fragment.node.getNearestElementNode();
19 var toAdd = node.document.createDocumentNode(params.template.content);
23 getState: function(params) {
24 if(!(params.template && params.template.id)) {
27 description: gettext('No template selected')
29 } else if(!params.fragment || !params.fragment.isValid() || !(params.fragment instanceof params.fragment.NodeFragment)) {
32 description: gettext('Wrong node selected')
37 description: interpolate(gettext('Insert template %s after %s'), [params.template.name, params.fragment.node.getNearestElementNode().getTagName()])
44 actions: [insertTemplateAction]