[IMP] Improved code to make small way to change to list view rather than writing the whole product template code twice.

bzr revid: psa@tinyerp.com-20130924064617-40ruht7l15c08p7y
This commit is contained in:
Paramjit Singh Sahota
2013-09-24 12:16:17 +05:30
parent c931f60bd3
commit 8fc3877646
3 changed files with 27 additions and 57 deletions
@@ -1,6 +1,6 @@
@charset "utf-8";
/* ---- Default Styles Description ---- */
.oe_product_image {
.oe_product .oe_product_image {
position: absolute;
left: 15px;
right: 15px;
@@ -91,18 +91,18 @@
max-width: 100%;
max-height: 140px;
}
.oe_products .oe_product_list_image img {
.oe_products .oe_product_image img {
width: 150px;
height: 140px;
}
.oe_product_list_image {
.oe_products .oe_product_image {
left: 15px;
right: 15px;
top: 15px;
bottom: 50px;
width: 200px;
}
.oe_product_list_description {
.oe_products .oe_product_description {
bottom: 0;
position: absolute;
left: 240px;
@@ -1,13 +1,13 @@
@charset "utf-8"
/* ---- Default Styles Description ---- */
.oe_product_image
position: absolute
left: 15px
right: 15px
top: 15px
bottom: 50px
.oe_product
.oe_product_image
position: absolute
left: 15px
right: 15px
top: 15px
bottom: 50px
.oe_product_description
bottom: 0
@@ -93,15 +93,15 @@
img
width: 150px
height: 140px
.oe_product_list_image
left: 15px
right: 15px
top: 15px
bottom: 50px
width: 200px
.oe_product_list_description
bottom: 0
position: absolute
left: 240px
right: 240px
border-top: 1px solid #dddddd
.oe_product_image
left: 15px
right: 15px
top: 15px
bottom: 50px
width: 200px
.oe_product_description
bottom: 0
position: absolute
left: 240px
right: 240px
border-top: 1px solid #dddddd
+4 -34
View File
@@ -111,7 +111,7 @@
<div class='row style_default'>
<div class="col-md-12" id="products_grid">
<t t-foreach="products" t-as="product">
<div t-attf-class="col-md-#{ product.website_sizex } oe_product oe-height-#{ product.website_sizey } #{ product.website_product_class}" t-att-data-publish="product.website_published" data-snippet-id="colmd">
<div t-attf-class="col-md-#{ product.website_sizex } oe_product oe-height-#{ product.website_sizey } #{ product.website_product_class}" t-att-data-publish="product.website_published" data-snippet-id="colmd" id="products_layout">
<div class="oe_product_description">
<a t-attf-href="/shop/product/#{ product.id }/?#{ search and ('search=%s' % search) or ''}#{ category_id and ('&amp;category_id=%s' % category_id) or ''}">
@@ -176,40 +176,10 @@
<!-- List view of products -->
<template id="list_view" inherit_option_id="website_sale.products" name="List View">
<xpath expr="//div[@id='products_grid']" position="replace">
<div class="col-md-12">
<t t-foreach="products" t-as="product">
<div class="col-md-12 oe_products oe-height-1}" t-att-data-publish="product.website_published" data-snippet-id="colmd">
<div class="oe_product_list_image .col-md-3">
<a t-attf-href="/shop/product/#{ product.id }/?#{ search and ('search=%s' % search) or ''}#{ category_id and ('&amp;category_id=%s' % category_id) or ''}">
<img class="img" t-att-src="product.img('image')"/>
</a>
</div>
<div class="oe_product_list_description .col-md-offset-3">
<a t-attf-href="/shop/product/#{ product.id }/?#{ search and ('search=%s' % search) or ''}#{ category_id and ('&amp;category_id=%s' % category_id) or ''}">
<b t-field="product.name"/>
</a>
<!-- This should be an option -->
<div t-if="product.description_sale" class="text-muted oe_subdescription">
<div id="product_description" t-att-data-name="product.id"/>
</div>
<div>
<b>
<t t-if="product.product_variant_ids[0].lst_price != product.product_variant_ids[0].price">
<span class="text-danger" style="text-decoration: line-through;">
<t t-esc="product.product_variant_ids[0].lst_price" /> €
</span>&amp;nbsp;
</t>
<t t-esc="product.product_variant_ids[0].price" /> €
</b>
<span id="add_to_cart" t-att-data-name="product.id"/>
</div>
</div>
</div>
</t>
</div>
<xpath expr="//div[@id='products_layout']" position="attributes">
<attribute name="class">col-md-12 oe_products oe-height-1</attribute>
</xpath>
</template>