diff --git a/apps/workflowengine/js/admin.js b/apps/workflowengine/js/admin.js
index 66e98205db..d986c5a494 100644
--- a/apps/workflowengine/js/admin.js
+++ b/apps/workflowengine/js/admin.js
@@ -107,30 +107,13 @@
* Y8P 888 "Y8888 "Y8888888P" 88888P'
*/
- /**
- * @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');
diff --git a/apps/workflowengine/js/templates.js b/apps/workflowengine/js/templates.js
new file mode 100644
index 0000000000..157d396357
--- /dev/null
+++ b/apps/workflowengine/js/templates.js
@@ -0,0 +1,109 @@
+(function() {
+ var template = Handlebars.template, templates = OCA.WorkflowEngine.Templates = OCA.WorkflowEngine.Templates || {};
+templates['operation'] = template({"1":function(container,depth0,helpers,partials,data) {
+ return " modified";
+},"3":function(container,depth0,helpers,partials,data) {
+ return " \n";
+},"5":function(container,depth0,helpers,partials,data,blockParams,depths) {
+ var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
+
+ return "
\n \n \n \n \n
\n";
+},"6":function(container,depth0,helpers,partials,data,blockParams,depths) {
+ var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
+
+ return " \n";
+},"8":function(container,depth0,helpers,partials,data,blockParams,depths) {
+ var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
+
+ return " \n";
+},"10":function(container,depth0,helpers,partials,data) {
+ var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {});
+
+ return ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.operation : depth0)) != null ? stack1.id : stack1),{"name":"if","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + " \n";
+},"11":function(container,depth0,helpers,partials,data) {
+ var helper;
+
+ return " \n";
+},"13":function(container,depth0,helpers,partials,data) {
+ var helper;
+
+ return " \n "
+ + container.escapeExpression(((helper = (helper = helpers.savingTXT || (depth0 != null ? depth0.savingTXT : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"savingTXT","hash":{},"data":data}) : helper)))
+ + "\n ";
+},"15":function(container,depth0,helpers,partials,data) {
+ var stack1;
+
+ return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.message : depth0),{"name":"if","hash":{},"fn":container.program(16, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "");
+},"16":function(container,depth0,helpers,partials,data) {
+ var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {});
+
+ return "\n \n "
+ + container.escapeExpression(((helper = (helper = helpers.message || (depth0 != null ? depth0.message : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(alias1,{"name":"message","hash":{},"data":data}) : helper)))
+ + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.errorMessage : depth0),{"name":"if","hash":{},"fn":container.program(21, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + "\n \n ";
+},"17":function(container,depth0,helpers,partials,data) {
+ return "error";
+},"19":function(container,depth0,helpers,partials,data) {
+ return "success";
+},"21":function(container,depth0,helpers,partials,data) {
+ var helper;
+
+ return " "
+ + container.escapeExpression(((helper = (helper = helpers.errorMessage || (depth0 != null ? depth0.errorMessage : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"errorMessage","hash":{},"data":data}) : helper)));
+},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) {
+ var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda;
+
+ return "\n \n\n
\n"
+ + ((stack1 = helpers.each.call(alias1,((stack1 = (depth0 != null ? depth0.operation : depth0)) != null ? stack1.checks : stack1),{"name":"each","hash":{},"fn":container.program(5, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + "
\n
\n"
+ + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.hasChanged : depth0),{"name":"if","hash":{},"fn":container.program(10, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.saving : depth0),{"name":"if","hash":{},"fn":container.program(13, data, 0, blockParams, depths),"inverse":container.program(15, data, 0, blockParams, depths),"data":data})) != null ? stack1 : "")
+ + "\n
\n";
+},"useData":true,"useDepths":true});
+templates['operations'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
+ var helper;
+
+ return "\n\n";
+},"useData":true});
+})();
\ No newline at end of file
diff --git a/apps/workflowengine/js/templates/operation.handlebars b/apps/workflowengine/js/templates/operation.handlebars
new file mode 100644
index 0000000000..0899890cef
--- /dev/null
+++ b/apps/workflowengine/js/templates/operation.handlebars
@@ -0,0 +1,45 @@
+
+
+
+
+ {{#each operation.checks}}
+
+
+
+
+
+
+ {{/each}}
+
+
+ {{#if hasChanged}}
+ {{! reset only makes sense if the operation is already saved }}
+ {{#if operation.id}}
+
+ {{/if}}
+
+ {{/if}}
+ {{#if saving}}
+
+
{{savingTXT}}
+ {{else}}{{#if message}}
+
+ {{message}}{{#if errorMessage}} {{errorMessage}}{{/if}}
+
+ {{/if}}{{/if}}
+
diff --git a/apps/workflowengine/js/templates/operations.handlebars b/apps/workflowengine/js/templates/operations.handlebars
new file mode 100644
index 0000000000..14b62ee79a
--- /dev/null
+++ b/apps/workflowengine/js/templates/operations.handlebars
@@ -0,0 +1,2 @@
+
+
diff --git a/apps/workflowengine/lib/AppInfo/Application.php b/apps/workflowengine/lib/AppInfo/Application.php
index 89d342400c..0b90a4323e 100644
--- a/apps/workflowengine/lib/AppInfo/Application.php
+++ b/apps/workflowengine/lib/AppInfo/Application.php
@@ -64,6 +64,7 @@ class Application extends \OCP\AppFramework\App {
script('workflowengine', [
'admin',
+ 'templates',
// Check plugins
'filemimetypeplugin',
diff --git a/apps/workflowengine/templates/admin.php b/apps/workflowengine/templates/admin.php
index 26d581aee0..d3faace71f 100644
--- a/apps/workflowengine/templates/admin.php
+++ b/apps/workflowengine/templates/admin.php
@@ -39,58 +39,5 @@
-
-
-
-
t('Loading…')); ?>
diff --git a/build/compile-handlebars-templates.sh b/build/compile-handlebars-templates.sh
index 2f83dd3956..1cbdbe4c83 100755
--- a/build/compile-handlebars-templates.sh
+++ b/build/compile-handlebars-templates.sh
@@ -25,6 +25,8 @@ handlebars -n OCA.Comments.Templates apps/comments/js/templates -f apps/comments
# Versions app
handlebars -n OCA.Versions.Templates apps/files_versions/js/templates -f apps/files_versions/js/templates.js
+# Workflowengine
+handlebars -n OCA.WorkflowEngine.Templates apps/workflowengine/js/templates -f apps/workflowengine/js/templates.js
if [[ $(git diff --name-only) ]]; then
echo "Please submit your compiled handlebars templates"