Allow to define the operation

This commit is contained in:
Joas Schilling 2016-08-02 09:56:19 +02:00
parent 7c1560d787
commit 62d009ad09
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
3 changed files with 10 additions and 13 deletions

View File

@ -137,6 +137,7 @@
'change .check-operator': 'checkChanged', 'change .check-operator': 'checkChanged',
'change .check-value': 'checkChanged', 'change .check-value': 'checkChanged',
'change .operation-name': 'operationChanged', 'change .operation-name': 'operationChanged',
'change .operation-operation': 'operationChanged',
'click .button-reset': 'reset', 'click .button-reset': 'reset',
'click .button-save': 'save', 'click .button-save': 'save',
'click .button-add': 'add', 'click .button-add': 'add',
@ -269,7 +270,7 @@
return; return;
} }
if (key !== 'name') { if (key !== 'name' && key !== 'operation') {
console.warn('key "' + key + '" is no valid attribute'); console.warn('key "' + key + '" is no valid attribute');
return; return;
} }
@ -308,6 +309,8 @@
}, 7000, this.$el.find('.msg.success')); }, 7000, this.$el.find('.msg.success'));
this.message = ''; this.message = '';
} }
return this.$el;
} }
}); });
@ -324,10 +327,7 @@
events: { events: {
'click .button-add-operation': 'add' 'click .button-add-operation': 'add'
}, },
initialize: function() { initialize: function(classname) {
this._initialize('OCA\\WorkflowEngine\\Operation');
},
_initialize: function(classname) {
if (!OCA.WorkflowEngine.availablePlugins.length) { if (!OCA.WorkflowEngine.availablePlugins.length) {
OCA.WorkflowEngine.availablePlugins = OC.Plugins.getPlugins('OCA.WorkflowEngine.CheckPlugins'); OCA.WorkflowEngine.availablePlugins = OC.Plugins.getPlugins('OCA.WorkflowEngine.CheckPlugins');
_.each(OCA.WorkflowEngine.availablePlugins, function(plugin) { _.each(OCA.WorkflowEngine.availablePlugins, function(plugin) {
@ -346,11 +346,8 @@
var operation = this.collection.create(); var operation = this.collection.create();
this.renderOperation(operation); this.renderOperation(operation);
}, },
renderOperation: function(operation){ renderOperation: function(subView){
var subView = new OCA.WorkflowEngine.OperationView({ var operationsElement = this.$el.find('.operations');
model: operation
}),
operationsElement = this.$el.find('.operations');
operationsElement.append(subView.$el); operationsElement.append(subView.$el);
subView.render(); subView.render();
}, },

View File

@ -49,7 +49,7 @@
placeholder: t('workflowengine', 'Select tag…'), placeholder: t('workflowengine', 'Select tag…'),
query: _.debounce(function(query) { query: _.debounce(function(query) {
query.callback({ query.callback({
results: OCA.WorkflowEngine.Plugins.FileSystemTagsPlugin.collection.filterByName(query.term) results: OC.SystemTags.collection.filterByName(query.term)
}); });
}, 100, true), }, 100, true),
id: function(element) { id: function(element) {
@ -63,7 +63,7 @@
return OC.SystemTags.getDescriptiveTag(tag); return OC.SystemTags.getDescriptiveTag(tag);
}, },
formatSelection: function (tagId) { formatSelection: function (tagId) {
tag = OCA.WorkflowEngine.Plugins.FileSystemTagsPlugin.collection.get(tagId); var tag = OC.SystemTags.collection.get(tagId);
return OC.SystemTags.getDescriptiveTag(tag); return OC.SystemTags.getDescriptiveTag(tag);
}, },
escapeMarkup: function(m) { escapeMarkup: function(m) {

View File

@ -36,7 +36,7 @@
{{#if operation.id}} {{#if operation.id}}
<span class="button-delete pull-right icon-delete"></span> <span class="button-delete pull-right icon-delete"></span>
{{/if}} {{/if}}
<span class="pull-right info">{{operation.class}} - ID: {{operation.id}} - operation: {{operation.operation}}</span> <input type="text" class="pull-right operation-operation" value="{{operation.operation}}">
<div class="checks"> <div class="checks">
{{#each operation.checks}} {{#each operation.checks}}