diff options
| author | Benoit Socias <bso@odoo.com> | 2020-12-03 13:28:17 +0000 |
|---|---|---|
| committer | Benoit Socias <bso@odoo.com> | 2020-12-03 13:28:55 +0000 |
| commit | 486c445d2200d3805ffac30e84ff35a7a61bf0b7 (patch) | |
| tree | 0bd22c07f8598d7f712824ba182752f9f3d3318a | |
| parent | 82106350d3a7b82c6c529ae4ff9a2513ae34518e (diff) | |
[FIX] website_mail: adjust the visibility of the (un)subscribe buttons
Before this commit the visibility of the blog (un)subscribe/(un)follow
buttons was behaving inconsistently because of a combination of specific
CSS based on data values and the adding and removal of d-none classes.
After this commit the visibility of the buttons is using only the CSS
mechanism based on data values. Also adjusted the alignment of the email
text input and its attached button (aligned in both blog & forum).
Fixes https://github.com/odoo/odoo/issues/62714
closes odoo/odoo#62823
Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
| -rw-r--r-- | addons/website_mail/static/src/js/follow.js | 2 | ||||
| -rw-r--r-- | addons/website_mail/views/website_mail_templates.xml | 4 |
2 files changed, 2 insertions, 4 deletions
diff --git a/addons/website_mail/static/src/js/follow.js b/addons/website_mail/static/src/js/follow.js index 02ec8196b09..e2c349ce224 100644 --- a/addons/website_mail/static/src/js/follow.js +++ b/addons/website_mail/static/src/js/follow.js @@ -85,8 +85,6 @@ publicWidget.registry.follow = publicWidget.Widget.extend({ * @param {jQuery} $jsFollowEls */ _updateSubscriptionDOM: function (follow, email, $jsFollowEls) { - $jsFollowEls.find(".js_follow_btn").toggleClass('d-none', follow); - $jsFollowEls.find(".js_unfollow_btn").toggleClass('d-none', !follow); $jsFollowEls.find('input.js_follow_email') .val(email || "") .attr("disabled", email && (follow || this.isUser) ? "disabled" : false); diff --git a/addons/website_mail/views/website_mail_templates.xml b/addons/website_mail/views/website_mail_templates.xml index 549043a28fb..cca4395575d 100644 --- a/addons/website_mail/views/website_mail_templates.xml +++ b/addons/website_mail/views/website_mail_templates.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <odoo> <template id="follow"> - <div class="input-group js_follow" t-att-data-id="object.id" + <div t-attf-class="input-group js_follow #{div_class}" t-att-data-id="object.id" t-att-data-object="object._name" t-att-data-follow="object.id and object.message_is_follower and 'on' or 'off'" t-att-data-unsubscribe="'unsubscribe' if 'unsubscribe' in request.params else None"> @@ -22,7 +22,7 @@ </div> </button> </div> - <div t-else="" t-attf-class="#{request.env.user.has_group('base.group_public') and 'input-group-append'} #{div_class}"> + <div t-else="" t-attf-class="#{request.env.user.has_group('base.group_public') and 'input-group-append'}"> <button href="#" t-attf-class="btn btn-secondary js_unfollow_btn">Unsubscribe</button> <button href="#" t-attf-class="btn btn-primary js_follow_btn">Subscribe</button> </div> |
