[FIX] website_sale: layout; add push to top in grid

bzr revid: chm@openerp.com-20131212114731-9ivgwupic064o3x0
This commit is contained in:
Christophe Matthieu 2013-12-12 12:47:31 +01:00
parent 745a559c77
commit 796b8bf362
3 changed files with 21 additions and 19 deletions

View File

@ -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')

View File

@ -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);
});
})();

View File

@ -106,15 +106,15 @@
<div class="col-md-12" id="products_grid">
<table width="100%">
<tbody>
<tr>
<tr t-ignore="true">
<td t-foreach="range(0,rows)" t-as="row" t-attf-width="#{100/rows}%"></td>
</tr>
<tr t-foreach="bins" t-as="tr_product">
<t t-foreach="tr_product" t-as="td_product">
<t t-if="td_product">
<t t-set="product" t-value="td_product['product']"/>
<td t-att-colspan="td_product['x']"
t-att-rowspan="td_product['y']"
<td t-att-colspan="td_product['x'] != 1 and td_product['x']"
t-att-rowspan="td_product['y'] != 1 and td_product['y']"
t-attf-class="oe_product oe-height-#{td_product['y']*2} #{ td_product['class'] }">
<div class="oe_product_cart" t-att-data-publish="product.website_published and 'on' or 'off'">
@ -164,6 +164,13 @@
</t>
</ul>
</li>
<li class='dropdown-submenu'>
<a tabindex="-1" href="#">Promote</a>
<ul class="dropdown-menu" name="sequence">
<li><a href="#" class="js_go_to_top">Push to top</a></li>
<li><a href="#" class="js_go_to_bottom">Push to bottom</a></li>
</ul>
</li>
</ul>
</div>
</div>
@ -275,13 +282,6 @@
<t t-call="website.publish_management">
<t t-set="object" t-value="product"/>
<t t-set="publish_edit" t-value="True"/>
<li class='dropdown-submenu'>
<a tabindex="-1" href="#">Promote</a>
<ul class="dropdown-menu" name="sequence">
<li><a href="#" class="js_go_to_top">Push to top</a></li>
<li><a href="#" class="js_go_to_bottom">Push to bottom</a></li>
</ul>
</li>
</t>
</div>
</div>