summaryrefslogtreecommitdiff
path: root/addons/website_rating/static/src
diff options
context:
space:
mode:
authorRobot Odoo <xmo+roboto@odoo.com>2019-02-21 18:29:32 +0100
committerGitHub <noreply@github.com>2019-02-21 18:29:32 +0100
commit1af67ffdfa370ade4ea12f227d7c4fae5bc02170 (patch)
treeaac3e5369f84e6e7ddc0f013aa99b21c22dc86e2 /addons/website_rating/static/src
parent5da4fa46970f7f79cf2cb7e2c2488a3b20430a98 (diff)
parent039df4a79e27867e216cf48d28274f3ea3d7fdfc (diff)
[MERGE] website_slides: improve layout of courses main pages and apply various fixes
Purpose of this merge is to provide several fixes related to new elearning application [1]. This is second batch of fixes [2]. Those are mainly fixes and improvements for front-end templates: layouting, clean design. Some other fixes are also included, notably links and search capabilities. See sub commits for more details. Thanks to @awa-odoo @jem-odoo @stefanorigano @qmo-odoo @dbeguin for their work as most of code come from cherry-picks. Merge linked to task ID 1941250. [1] eLearning feature: see task ID 1902304 [2] First batch of fixes landed at 5cec06b179f3dfe48c091f627d9e9c3255c30438 closes odoo/odoo#31317
Diffstat (limited to 'addons/website_rating/static/src')
-rw-r--r--addons/website_rating/static/src/js/website_mail.js11
-rw-r--r--addons/website_rating/static/src/xml/website_mail.xml2
2 files changed, 9 insertions, 4 deletions
diff --git a/addons/website_rating/static/src/js/website_mail.js b/addons/website_rating/static/src/js/website_mail.js
index 8f21f740c98..6fd9a305e95 100644
--- a/addons/website_rating/static/src/js/website_mail.js
+++ b/addons/website_rating/static/src/js/website_mail.js
@@ -33,6 +33,11 @@ odoo.define('website_rating.thread', function(require) {
init: function(parent, options){
this._super.apply(this, arguments);
+ // apply ratio to default rating value
+ if (options.default_rating_value) {
+ options.default_rating_value = parseFloat(options.default_rating_value) / STAR_RATING_RATIO;
+ }
+
// default options
this.options = _.defaults(this.options, {
'default_message': false,
@@ -50,7 +55,7 @@ odoo.define('website_rating.thread', function(require) {
'5': _t("I love it"),
};
this.user_click = false; // user has click or not
- this.set("star_value", this.options.rating_default_value);
+ this.set("star_value", this.options.default_rating_value);
this.on("change:star_value", this, this._onChangeStarValue);
},
start: function(){
@@ -59,7 +64,7 @@ odoo.define('website_rating.thread', function(require) {
// rating stars
self.$input = self.$('input[name="rating_value"]');
self.$star_list = self.$('.stars').find('i');
- self.set("star_value", self.options.rating_default_value); // set the default value to trigger the display of star widget
+ self.set("star_value", self.options.default_rating_value); // set the default value to trigger the display of star widget
});
},
@@ -265,7 +270,7 @@ odoo.define('website_rating.thread', function(require) {
_onChangeRatingDomain: function(){
var domain = [];
if(this.get('rating_value')){
- domain = [['rating_value', '=', this.get('rating_value')]];
+ domain = [['rating_value', '=', this.get('rating_value') * STAR_RATING_RATIO]];
}
this._changeCurrentPage(1, domain);
},
diff --git a/addons/website_rating/static/src/xml/website_mail.xml b/addons/website_rating/static/src/xml/website_mail.xml
index 11534a768c2..d4e8dd83218 100644
--- a/addons/website_rating/static/src/xml/website_mail.xml
+++ b/addons/website_rating/static/src/xml/website_mail.xml
@@ -79,7 +79,7 @@
<div class="rate_text">
<span class="badge badge-info"></span>
</div>
- <input type="hidden" readonly="readonly" name="rating_value" t-att-value="default_rating"/>
+ <input type="hidden" readonly="readonly" name="rating_value" t-att-value="default_rating || ''"/>
</div>
</t>