diff options
| author | jem-odoo <jem@openerp.com> | 2019-02-20 09:10:07 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2019-02-21 16:39:56 +0000 |
| commit | 039df4a79e27867e216cf48d28274f3ea3d7fdfc (patch) | |
| tree | aac3e5369f84e6e7ddc0f013aa99b21c22dc86e2 /addons | |
| parent | fdc36c5c37646cc6a0be055023423baa0b57760d (diff) | |
[FIX] website_slides: fix vote widget
Fix route of vote widget. Set it to auth=public so that instead of a crash
we have correct popup asking to login. Better than a SessionException, which
will not be displayed.
Another fix is done to avoid having one widget for all displayed like / dislike
buttons. Each slide should have its own vote widget.
Commit linked to task ID 1941250 and PR #31317.
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/website_slides/controllers/main.py | 2 | ||||
| -rw-r--r-- | addons/website_slides/static/src/js/slides_like.js | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/addons/website_slides/controllers/main.py b/addons/website_slides/controllers/main.py index ea7da51046c..7ab6b6052d7 100644 --- a/addons/website_slides/controllers/main.py +++ b/addons/website_slides/controllers/main.py @@ -538,7 +538,7 @@ class WebsiteSlides(WebsiteProfile): } # JSONRPC - @http.route('/slides/slide/like', type='json', auth="user", website=True) + @http.route('/slides/slide/like', type='json', auth="public", website=True) def slide_like(self, slide_id, upvote): if request.website.is_public_user(): return {'error': 'public_user'} diff --git a/addons/website_slides/static/src/js/slides_like.js b/addons/website_slides/static/src/js/slides_like.js index 589ca6fefda..f0589373cb9 100644 --- a/addons/website_slides/static/src/js/slides_like.js +++ b/addons/website_slides/static/src/js/slides_like.js @@ -86,8 +86,11 @@ sAnimations.registry.websiteSlidesLike = sAnimations.Class.extend({ * @param {Object} parent */ start: function () { + var self = this; var defs = [this._super.apply(this, arguments)]; - defs.push(new LikeButton(this).attachTo($('.o_wslides_like'))); + $('.o_wslides_like').each(function () { + defs.push(new LikeButton(self).attachTo($(this))); + }); return $.when.apply($, defs); }, }); |
