From 796b8bf362c1de159ec3a274d8de1fc26de48323 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 12 Dec 2013 12:47:31 +0100 Subject: [PATCH] [FIX] website_sale: layout; add push to top in grid bzr revid: chm@openerp.com-20131212114731-9ivgwupic064o3x0 --- addons/website_sale/controllers/main.py | 4 ++-- .../static/src/js/website_sale.editor.js | 16 ++++++++------- addons/website_sale/views/website_sale.xml | 20 +++++++++---------- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 0ea18f3ac2a..adb4d03259b 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -98,12 +98,12 @@ class table_compute(object): for col in range(len(rows)): cols = rows[col].items() cols.sort() - rows[col] = filter(bool, map(lambda x: x[1], cols)) + rows[col] = map(lambda x: x[1], cols) return filter(bool, rows) class Ecommerce(http.Controller): - _order = 'website_sequence desc, website_published desc' + _order = 'website_published desc, website_sequence desc' def get_attribute_ids(self): attributes_obj = request.registry.get('product.attribute') diff --git a/addons/website_sale/static/src/js/website_sale.editor.js b/addons/website_sale/static/src/js/website_sale.editor.js index 87be89b59c6..c5bd958258d 100644 --- a/addons/website_sale/static/src/js/website_sale.editor.js +++ b/addons/website_sale/static/src/js/website_sale.editor.js @@ -20,11 +20,16 @@ }), }); + function reload_enable_editor() { + var search = location.search.replace(/\?|$/, '?enable_editor=1&'); + location.href = location.href.replace(/(\?|#|$).*/, search + location.hash); + } - $(document).on('click', '.js_publish_management .js_go_to_top,.js_publish_management .js_go_to_bottom', function (event) { + $(document).on('click', '.js_options .js_go_to_top,.js_options .js_go_to_bottom', function (event) { var $a = $(event.currentTarget); - var $data = $a.parents(".js_publish_management:first"); - openerp.jsonRpc('/shop/change_sequence/', 'call', {'id': $data.data('id'), 'top': $a.hasClass('js_go_to_top')}); + var $data = $a.parents(".js_options:first"); + openerp.jsonRpc('/shop/change_sequence/', 'call', {'id': $data.data('id'), 'top': $a.hasClass('js_go_to_top')}) + .then(reload_enable_editor); }); $(document).on('click', '.js_options ul[name="style"] a', function (event) { @@ -69,10 +74,7 @@ var x = $td.index()+1; var y = $td.parent().index()+1; openerp.jsonRpc('/shop/change_size/', 'call', {'id': $data.data('id'), 'x': x, 'y': y}) - .then(function () { - var search = location.search.replace(/\?|$/, '?enable_editor=1&'); - location.href = location.href.replace(/(\?|#).*/, search + location.hash); - }); + .then(reload_enable_editor); }); })(); diff --git a/addons/website_sale/views/website_sale.xml b/addons/website_sale/views/website_sale.xml index 8a0bbd4ac47..c7cef5abedf 100644 --- a/addons/website_sale/views/website_sale.xml +++ b/addons/website_sale/views/website_sale.xml @@ -106,15 +106,15 @@
- + -
@@ -164,6 +164,13 @@ +
@@ -275,13 +282,6 @@ -