[IMP] website_sale: layout for all theme and mobile view

bzr revid: chm@openerp.com-20131213161642-e1ltxlidm9apg3l4
This commit is contained in:
Christophe Matthieu 2013-12-13 17:16:42 +01:00
parent fbf71a27c5
commit aca3b51bf3
6 changed files with 272 additions and 325 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 677 B

View File

@ -6,7 +6,7 @@
<button type="button" data-action="save"
class="btn btn-primary">Save</button>
or
<a href="#" data-action="cancel">Discard</a>
<a href="#" data-action="cancel" class="text-danger">Discard</a>
</form>
<ul class="nav navbar-nav pull-right">
</ul>

View File

@ -378,9 +378,14 @@ class Ecommerce(http.Controller):
}
return request.website.render("website_sale.mycart", values)
@website.route(['/shop/add_cart/', '/shop/add_cart/<model("product.product"):product>/'], type='http', auth="public", multilang=True, methods=['POST'])
def add_cart(self, product=None, product_id=None, remove=None, **kw):
self.add_product_to_cart(product_id=int(product_id or product.id))
@website.route(['/shop/add_cart/'], type='http', auth="public", multilang=True, methods=['POST'])
def add_cart(self, product_id, remove=None, **kw):
self.add_product_to_cart(product_id=int(product_id))
return request.redirect("/shop/mycart/")
@website.route(['/shop/add_cart/<model("product.product"):product>/'], type='http', auth="public", multilang=True)
def add_cart_product(self, product=None, product_id=None, remove=None, **kw):
self.add_product_to_cart(product_id=product.id)
return request.redirect("/shop/mycart/")
@website.route(['/shop/change_cart/<model("sale.order.line"):order_line>/'], type='http', auth="public", multilang=True)

View File

