[FIX] website_sale_comparison: bs4 fix, don't display compare box if nothing to compare

This commit is contained in:
Jeremy Kersten
2018-08-29 11:56:27 +02:00
parent 1b7cdbe925
commit f9b7104f7c
2 changed files with 7 additions and 7 deletions
@@ -35,7 +35,7 @@ var ProductComparison = Widget.extend({
self._loadProducts(this.comparelist_product_ids).then(function () {
self._updateContent(self.comparelist_product_ids, true);
if (self.comparelist_product_ids.length) {
$('.o_product_feature_panel').show();
$('.o_product_feature_panel').addClass('d-md-block');
self._updateComparelistView();
}
});
@@ -136,7 +136,7 @@ var ProductComparison = Widget.extend({
*/
_addNewProducts: function (product_id) {
var self = this;
$('.o_product_feature_panel').show();
$('.o_product_feature_panel').addClass('d-md-block');
if (!_.contains(self.comparelist_product_ids, product_id)) {
self.comparelist_product_ids.push(product_id);
if (_.has(self.product_data, product_id)){
@@ -188,14 +188,14 @@ var ProductComparison = Widget.extend({
*/
_updateComparelistView: function () {
this.$('.o_product_circle').text(this.comparelist_product_ids.length);
this.$('.o_comparelist_button').hide();
this.$('.o_comparelist_button').removeClass('d-md-block');
if (_.isEmpty(this.comparelist_product_ids)) {
$('.o_product_feature_panel').hide();
$('.o_product_feature_panel').removeClass('d-md-block');
this._togglePanel();
} else {
this.$('.o_comparelist_products').show();
this.$('.o_comparelist_products').addClass('d-md-block');
if (this.comparelist_product_ids.length >=2) {
this.$('.o_comparelist_button').show();
this.$('.o_comparelist_button').addClass('d-md-block');
this.$('.o_comparelist_button a').attr('href', '/shop/compare/?products='+this.comparelist_product_ids.toString());
}
}
@@ -1,7 +1,7 @@
<templates id="compare_products" xml:space="preserve">
<t t-name="product_comparison_template">
<div class="o_product_feature_panel d-none d-md-block css_editable_mode_hidden" style="display:none">
<div class="o_product_feature_panel d-none css_editable_mode_hidden">
<span class="o_product_panel" id="comparelist">
<span class="o_product_panel_header">
<span class="o_product_icon"><i class="fa fa-exchange" role="img" aria-label="Product" title="Product"></i></span>