From 65f93ea01c2955f6a2458e21021c07c0f8a57ad0 Mon Sep 17 00:00:00 2001 From: Andries Smit Date: Tue, 16 May 2017 18:26:18 +0200 Subject: [PATCH 1/2] Add on change microflow no logic rating --- src/Ratings/ratings_nologic.xml | 6 ++++++ src/Ratings/widget/ratings_nologic.js | 20 +++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/Ratings/ratings_nologic.xml b/src/Ratings/ratings_nologic.xml index a355595..abf0a97 100644 --- a/src/Ratings/ratings_nologic.xml +++ b/src/Ratings/ratings_nologic.xml @@ -42,5 +42,11 @@ + + On change microflow + Behavior + Microflow to be executed when the rate is changed + + diff --git a/src/Ratings/widget/ratings_nologic.js b/src/Ratings/widget/ratings_nologic.js index 6ad0cc1..bd1df49 100644 --- a/src/Ratings/widget/ratings_nologic.js +++ b/src/Ratings/widget/ratings_nologic.js @@ -12,11 +12,15 @@ define([ return declare("Ratings.widget.ratings_nologic", [ _WidgetBase, _TemplatedMixin ], { templateString : widgetTemplate, - name : "", + + // Modeler properties voteEnabled : false, standardImage : "", mouseoverImage : "", + name : "", + onChangeMicroflow: "", + // Internal properties divNode : "", mouseoverArray : null, root : window.mx.appUrl, @@ -109,6 +113,7 @@ define([ this.newvalue = count; if (this.newvalue !== this.oldvalue) { this.onChange(); + this._callMicroflow(this.onChangeMicroflow); } this.displayImages(count); @@ -131,6 +136,19 @@ define([ this.setMouseOver(showVote - 1); }, + _callMicroflow: function(microflowName) { + if (microflowName) { + window.mx.ui.action(microflowName, { + context: this.mxcontext, + origin: this.mxform, + callback: function() { }, + error: function(error) { + window.mx.ui.error("Error executing microflow: " + microflowName + " " + error.message); + } + }); + } + }, + uninitialize : function(){ logger.debug(this.id + ".uninitialize"); for (var i = 0; i < this.mouseoverArray.length; i++){ From c736e7ec68216d440e32bdf822108399d28994c8 Mon Sep 17 00:00:00 2001 From: Andries Smit Date: Wed, 17 May 2017 04:23:28 +0200 Subject: [PATCH 2/2] Allow rating no logic to be 0 --- src/Ratings/widget/ratings_nologic.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ratings/widget/ratings_nologic.js b/src/Ratings/widget/ratings_nologic.js index bd1df49..160c346 100644 --- a/src/Ratings/widget/ratings_nologic.js +++ b/src/Ratings/widget/ratings_nologic.js @@ -43,7 +43,7 @@ define([ logger.debug(this.id + "._setValueAttr"); this.oldvalue = parseInt(value, 10); this.newvalue = parseInt(value, 10); - if (this.newvalue > 0) { + if (this.newvalue >= 0) { this.setRating(this.newvalue); } else if (this.mxcontext.getTrackObject()) { domClass.remove(this.domNode, "hidden");