[IMP] website_rating: improve popup / composer rating display

This newly introduced widget for rating [1] is very cool. This commit
simple improves a bit the display and have the stars + review button
displayed as a small one liner to take less place when displayed.

This commit is linked to task ID 1936153 and PR #30770.

[1] See https://github.com/odoo/odoo/commit/4cb228d823e0346e6052091d397249b8e39d576b
This commit is contained in:
Thibault Delavallée
2019-02-15 09:57:46 +00:00
parent d233ac239d
commit cab98785e9
2 changed files with 24 additions and 12 deletions
@@ -44,8 +44,17 @@
It can alse be used to modify a message
-->
<t t-name="website_rating.PopupComposer">
<div>
<button t-if="widget.options['display_composer']" type="button" class="btn btn-primary" data-toggle="modal" data-target="#ratingpopupcomposer">
<div class="row align-items-center">
<div class="col">
<t t-call="website_rating.rating_stars_static">
<t t-set="val" t-value="widget.rating_avg || 0"/>
<t t-set="inline_mode" t-value="true"/>
</t>
<t t-if="widget.rating_total">
<small class="font-weight-bold">(<t t-esc="widget.rating_total"/> ratings)</small>
</t>
</div>
<button t-if="widget.options['display_composer']" type="button" class="btn btn-primary col" data-toggle="modal" data-target="#ratingpopupcomposer">
<t t-if="widget.options['display_composer']">
<t t-if="widget.options['default_message_id']">
Modify your review
@@ -55,15 +64,6 @@
</t>
</t>
</button>
<div>
<t t-call="website_rating.rating_stars_static">
<t t-set="val" t-value="widget.rating_avg || 0"/>
<t t-set="inline_mode" t-value="true"/>
</t>
<t t-if="widget.rating_total">
<t t-esc="widget.rating_avg"/> (<t t-esc="widget.rating_total"/>)
</t>
</div>
</div>
<div t-if="widget.options['display_composer']" class="modal fade" id="ratingpopupcomposer" tabindex="-1" role="dialog" aria-labelledby="ratingpopupcomposerlabel" aria-hidden="true">
@@ -49,7 +49,19 @@
the message will be posted with the identity of the partner_id of the object
-->
<template id="rating_stars_static_popup_composer" name="Rating: rating composer in popup">
<div class="row d-print-none o_rating_popup_composer o_not_editable p-0" t-att-data-rating-avg="rating_avg or 0.0" t-att-data-rating-total="rating_total or 0.0" t-att-data-token="token" t-att-data-hash="hash" t-att-data-pid="pid" t-att-data-res_model="object._name" t-att-data-res_id="object.id" t-att-data-partner_id="request.env.user.partner_id.id" t-att-data-default_message="default_message" t-att-data-default_message_id="default_message_id" t-att-data-default_rating_value="default_rating_value" t-att-data-force_submit_url="force_submit_url">
<div class="d-print-none o_rating_popup_composer o_not_editable p-0"
t-att-data-rating-avg="rating_avg or 0.0"
t-att-data-rating-total="rating_total or 0.0"
t-att-data-token="token"
t-att-data-hash="hash"
t-att-data-pid="pid"
t-att-data-res_model="object._name"
t-att-data-res_id="object.id"
t-att-data-partner_id="request.env.user.partner_id.id"
t-att-data-default_message="default_message"
t-att-data-default_message_id="default_message_id"
t-att-data-default_rating_value="default_rating_value"
t-att-data-force_submit_url="force_submit_url">
</div>
</template>