[IMP] portal_rating: allow to tweak popup composer button display

PURPOSE

Change the display of the button to open the composer from btn-primary to
btn-link.

SPECIFICATIONS

In order to ease integration of popup composer rating widget, let us allow
to customize classes given to the button triggering it. In slides we want
specifically it to be a link, not a button.

LINKS

Task ID-2241513
PR #55698
This commit is contained in:
Patrick Hoste
2020-08-11 10:20:04 +00:00
committed by Thibault Delavallée
parent 923c1eae5e
commit 414329dcf1
3 changed files with 6 additions and 3 deletions
@@ -12,7 +12,9 @@
<t t-set="inline_mode" t-value="true"/>
</t>
</div>
<button t-if="widget.options['display_composer']" type="button" class="btn btn-sm btn-primary mx-3" data-toggle="modal" data-target="#ratingpopupcomposer">
<button t-if="widget.options['display_composer']" type="button"
t-att-class="'btn btn-sm mx-3 ' + widget.options['link_btn_classes'] or 'btn-primary'"
data-toggle="modal" data-target="#ratingpopupcomposer">
<t t-if="widget.options['display_composer']">
<t t-if="widget.options['default_message_id']">
Modify your review
@@ -47,7 +47,8 @@
t-att-data-default_rating_value="default_rating_value"
t-att-data-default_attachment_ids="default_attachment_ids"
t-att-data-force_submit_url="force_submit_url"
t-att-data-disable_composer="disable_composer">
t-att-data-disable_composer="disable_composer"
t-att-data-link_btn_classes="_link_btn_classes">
</div>
</template>
</odoo>
@@ -138,7 +138,6 @@
</div>
<div class="d-flex flex-column justify-content-center h5 flex-grow-1 mb-md-5" t-if="channel.allow_comment">
<t t-call="portal_rating.rating_stars_static_popup_composer">
<t t-set="btn_classes" t-value="'btn-warning'"/>
<t t-set="rating_avg" t-value="rating_avg"/>
<t t-set="rating_total" t-value="rating_count"/>
<t t-set="object" t-value="channel"/>
@@ -151,6 +150,7 @@
<t t-set="default_attachment_ids" t-value="last_message_attachment_ids"/>
<t t-set="force_submit_url" t-value="'/slides/mail/update_comment' if last_message_id else False"/>
<t t-set="disable_composer" t-value="not channel.can_review"/>
<t t-set="_link_btn_classes" t-value="'btn-link text-white'"/>
</t>
</div>
</div>