From c952e1fc55e6b2dfae948a92f191fba9537519d5 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Tue, 27 Sep 2016 12:09:20 +0200 Subject: [PATCH] [FIX] website_sale: fix shop list view publish buttons Publish buttons appeared in list view item in /shop with commit 5a5dd1e100bb2e5bc2a6e215a963322bbfbe98b1. They however never worked for some reasons: * The publish buttons were unclickable as the around style was badly implemented: the section title was over the publish button * Even if it was clickable, the publish button handler had no prevent default, thus it submitted the form it is in -> crash when no cart button or added to cart on click on publish button if there was a cart button... Note: the style should be reviewed in next versions, this commit, as a 9.0 fix, fixes the style with the minimum code and so that it does not break any theme. --- addons/website/static/src/js/website.js | 5 +++-- addons/website_sale/static/src/css/website_sale.css | 6 ++++-- addons/website_sale/static/src/css/website_sale.sass | 6 ++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/addons/website/static/src/js/website.js b/addons/website/static/src/js/website.js index 7c2ad6cc48c..4e5b805fa8c 100644 --- a/addons/website/static/src/js/website.js +++ b/addons/website/static/src/js/website.js @@ -186,9 +186,10 @@ base.ready().then(function () { */ /* ----- PUBLISHING STUFF ---- */ - $(document).on('click', '.js_publish_management .js_publish_btn', function () { + $(document).on('click', '.js_publish_management .js_publish_btn', function (e) { + e.preventDefault(); + var $data = $(this).parents(".js_publish_management:first"); - var self=this; ajax.jsonRpc($data.data('controller') || '/website/publish', 'call', {'id': +$data.data('id'), 'object': $data.data('object')}) .then(function (result) { $data.toggleClass("css_unpublished css_published"); diff --git a/addons/website_sale/static/src/css/website_sale.css b/addons/website_sale/static/src/css/website_sale.css index 1a6a148f6fa..22983ab9c85 100644 --- a/addons/website_sale/static/src/css/website_sale.css +++ b/addons/website_sale/static/src/css/website_sale.css @@ -359,6 +359,7 @@ min-height: 100px; position: relative; padding-bottom: 5px; + padding-left: 180px; } .oe_product.oe_list .oe_product_image { top: 0; @@ -370,9 +371,10 @@ .oe_product.oe_list section { position: relative; border: 0; - top: 0; + top: auto; bottom: auto; - left: 180px; + left: auto; + right: auto; background: transparent; } } diff --git a/addons/website_sale/static/src/css/website_sale.sass b/addons/website_sale/static/src/css/website_sale.sass index f8179bd6bc0..009657b2bcf 100644 --- a/addons/website_sale/static/src/css/website_sale.sass +++ b/addons/website_sale/static/src/css/website_sale.sass @@ -306,6 +306,7 @@ min-height: 100px position: relative padding-bottom: 5px + padding-left: 180px .oe_product_image top: 0 bottom: 0 @@ -315,9 +316,10 @@ section position: relative border: 0 - top: 0 + top: auto bottom: auto - left: 180px + left: auto + right: auto background: transparent .oe_website_sale .row .row .col-md-12