[FIX] website_sale: make views editables

bzr revid: chs@openerp.com-20130702204849-haixhwag18xjyr3r
This commit is contained in:
Christophe Simonis 2013-07-02 22:48:49 +02:00
parent 460a190ea8
commit 23c238e7a4
4 changed files with 34 additions and 49 deletions

View File

@ -69,7 +69,7 @@ class Ecommerce(http.Controller):
'categories': category_obj.browse(cr, uid, category_ids),
'products': product_obj.browse(cr, uid, product_ids),
})
html = request.registry.get("ir.ui.view").render(cr, uid, "website_sale.page", values)
html = request.registry.get("ir.ui.view").render(cr, uid, "website_sale.products", values)
return html
@http.route(['/shop/product/<product_id>'], type='http', auth="db")

View File

@ -5,11 +5,10 @@
.oe_ecommerce input {
border: 1px solid #dddddd;
font-size: 13px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-o-border-radius: 3px;
-moz-border-radius: 3px;
-ms-border-radius: 3px;
-khtml-border-radius: 3px;
-o-border-radius: 3px;
border-radius: 3px;
padding: 5px;
padding-left: 7px;
@ -22,9 +21,8 @@
padding: 10px;
}
.oe_ecommerce .oe_product {
-moz-box-shadow: 0 0 3px 1px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0 0 3px 1px rgba(0, 0, 0, 0.1);
-o-box-shadow: 0 0 3px 1px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0 0 3px 1px rgba(0, 0, 0, 0.1);
box-shadow: 0 0 3px 1px rgba(0, 0, 0, 0.1);
text-align: center;
vertical-align: top;
@ -36,11 +34,10 @@
margin-top: 0;
margin-bottom: 10px;
margin-right: 10px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-o-border-radius: 5px;
-moz-border-radius: 5px;
-ms-border-radius: 5px;
-khtml-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
border: 1px solid rgba(0, 0, 0, 0.1);
}
@ -54,17 +51,8 @@
margin: 10px;
}
.oe_ecommerce .oe_product .oe_ecommerce_price span {
color: #9e9a99;
font-weight: bold;
padding: 10px 15px;
margin: 5px;
background: rgba(0, 0, 0, 0.2);
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-o-border-radius: 3px;
-ms-border-radius: 3px;
-khtml-border-radius: 3px;
border-radius: 3px;
}
.oe_ecommerce .oe_product .oe_ecommerce_description {
display: none;
@ -98,7 +86,6 @@
background: -webkit-linear-gradient(#aaaaaa, #999999);
background: -moz-linear-gradient(#aaaaaa, #999999);
background: -o-linear-gradient(#aaaaaa, #999999);
background: -ms-linear-gradient(#aaaaaa, #999999);
background: linear-gradient(#aaaaaa, #999999);
}
.oe_ecommerce .oe_product .oe_button_cart button:last-child {
@ -106,7 +93,6 @@
background: -webkit-linear-gradient(#0088cc, #0076b1);
background: -moz-linear-gradient(#0088cc, #0076b1);
background: -o-linear-gradient(#0088cc, #0076b1);
background: -ms-linear-gradient(#0088cc, #0076b1);
background: linear-gradient(#0088cc, #0076b1);
}
.oe_ecommerce .oe_product .oe_button_cart button:last-child.btn-success {
@ -114,6 +100,5 @@
background: -webkit-linear-gradient(#51a351, #418541);
background: -moz-linear-gradient(#51a351, #418541);
background: -o-linear-gradient(#51a351, #418541);
background: -ms-linear-gradient(#51a351, #418541);
background: linear-gradient(#51a351, #418541);
}

View File

@ -23,12 +23,8 @@
font-size: 25px
margin: 10px
span
color: #9e9a99
font-weight: bold
padding: 10px 15px
margin: 5px
background: rgba(0,0,0,.2)
+border-radius(3px)
.oe_ecommerce_description
display: none
h4

View File

@ -38,10 +38,6 @@
</div>
<div class="span8">
<t t-raw="shop_content">
<t t-foreach="products" t-as="product">
<t t-set="quantity" t-value="([int(line.product_uom_qty) for line in (order.order_line or []) if line.product_id.id == product.id] + [0])[0]"/>
<t t-call="website_sale.products"/>
</t>
</t>
</div>
</div>
@ -57,7 +53,7 @@
<field name="type">qweb</field>
<field name="arch" type="xml">
<li t-att-class="category.id == current_category and 'active' or ''">
<a t-att-href="'/shop/category/%%s' %% category.id"><t t-esc="category.name"/></a>
<a t-att-href="'/shop/category/%%s' %% category.id"><span t-record="category" t-field="name"><t t-esc="category.name"/></span></a>
<ul t-if="category.child_id" class="nav nav-list">
<t t-foreach="category.child_id" t-as="category">
<t t-call="website_sale.categories_recursive"/>
@ -73,21 +69,29 @@
<field name="name">products</field>
<field name="type">qweb</field>
<field name="arch" type="xml">
<div class="media oe_product">
<a t-att-href="'/shop/product/%%s' %% product.id"><h4 class="media-heading"><t t-esc="product.name"/></h4></a>
<a t-att-href="'/shop/product/%%s' %% product.id"><img class="media-object" t-att-src="'data:image/png;base64,' + product.image"/></a>
<div class="oe_ecommerce_description"><t t-esc="product.description_sale"/></div>
<div class="oe_ecommerce_price"><span><t t-esc="product.list_price"/></span></div>
<div class="media-body">
<div class="oe_button_cart">
<button t-att-class="'btn btn-inverse %%s' %% (not quantity and 'oe_hidden' or '')" t-att-data-id="product.id">Remove one</button>
<button t-att-class="'btn %%s' %% (quantity and 'btn-success' or 'btn-primary')" t-att-data-id="product.id">
<span class="oe_txt_empty">Add to cart</span>
<span class="oe_txt">(<span class="oe_quantity"><t t-esc="quantity"/></span>)</span>
</button>
</div>
</div>
</div>
<t t-call="website_sale.page">
<t t-set="title">Product</t>
<t t-set="shop_content">
<t t-foreach="products" t-as="product">
<t t-set="quantity" t-value="([int(line.product_uom_qty) for line in (order.order_line or []) if line.product_id.id == product.id] + [0])[0]"/>
<div class="media oe_product">
<a t-att-href="'/shop/product/%%s' %% product.id"><h4 class="media-heading"><span t-record="product" t-field="name"><t t-esc="product.name"/></span></h4></a>
<a t-att-href="'/shop/product/%%s' %% product.id"><img class="media-object" t-att-src="'data:image/png;base64,' + product.image"/></a>
<div class="oe_ecommerce_description" t-record="product" t-field="description_sale"><t t-esc="product.description_sale"/></div>
<div class="oe_ecommerce_price"><span><span t-record="product" t-field="list_price"><t t-esc="product.list_price"/></span></span></div>
<div class="media-body">
<div class="oe_button_cart">
<button t-att-class="'btn btn-inverse %%s' %% (not quantity and 'oe_hidden' or '')" t-att-data-id="product.id">Remove one</button>
<button t-att-class="'btn %%s' %% (quantity and 'btn-success' or 'btn-primary')" t-att-data-id="product.id">
<span class="oe_txt_empty">Add to cart</span>
<span class="oe_txt">(<span class="oe_quantity"><t t-esc="quantity"/></span>)</span>
</button>
</div>
</div>
</div>
</t>
</t>
</t>
</field>
</record>
@ -101,10 +105,10 @@
<t t-set="title">Product</t>
<t t-set="shop_content">
<div clas="oe_commerce_product_display">
<h1><t t-esc="product.name"/></h1>
<img att-src="'data:image/png;base64,' + product.image"/>
<t t-esc="product.description_sale"/>
<div class="oe_ecommerce_price"><t t-esc="product.list_price"/></div>
<h1><span t-record="product" t-field="name"><t t-esc="product.name"/></span></h1>
<img class="media-object" t-att-src="'data:image/png;base64,' + product.image"/>
<div t-record="product" t-field="description_sale"><t t-esc="product.description_sale"/></div>
<div class="oe_ecommerce_price" t-record="product" t-field="list_price"><t t-esc="product.list_price"/></div>
</div>
</t>
</t>