[IMP] portal: allow better customization of the portal rating composer
Purpose ======= Add a new option on the portal rating composer, "hide_rating_avg" in order to hide the global rating on the button and allow to fully customize the button. Also allow to customize the text style and to add an icon on the button. Add the dependency "portal_chatter.xml" from portal rating on the portal composer Widget. It already has the dependency "portal_chatter.xml" from the simple portal module, but because the second file was not in the dependency, the view was not inherited if we add the widget in a fullscreen view. Task 2322583
This commit is contained in:
@@ -17,6 +17,7 @@ var RatingPopupComposer = publicWidget.Widget.extend({
|
||||
template: 'portal_rating.PopupComposer',
|
||||
xmlDependencies: [
|
||||
'/portal/static/src/xml/portal_chatter.xml',
|
||||
'/portal_rating/static/src/xml/portal_chatter.xml',
|
||||
'/portal_rating/static/src/xml/portal_tools.xml',
|
||||
'/portal_rating/static/src/xml/portal_rating_composer.xml',
|
||||
],
|
||||
|
||||
@@ -7,22 +7,25 @@
|
||||
<t t-name="portal_rating.PopupComposer">
|
||||
<div class="d-flex flex-wrap align-items-center">
|
||||
<div class="text-nowrap">
|
||||
<t t-call="portal_rating.rating_stars_static">
|
||||
<t t-call="portal_rating.rating_stars_static" t-if="!widget.options['hide_rating_avg']">
|
||||
<t t-set="val" t-value="widget.rating_avg || 0"/>
|
||||
<t t-set="inline_mode" t-value="true"/>
|
||||
</t>
|
||||
</div>
|
||||
<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'"
|
||||
t-att-class="'btn ' + 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
|
||||
<i t-if="widget.options['icon']" t-att-class="widget.options['icon']"/>
|
||||
<span t-att-class="widget.options['_text_classes']">
|
||||
<t t-if="widget.options['display_composer']">
|
||||
<t t-if="widget.options['default_message_id']">
|
||||
Modify your review
|
||||
</t>
|
||||
<t t-else="">
|
||||
Write a review
|
||||
</t>
|
||||
</t>
|
||||
<t t-else="">
|
||||
Write a review
|
||||
</t>
|
||||
</t>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -50,7 +50,10 @@
|
||||
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-link_btn_classes="_link_btn_classes">
|
||||
t-att-data-link_btn_classes="_link_btn_classes"
|
||||
t-att-data-icon="icon"
|
||||
t-att-data-text_classes="_text_classes"
|
||||
t-att-data-hide_rating_avg="hide_rating_avg">
|
||||
</div>
|
||||
</template>
|
||||
</odoo>
|
||||
|
||||
@@ -154,7 +154,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 t-set="_link_btn_classes" t-value="'btn-sm btn-link text-white mx-3'"/>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user