summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2019-08-28 11:08:34 +0000
committerThibault Delavallée <tde@odoo.com>2019-08-28 13:27:58 +0000
commit5252f9e8cd5405e877e0dd8e7efd4df829ab9423 (patch)
treefda808a635fb0dcc191d5476627eb696dd6dfcf4
parenta9462adfcb1fcdca14e76c83f1f052ea96cc6227 (diff)
[FIX] website_rating: correctly trigger click on stars
PURPOSE Test frontend and UI tools of eLearning. SPECIFICATIONS Current implementation of rating using stars is a bit strange and may miss some clicks, notably in testing tour. Let us fall back on a classic simple implementation based on clicking on a star. LINKS Task ID 1937768
-rw-r--r--addons/website_rating/static/src/js/portal_composer.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/addons/website_rating/static/src/js/portal_composer.js b/addons/website_rating/static/src/js/portal_composer.js
index 5c4f9648350..bd7aac7a94d 100644
--- a/addons/website_rating/static/src/js/portal_composer.js
+++ b/addons/website_rating/static/src/js/portal_composer.js
@@ -17,7 +17,7 @@ var STAR_RATING_RATIO = 2; // conversion factor from the star (1-5) to the db r
*/
PortalComposer.include({
events: _.extend({}, PortalComposer.prototype.events, {
- 'click .stars': '_onClickStarBlock',
+ 'click .stars i': '_onClickStar',
'mouseleave .stars': '_onMouseleaveStarBlock',
'mousemove .stars i': '_onMoveStar',
'mouseleave .stars i': '_onMoveLeaveStar',
@@ -93,7 +93,9 @@ PortalComposer.include({
/**
* @private
*/
- _onClickStarBlock: function () {
+ _onClickStar: function (ev) {
+ var index = this.$('.stars i').index(ev.currentTarget);
+ this.set("star_value", index + 1);
this.user_click = true;
this.$input.val(this.get("star_value") * STAR_RATING_RATIO);
},