[FIX] website_sale: fix product editor and move edit code in website_sale.editor.js
bzr revid: chm@openerp.com-20131121132317-ysa25sdqqx8dg1wo
This commit is contained in:
parent
07819834bb
commit
dc8ef4da30
|
@ -19,4 +19,60 @@
|
|||
}
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
$(document).on('click', '.js_publish_management .js_go_to_top,.js_publish_management .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')});
|
||||
});
|
||||
|
||||
$(document).on('click', '.js_options ul[name="style"] a', function (event) {
|
||||
var $a = $(event.currentTarget);
|
||||
var $li = $a.parent();
|
||||
var $data = $a.parents(".js_options:first");
|
||||
var $product = $a.parents(".oe_product:first");
|
||||
|
||||
$li.parent().removeClass("active");
|
||||
openerp.jsonRpc('/shop/change_styles/', 'call', {'id': $data.data('id'), 'style_id': $a.data("id")})
|
||||
.then(function (result) {
|
||||
$product.toggleClass($a.data("class"));
|
||||
$li.toggleClass("active", result);
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('mouseenter', '#products_grid .js_options ul[name="size"] table', function (event) {
|
||||
$(event.currentTarget).addClass("oe_hover");
|
||||
});
|
||||
$(document).on('mouseleave', '#products_grid .js_options ul[name="size"] table', function (event) {
|
||||
$(event.currentTarget).removeClass("oe_hover");
|
||||
});
|
||||
$(document).on('mouseover', '#products_grid .js_options ul[name="size"] td', function (event) {
|
||||
var $td = $(event.currentTarget);
|
||||
var $table = $td.parents("table:first");
|
||||
var x = $td.index()+1;
|
||||
var y = $td.parent().index()+1;
|
||||
|
||||
var tr = [];
|
||||
for (var yi=0; yi<y; yi++) tr.push("tr:eq("+yi+")");
|
||||
var $select_tr = $table.find(tr.join(","));
|
||||
var td = [];
|
||||
for (var xi=0; xi<x; xi++) td.push("td:eq("+xi+")");
|
||||
var $select_td = $select_tr.find(td.join(","));
|
||||
|
||||
$table.find("td").removeClass("select");
|
||||
$select_td.addClass("select");
|
||||
});
|
||||
$(document).on('click', '#products_grid .js_options ul[name="size"] td', function (event) {
|
||||
var $td = $(event.currentTarget);
|
||||
var $data = $td.parents(".js_options:first");
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
})();
|
||||
|
|
|
@ -77,60 +77,6 @@ $(document).ready(function () {
|
|||
$price.html($price.data("price")+parseFloat($label.find(".badge span").html() || 0));
|
||||
});
|
||||
|
||||
$(document).on('click', '.js_publish_management .js_go_to_top,.js_publish_management .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')});
|
||||
});
|
||||
|
||||
$(document).on('click', '#products_grid .js_options ul[name="style"] a', function (event) {
|
||||
var $a = $(event.currentTarget);
|
||||
var $li = $a.parent();
|
||||
var $data = $a.parents(".js_options:first");
|
||||
var $product = $a.parents(".oe_product:first");
|
||||
|
||||
$li.parent().removeClass("active");
|
||||
openerp.jsonRpc('/shop/change_styles/', 'call', {'id': $data.data('id'), 'style_id': $a.data("id")})
|
||||
.then(function (result) {
|
||||
$product.toggleClass($a.data("class"));
|
||||
$li.toggleClass("active", result);
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('mouseenter', '#products_grid .js_options ul[name="size"] table', function (event) {
|
||||
$(event.currentTarget).addClass("oe_hover");
|
||||
});
|
||||
$(document).on('mouseleave', '#products_grid .js_options ul[name="size"] table', function (event) {
|
||||
$(event.currentTarget).removeClass("oe_hover");
|
||||
});
|
||||
$(document).on('mouseover', '#products_grid .js_options ul[name="size"] td', function (event) {
|
||||
var $td = $(event.currentTarget);
|
||||
var $table = $td.parents("table:first");
|
||||
var x = $td.index()+1;
|
||||
var y = $td.parent().index()+1;
|
||||
|
||||
var tr = [];
|
||||
for (var yi=0; yi<y; yi++) tr.push("tr:eq("+yi+")");
|
||||
var $select_tr = $table.find(tr.join(","));
|
||||
var td = [];
|
||||
for (var xi=0; xi<x; xi++) td.push("td:eq("+xi+")");
|
||||
var $select_td = $select_tr.find(td.join(","));
|
||||
|
||||
$table.find("td").removeClass("select");
|
||||
$select_td.addClass("select");
|
||||
});
|
||||
$(document).on('click', '#products_grid .js_options ul[name="size"] td', function (event) {
|
||||
var $td = $(event.currentTarget);
|
||||
var $data = $td.parents(".js_options:first");
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$(".js_slider").each(function() {
|
||||
var $slide = $(this);
|
||||
|
|
|
@ -14,10 +14,9 @@
|
|||
</a>
|
||||
</li>
|
||||
</xpath>
|
||||
<xpath expr="//head" position="inside">
|
||||
<t t-if="editable">
|
||||
<script type="text/javascript" src="/website_sale/static/src/js/website.tour.shop.js"></script>
|
||||
</t>
|
||||
<xpath expr="//t[@id='editable_scripts_hook']" position="inside">
|
||||
<script type="text/javascript" src="/website_sale/static/src/js/website_sale.editor.js" t-ignore="true"></script>
|
||||
<script type="text/javascript" src="/website_sale/static/src/js/website.tour.shop.js" t-ignore="true"></script>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
@ -118,7 +117,7 @@
|
|||
|
||||
<div class="oe_product_cart" t-att-data-publish="product.website_published and 'on' or 'off'">
|
||||
|
||||
<div class="css_options" t-ignore="true" t-if="is_website_publisher">
|
||||
<div class="css_options" t-ignore="true" t-if="editable">
|
||||
<div t-attf-class="dropdown js_options" t-att-data-id="product.id">
|
||||
<a class="btn btn-default" t-att-id="'dopprod-%s' % product.id" role="button" data-toggle="dropdown">Options <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu" role="menu" t-att-aria-labelledby="'dopprod-%s' % product.id">
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<template id="website_sale_script" inherit_id="website.layout" name="Website Sale script">
|
||||
<xpath expr="//t[@id='editable_scripts_hook']" position="inside">
|
||||
<script type="text/javascript" src="/website_sale/static/src/js/website_sale.editor.js" t-ignore="true"></script>
|
||||
</xpath>
|
||||
</template>
|
||||
</data>
|
||||
<data noupdate="1">
|
||||
|
||||
<record id="menu_shop" model="website.menu">
|
||||
|
|
Loading…
Reference in New Issue