diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-10-15 14:55:25 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-10-15 14:55:25 +0200 |
commit | 8c4c4b700f148db9dfaf31b3a2edb8d8e8cf3f53 (patch) | |
tree | 83555ba96385cb43f26f437e7cbf8e6311d2811c /apps/workflowengine/js/admin.js | |
parent | e36d4a990d19113cd763e5893faaa4d1877d4022 (diff) | |
download | nextcloud-server-8c4c4b700f148db9dfaf31b3a2edb8d8e8cf3f53.tar.gz nextcloud-server-8c4c4b700f148db9dfaf31b3a2edb8d8e8cf3f53.zip |
Move workflowengine to compiled handlebars
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/workflowengine/js/admin.js')
-rw-r--r-- | apps/workflowengine/js/admin.js | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/apps/workflowengine/js/admin.js b/apps/workflowengine/js/admin.js index 66e98205db6..d986c5a494a 100644 --- a/apps/workflowengine/js/admin.js +++ b/apps/workflowengine/js/admin.js @@ -108,29 +108,12 @@ */ /** - * @class OCA.WorkflowEngine.TemplateView - * - * a generic template that handles the Handlebars template compile step - * in a method called "template()" - */ - OCA.WorkflowEngine.TemplateView = - OC.Backbone.View.extend({ - _template: null, - template: function(vars) { - if (!this._template) { - this._template = Handlebars.compile($(this.templateId).html()); - } - return this._template(vars); - } - }); - - /** * @class OCA.WorkflowEngine.OperationView * * this creates the view for a single operation */ OCA.WorkflowEngine.OperationView = - OCA.WorkflowEngine.TemplateView.extend({ + OC.Backbone.View.extend({ templateId: '#operation-template', events: { 'change .check-class': 'checkChanged', @@ -150,6 +133,18 @@ errorMessage: '', saving: false, groups: [], + template: function(vars) { + return OCA.WorkflowEngine.Templates['operation'](_.extend( + { + shortRuleDescTXT: t('workflowengine', 'Short rule description'), + addRuleTXT: t('workflowengine', 'Add rule'), + resetTXT: t('workflowengine', 'Reset'), + saveTXT: t('workflowengine', 'Save'), + savingTXT: t('workflowengine', 'Saving…') + }, + vars + )); + }, initialize: function() { // this creates a new copy of the object to definitely have a new reference and being able to reset the model this.originalModel = JSON.parse(JSON.stringify(this.model)); @@ -354,13 +349,21 @@ * this creates the view for configured operations */ OCA.WorkflowEngine.OperationsView = - OCA.WorkflowEngine.TemplateView.extend({ + OC.Backbone.View.extend({ templateId: '#operations-template', collection: null, $el: null, events: { 'click .button-add-operation': 'add' }, + template: function(vars) { + return OCA.WorkflowEngine.Templates['operations'](_.extend( + { + addRuleGroupTXT: t('workflowengine', 'Add rule group') + }, + vars + )); + }, initialize: function(classname) { if (!OCA.WorkflowEngine.availablePlugins.length) { OCA.WorkflowEngine.availablePlugins = OC.Plugins.getPlugins('OCA.WorkflowEngine.CheckPlugins'); |