@ -4,38 +4,6 @@
border: 1px solid rgba(100, 100, 100, 0.2);
}
.oe_product_description {
background: rgba(255, 255, 255, 0.8);
padding: 5px 0 5px 0;
z-index: 5;
}
.oe_subdescription {
line-height: 1.2;
margin-bottom: 4px;
}
.oe_product_image {
position: absolute;
}
.oe_product_image img {
max-width: 100%;
max-height: 100%;
margin: auto;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 4;
}
.oe_product .oe_product_cart {
position: relative;
width: 100%;
height: 100%;
}
.products_pager {
text-align: center;
}
@ -56,32 +24,62 @@
margin-right: auto;
}
/* ---- Default Styles Description ---- */
/* ---- Default Styles ---- */
.oe_product {
position: relative;
}
.oe_product .oe_product_image {
position: absolute;
left: 15px;
right: 15px;
top: 15px;
bottom: 50px;
bottom: 55px;
text-align: center;
}
.oe_product .oe_product_description {
bottom: 0;
.oe_product .oe_product_image img {
max-width: 100%;
max-height: 100%;
margin: auto;
position: absolute;
left: 15px;
right: 15px;
border-top: 1px solid #dddddd;
max-height: 120px;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 4;
}
.oe_product section {
position: absolute;
left: 0;
right: 0;
bottom: 0;
overflow: hidden;
padding-bottom: 24px;
padding: 0 15px;
max-height: 110px;
min-height: 56px;
border-top: 1px solid rgba(255, 255, 255, 0.2);
background: rgba(100, 100, 100, 0.1);
z-index: 5;
}
.oe_product .product_price {
position: absolute;
right: 15px;
left: 15px;
bottom: 0;
z-index: 6;
background: rgba(255, 255, 255, 0.6);
padding: 5px 0;
position: absolute;
bottom: 0;
}
.oe_product .oe_product_cart {
position: relative;
width: 100%;
height: 100%;
}
.oe_product .oe_subdescription {
font-size: 0.8em;
max-height: 42px;
overflow: hidden;
margin-bottom: 30px;
}
.oe_product .oe_subdescription.oe_shadow {
position: absolute;
opacity: 0.3;
max-height: none;
}
.oe_mycart .input-group-addon {
@ -89,21 +87,6 @@
padding-right: 6px;
}
.oe_shop_top .oe_product_description {
top: 0;
bottom: auto;
border-top-style: none;
}
.oe_shop_top .oe_product_image {
top: 15px;
bottom: 50px;
}
.oe_shop_center .oe_product_description {
text-align: center;
border-top-style: none;
}
/* Products Options */
.oe_product.oe_image_full .oe_product_image {
left: 0;
@ -112,13 +95,34 @@
bottom: 0;
}
/* ---- Grid Style ---- */
.style1 .oe_product .oe_product_image {
/* Ribbon for promotionso on products */
.oe_product.oe_ribbon_promo .ribbon-wrapper {
display: block;
}
.oe_product .ribbon-wrapper {
display: none;
width: 85px;
height: 88px;
z-index: 5;
overflow: hidden;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
right: 0;
}
.oe_product .ribbon {
font: bold 15px Sans-Serif;
color: white;
text-align: center;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
position: relative;
padding: 7px 0;
left: -5px;
top: 15px;
width: 120px;
cursor: default;
}
/* ---- Product Sizes ---- */
@ -173,7 +177,18 @@
}
@media (max-width: 400px) {
#products_grid .oe_product {
height: 200px;
height: 270px;
}
#products_grid .oe_product section {
background: rgba(100, 100, 100, 0.2);
}
#products_grid .oe_product .oe_product_image {
top: 0;
bottom: 65px;
}
#products_grid .oe_product.oe_image_full .oe_product_image {
bottom: 50px;
}
}
@media (min-width: 992px) {
@ -243,37 +258,41 @@
}
}
/* ---- Product list style ---- */
.oe_list_products {
border: none;
border-bottom: 1px solid rgba(100, 100, 100, 0.2);
width: 100%;
min-height: 140px;
@media (min-width: 400px) {
.oe_product.oe_list {
border: none;
border-bottom: 1px solid rgba(100, 100, 100, 0.2);
width: 100%;
min-height: 100px;
position: relative;
padding-bottom: 5px;
}
.oe_product.oe_list .oe_product_image {
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 170px;
}
.oe_product.oe_list section {
position: relative;
border: 0;
top: 0;
bottom: auto;
left: 180px;
background: transparent;
}
}
.oe_list_products .oe_product_image {
position: absolute;
left: 15px;
right: 15px;
top: 0;
bottom: 0;
width: 150px;
}
.oe_list_products .oe_product_description {
bottom: auto;
position: absolute;
left: 180px;
right: 0;
border-top: none;
top: 15px;
max-height: 94px;
}
.oe_list_products .product_price {
left: 180px;
}
.oe_website_sale .row .row .col-md-12 {
float: none;
}
/* product detail */
.product_detail_img {
min-width: 128px;
max-height: 500px;
}
/* ---- Publish managment and options ---- */
#products_grid .css_options {
display: none;
@ -311,47 +330,6 @@
display: block;
}
/* Ribbon for promotionso on products */
.oe_ribbon_promo .ribbon-wrapper {
display: block;
}
.ribbon-wrapper {
display: none;
width: 85px;
height: 88px;
z-index: 5;
overflow: hidden;
position: absolute;
top: 0;
right: 0;
}
.ribbon {
font: bold 15px Sans-Serif;
color: white;
text-align: center;
text-shadow: rgba(0, 0, 0, 0.5) 0px 1px 0px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
position: relative;
padding: 7px 0;
left: -5px;
top: 15px;
width: 120px;
background-color: #aa0000;
background-image: -webkit-gradient(linear, left top, left bottom, from(#880000), to(#aa0000));
background-image: -webkit-linear-gradient(top, #880000, #aa0000);
background-image: -moz-linear-gradient(top, #880000, #aa0000);
background-image: -ms-linear-gradient(top, #880000, #aa0000);
background-image: -o-linear-gradient(top, #880000, #aa0000);
-webkit-box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.3);
box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.3);
}
/* Wizard */
ul.wizard {
padding: 0;
@ -418,9 +396,3 @@ ul.wizard li:first-child {
padding-left: 15px;
border-radius: 4px 0 0 4px;
}
/* product detail */
.product_detail_img {
min-width: 128px;
max-height: 500px;
}

View File

@ -4,34 +4,6 @@
.oe_product
border: 1px solid rgba(100,100,100,0.2)
.oe_product_description
background: rgba(255,255, 255, 0.8)
padding: 5px 0 5px 0
z-index: 5
.oe_subdescription
line-height: 1.2
margin-bottom: 4px
.oe_product_image
position: absolute
img
max-width: 100%
max-height: 100%
margin: auto
position: absolute
top: 0
left: 0
bottom: 0
right: 0
z-index: 4
.oe_product
.oe_product_cart
position: relative
width: 100%
height: 100%
.products_pager
text-align: center
@ -48,53 +20,62 @@
margin-left: auto
margin-right: auto
/* ---- Default Styles Description ---- */
/* ---- Default Styles ---- */
.oe_product
position: relative
.oe_product_image
position: absolute
left: 15px
right: 15px
top: 15px
bottom: 50px
.oe_product_description
bottom: 0
bottom: 55px
text-align: center
img
max-width: 100%
max-height: 100%
margin: auto
position: absolute
top: 0
left: 0
bottom: 0
right: 0
z-index: 4
section
position: absolute
left: 15px
right: 15px
border-top: 1px solid #dddddd
max-height: 120px
left: 0
right: 0
bottom: 0
overflow: hidden
padding-bottom: 24px
padding: 0 15px
max-height: 110px
min-height: 56px
border-top: 1px solid rgba(255,255,255,0.2)
background: rgba(100, 100, 100, 0.1)
z-index: 5
.product_price
position: absolute
right: 15px
left: 15px
bottom: 0
z-index: 6
background: rgba(255,255,255,0.6)
padding: 5px 0
position: absolute
bottom: 0
.oe_product_cart
position: relative
width: 100%
height: 100%
.oe_subdescription
font-size: 0.8em
max-height: 42px
overflow: hidden
margin-bottom: 30px
&.oe_shadow
position: absolute
opacity: .3
max-height: none
.oe_mycart
.input-group-addon
padding-left: 6px
padding-right: 6px
.oe_shop_top /* Option 1 */
.oe_product_description
top: 0
bottom: auto
border-top-style: none
.oe_product_image
top: 15px
bottom: 50px
.oe_shop_center /* Option 2 */
.oe_product_description
text-align: center
border-top-style: none
/* Products Options */
.oe_product.oe_image_full
@ -104,17 +85,41 @@
top: 0
bottom: 0
/* ---- Grid Style ---- */
/* Ribbon for promotionso on products */
.style1
.oe_product .oe_product_image
.oe_product
&.oe_ribbon_promo
.ribbon-wrapper
display: block
.ribbon-wrapper
display: none
width: 85px
height: 88px
z-index: 5
overflow: hidden
position: absolute
left: 0
right: 0
top: 0
bottom: 0
right: 0
.ribbon
font: bold 15px Sans-Serif
color: white
text-align: center
-webkit-transform: rotate(45deg)
-moz-transform: rotate(45deg)
-ms-transform: rotate(45deg)
-o-transform: rotate(45deg)
position: relative
padding: 7px 0
left: -5px
top: 15px
width: 120px
cursor: default
/* ---- Product Sizes ---- */
.col-md-12
.oe-height-1
height: 75px
@ -156,7 +161,17 @@
@media (max-width: 400px)
#products_grid
.oe_product
height: 200px
height: 270px
section
background: rgba(100, 100, 100, 0.2)
.oe_product_image
top: 0
bottom: 65px
#products_grid
.oe_product.oe_image_full
.oe_product_image
bottom: 50px
@media (min-width: 992px)
.col-md-12
@ -207,34 +222,40 @@
height: 760px
/* ---- Product list style ---- */
.oe_list_products
border: none
border-bottom: 1px solid rgba(100, 100, 100, 0.2)
width: 100%
min-height: 140px
.oe_product_image
position: absolute
left: 15px
right: 15px
top: 0
bottom: 0
width: 150px
.oe_product_description
bottom: auto
position: absolute
left: 180px
right: 0
border-top: none
top: 15px
max-height: 94px
.product_price
left: 180px
@media (min-width: 400px)
.oe_product.oe_list
border: none
border-bottom: 1px solid rgba(100, 100, 100, 0.2)
width: 100%
min-height: 100px
position: relative
padding-bottom: 5px
.oe_product_image
top: 0
bottom: 0
left: 0
right: 0
width: 170px
section
position: relative
border: 0
top: 0
bottom: auto
left: 180px
background: transparent
.oe_website_sale .row .row .col-md-12
float: none
/* product detail */
.product_detail_img
min-width: 128px
max-height: 500px
/* ---- Publish managment and options ---- */
#products_grid .css_options
display: none
position: absolute
@ -265,47 +286,6 @@
#products_grid .oe_product_cart:hover > .css_options
display: block
/* Ribbon for promotionso on products */
.oe_ribbon_promo
.ribbon-wrapper
display: block
.ribbon-wrapper
display: none
width: 85px
height: 88px
z-index: 5
overflow: hidden
position: absolute
top: 0
right: 0
.ribbon
font: bold 15px Sans-Serif
color: white
text-align: center
text-shadow: rgba(0,0,0,0.5) 0px 1px 0px
-webkit-transform: rotate(45deg)
-moz-transform: rotate(45deg)
-ms-transform: rotate(45deg)
-o-transform: rotate(45deg)
position: relative
padding: 7px 0
left: -5px
top: 15px
width: 120px
background-color: #a00
background-image: -webkit-gradient(linear, left top, left bottom, from(#800), to(#a00))
background-image: -webkit-linear-gradient(top, #800, #a00)
background-image: -moz-linear-gradient(top, #800, #a00)
background-image: -ms-linear-gradient(top, #800, #a00)
background-image: -o-linear-gradient(top, #800, #a00)
-webkit-box-shadow: 0px 0px 3px rgba(0,0,0,0.3)
-moz-box-shadow: 0px 0px 3px rgba(0,0,0,0.3)
box-shadow: 0px 0px 3px rgba(0,0,0,0.3)
/* Wizard */
@ -365,9 +345,3 @@ ul.wizard li.text-primary .chevron:before
ul.wizard li:first-child
padding-left: 15px
border-radius: 4px 0 0 4px
/* product detail */
.product_detail_img
min-width: 128px
max-height: 500px

View File

@ -50,34 +50,32 @@
</template>
<template id="products_cart" name="Shopping cart">
<div class="ribbon-wrapper">
<div class="ribbon">Promo</div>
</div>
<div class="oe_product_description">
<a t-href="/shop/product/#{ slug(product) }/" t-keep-query="category,search,filters">
<b t-field="product.name"/>
</a>
</div>
<div class="product_price" t-if="product.product_variant_ids">
<b>
<t t-if="product.product_variant_ids[0].lst_price != product.product_variant_ids[0].price">
<del class="text-danger"
t-field="product.product_variant_ids[0].lst_price" t-field-options='{
"widget": "monetary",
"display_currency": "website.pricelist_id.currency_id"
}'/>&amp;nbsp;
</t>
<span t-field="product.product_variant_ids[0].price" t-field-options='{
"widget": "monetary",
"display_currency": "website.pricelist_id.currency_id"
}'/>
</b>
</div>
<div class="oe_product_image text-center">
<a t-href="/shop/product/#{ product.id }/" t-keep-query="category,search,filters">
<span t-field="product.image" t-field-options='{"widget": "image"}'/>
</a>
</div>
<div class="ribbon-wrapper">
<div class="ribbon btn btn-danger">Promo</div>
</div>
<div class="oe_product_image">
<a t-href="/shop/product/#{ product.id }/" t-keep-query="category,search,filters">
<span t-field="product.image" t-field-options='{"widget": "image"}'/>
</a>
</div>
<section>
<h5><strong><a t-href="/shop/product/#{ slug(product) }/" t-keep-query="category,search,filters" t-field="product.name"/></strong></h5>
<div class="product_price" t-if="product.product_variant_ids">
<b>
<t t-if="product.product_variant_ids[0].lst_price != product.product_variant_ids[0].price">
<del class="text-danger"
t-field="product.product_variant_ids[0].lst_price" t-field-options='{
"widget": "monetary",
"display_currency": "website.pricelist_id.currency_id"
}'/>&amp;nbsp;
</t>
<span t-field="product.product_variant_ids[0].price" t-field-options='{
"widget": "monetary",
"display_currency": "website.pricelist_id.currency_id"
}'/>
</b>
</div>
</section>
</template>
<template id="products" name="Products">
@ -101,7 +99,7 @@
<t t-call="website.pager"/>
</div>
</div>
<div class='style_default row'>
<div class='row'>
<div class="hidden" id="products_grid_before"></div>
<div class="col-md-12" id="products_grid">
<table width="100%">
@ -115,7 +113,7 @@
<t t-set="product" t-value="td_product['product']"/>
<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'] }">
t-attf-class="oe_product oe_grid 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'">
@ -190,6 +188,7 @@
<h3>No product found</h3>
<t groups="base.group_website_publisher">
<p>Click on "Content" to define a new product or "Help" for more informations.</p>
<img src="/website/static/src/img/content_here.png"/>
<p>In the backend's product form contains information to simplify the sale process: price, notes in the quotation, accounting data, procurement methods, etc.</p>
</t>
</div>
@ -208,10 +207,9 @@
<!-- Product Description-->
<template id="product_description" inherit_option_id="website_sale.products_cart" name="Product Description">
<xpath expr="//div[@class='oe_product_description']" position="inside">
<p class="text-muted oe_subdescription">
<span t-field="product.description_sale"/>
</p>
<xpath expr="//div[@class='product_price']" position="before">
<div class="text-info oe_subdescription oe_shadow" t-field="product.description_sale"/>
<div class="text-info oe_subdescription" t-field="product.description_sale"/>
</xpath>
</template>
@ -219,7 +217,7 @@
<template id="add_to_basket" inherit_option_id="website_sale.products_cart" name="Add to Cart">
<xpath expr="//div[@class='product_price']" position="inside">
<a t-href="/shop/add_cart/#{ product.product_variant_ids[0].id }/" class="js_add_cart_json">
<a t-href="/shop/add_cart/#{ product.product_variant_ids[0].id }/"><!-- class="js_add_cart_json" -->
<span class="fa fa-shopping-cart"/>
</a>
</xpath>
@ -229,13 +227,11 @@
<template id="list_view" inherit_option_id="website_sale.products" name="List View">
<xpath expr="//div[@id='products_grid']//table" position="replace">
<div class="row">
<t t-foreach="products" t-as="product">
<div class="col-md-12 oe_list_products oe-height-1">
<t t-call="website_sale.products_cart"/>
</div>
</t>
</div>
<t t-foreach="products" t-as="product">
<div class="oe_product oe_list oe_product_cart" t-att-data-publish="product.website_published and 'on' or 'off'">
<t t-call="website_sale.products_cart"/>
</div>
</t>
</xpath>
</template>
@ -406,7 +402,7 @@
</div>
<table class='table table-striped table-condensed' id="mycart_products" t-if="website_sale_order and website_sale_order.order_line">
<colgroup>
<col width="80"/>
<col width="100"/>
<col/>
<col width="100"/>
<col width="120"/>
@ -421,7 +417,7 @@
<tbody>
<tr t-foreach="website_sale_order.order_line" t-as="line">
<td colspan="2" t-if="not line.product_id.product_tmpl_id"></td>
<td t-if="line.product_id.product_tmpl_id">
<td align="center" t-if="line.product_id.product_tmpl_id">
<span t-field="line.product_id.image_small"
t-field-options='{"widget": "image", "class": "img-rounded"}'/>
</td>
@ -526,7 +522,7 @@
</ul>
</xpath>
<xpath expr="//div[@id='products_grid_before']" position="attributes">
<attribute name="class">col-md-3</attribute>
<attribute name="class">col-md-3 hidden-xs</attribute>
</xpath>
<xpath expr="//div[@id='products_grid']" position="attributes">
<attribute name="class">col-md-9</attribute>
@ -572,7 +568,7 @@
</form>
</xpath>
<xpath expr="//div[@id='products_grid_before']" position="attributes">
<attribute name="class">col-md-3</attribute>
<attribute name="class">col-md-3 hidden-xs</attribute>
</xpath>
<xpath expr="//div[@id='products_grid']" position="attributes">
<attribute name="class">col-md-9</attribute>