<commit_before><?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

    <!-- Layout add nav and footer -->

    <record id="header_ecommerce" model="ir.ui.view">
        <field name="name">header_ecommerce</field>
        <field name="inherit_id" ref="website.header"/>
        <field name="arch" type="xml">
            <data>
                <xpath expr="(//li)[last()]" position="after">
                    <li class="pull-right"><a href="/shop/mycart"><i class="icon-shopping-cart icon-large" style="position: absolute;"></i>&amp;nbsp; &amp;nbsp; &amp;nbsp;  My cart</a></li>
                    <li class="pull-right"><a href="/shop">Shop</a></li>
                </xpath>
           </data>
        </field>
    </record>
    <record id="header_ecommerce" model="ir.ui.view">
        <field name="name">header_ecommerce</field>
        <field name="inherit_id" ref="website.header"/>
        <field name="arch" type="xml">
            <data>
                <xpath expr="(//li)[last()]" position="after">
                    <li class="pull-right"><a href="/shop/mycart"><i class="icon-shopping-cart icon-large" style="position: absolute;"></i>&amp;nbsp; &amp;nbsp; &amp;nbsp;  My cart</a></li>
                    <li class="pull-right"><a href="/shop">Shop</a></li>
                </xpath>
           </data>
        </field>
    </record>

    <record id="product_normal_form_view" model="ir.ui.view">
        <field name="name">product.normal.form.inherit</field>
        <field name="model">product.product</field>
        <field name="inherit_id" ref="stock.view_normal_procurement_locations_form"/>
        <field name="arch" type="xml">
            <group name="sale" position="before">
                <group name="pos" string="Website">
                    <field name="website_published"/>
                </group>
            </group>
        </field>
    </record>

    <!-- Page Shop --> 

    <template id="page">
        <t t-call="website.layout">
            <t t-set="head">
                <script type="text/javascript" src="/website_sale/static/src/js/ecommerce.js"></script>
                <link rel='stylesheet' href='/website_sale/static/src/css/ecommerce.css'/>
                <t t-raw="head"/>
            </t>
            <t t-set="title">Shop - <t t-raw="title">Categories</t></t>
            <div class="container mt48 oe_ecommerce">
                <div class="row">
                    <t t-call='website_sale.categories' />
                    <t t-raw="shop_content" />
                </div>
            </div>
        </t>
    </template>

    <!-- List of categories --> 

    <template id="categories">
        <div class="span4">
            <ul class="nav nav-list">
                <li t-att-class=" '' if current_category else 'active' " class='active'><a href='/shop/'>All Products</a></li>
            <t t-foreach="categories" t-as="category">
                <t t-call="website_sale.categories_recursive"/>
            </t>
            </ul>
        </div>
    </template>

    <template id="categories_recursive">
        <li t-att-class="category.id == current_category and 'active' or ''">
            <a t-att-href="'/shop/category/%%s' %% category.id" t-field="category.name"></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"/>
                </t>
            </ul>
        </li>
    </template>

    <!-- Product list --> 

    <template id="product_pager">
        <div t-if="page_count != 1" t-att-class=" (classname if classname else '') + ' pagination'">
            <ul>
                <li t-att-class=" 'disabled' if page == 1 else '' " ><a t-att-href=" '#' if page == 1 else ('/shop/category/%%s/page/%%s' %% (current_category, max(0,page-1))) ">Prev</a></li>
                <t t-foreach="pages" t-as="p">
                    <li t-att-class=" 'active' if p == page else '' " ><a t-att-href=" '/shop/category/%%s/page/%%s' %% (current_category, p)" t-raw='p'></a></li>
                </t>
                <li t-att-class=" 'disabled' if page == page_count else '' "><a t-att-href=" '#' if page == page_count else ('/shop/category/%%s/page/%%s' %% (current_category, min(page_count,page+1))) ">Next</a></li>
            </ul>
        </div>
    </template>

    <template id="products">
        <t t-call="website_sale.page">
            <t t-set="title">Product</t>
            <t t-set="shop_content">
                <div class='span8 navbar navbar-inverse'>
                    <div class='navbar-inner'>
                        <t t-call="website_sale.product_pager" >
                            <t t-set="classname">pull-left</t>
                        </t>
                        <form action="/shop" method="get" class="navbar-search pull-right">
                            <input type="text" name="search" class="search-query span2" placeholder="Search" t-att-value="search or '' or ''"/>
                        </form>
                    </div>
                </div>
                <div class="span8">
                    <div class='row grid grid-align-top'>
                        <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.product_card"/>
                        </t>
                    </div>
                </div>
                <div class="span8 offset4 text-center">
                    <t t-call="website_sale.product_pager" >
                        <t t-set="classname"></t>
                    </t>
                </div>
            </t><commit_msg>[WIP] ecommerce pagination: fun with qweb<commit_after><?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

    <!-- Layout add nav and footer -->

    <record id="header_ecommerce" model="ir.ui.view">
        <field name="name">header_ecommerce</field>
        <field name="inherit_id" ref="website.header"/>
        <field name="arch" type="xml">
            <data>
                <xpath expr="(//li)[last()]" position="after">
                    <li class="pull-right"><a href="/shop/mycart"><i class="icon-shopping-cart icon-large" style="position: absolute;"></i>&amp;nbsp; &amp;nbsp; &amp;nbsp;  My cart</a></li>
                    <li class="pull-right"><a href="/shop">Shop</a></li>
                </xpath>
           </data>
        </field>
    </record>
    <record id="header_ecommerce" model="ir.ui.view">
        <field name="name">header_ecommerce</field>
        <field name="inherit_id" ref="website.header"/>
        <field name="arch" type="xml">
            <data>
                <xpath expr="(//li)[last()]" position="after">
                    <li class="pull-right"><a href="/shop/mycart"><i class="icon-shopping-cart icon-large" style="position: absolute;"></i>&amp;nbsp; &amp;nbsp; &amp;nbsp;  My cart</a></li>
                    <li class="pull-right"><a href="/shop">Shop</a></li>
                </xpath>
           </data>
        </field>
    </record>

    <record id="product_normal_form_view" model="ir.ui.view">
        <field name="name">product.normal.form.inherit</field>
        <field name="model">product.product</field>
        <field name="inherit_id" ref="stock.view_normal_procurement_locations_form"/>
        <field name="arch" type="xml">
            <group name="sale" position="before">
                <group name="pos" string="Website">
                    <field name="website_published"/>
                </group>
            </group>
        </field>
    </record>

    <!-- Page Shop --> 

    <template id="page">
        <t t-call="website.layout">
            <t t-set="head">
                <script type="text/javascript" src="/website_sale/static/src/js/ecommerce.js"></script>
                <link rel='stylesheet' href='/website_sale/static/src/css/ecommerce.css'/>
                <t t-raw="head"/>
            </t>
            <t t-set="title">Shop - <t t-raw="title">Categories</t></t>
            <div class="container mt48 oe_ecommerce">
                <div class="row">
                    <t t-call='website_sale.categories' />
                    <t t-raw="shop_content" />
                </div>
            </div>
        </t>
    </template>

    <!-- List of categories --> 

    <template id="categories">
        <div class="span4">
            <ul class="nav nav-list">
                <li t-att-class=" '' if current_category else 'active' " class='active'><a href='/shop/'>All Products</a></li>
            <t t-foreach="categories" t-as="category">
                <t t-call="website_sale.categories_recursive"/>
            </t>
            </ul>
        </div>
    </template>

    <template id="categories_recursive">
        <li t-att-class="category.id == current_category and 'active' or ''">
            <a t-att-href="'/shop/category/%%s' %% category.id" t-field="category.name"></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"/>
                </t>
            </ul>
        </li>
    </template>

    <!-- Product list --> 

    <template id="product_pager">
        <t t-set="classname" t-value="classname or ''" />
        <div t-if="page_count != 1" t-att-class="classname + ' pagination'">
            <ul>
                <li t-att-class=" 'disabled' if page == 1 else '' " ><a t-att-href=" '#' if page == 1 else ('/shop/category/%%s/page/%%s' %% (current_category, max(0,page-1))) ">Prev</a></li>
                <t t-foreach="pages" t-as="p">
                    <li t-att-class=" 'active' if p == page else '' " ><a t-att-href=" '/shop/category/%%s/page/%%s' %% (current_category, p)" t-raw='p'></a></li>
                </t>
                <li t-att-class=" 'disabled' if page == page_count else '' "><a t-att-href=" '#' if page == page_count else ('/shop/category/%%s/page/%%s' %% (current_category, min(page_count,page+1))) ">Next</a></li>
            </ul>
        </div>
    </template>

    <template id="products">
        <t t-call="website_sale.page">
            <t t-set="title">Product</t>
            <t t-set="shop_content">
                <div class='span8 navbar navbar-inverse'>
                    <div class='navbar-inner'>
                        <t t-call="website_sale.product_pager" >
                            <t t-set="classname">pull-left</t>
                        </t>
                        <form action="/shop" method="get" class="navbar-search pull-right">
                            <input type="text" name="search" class="search-query span2" placeholder="Search" t-att-value="search or '' or ''"/>
                        </form>
                    </div>
                </div>
                <div class="span8">
                    <div class='row grid grid-align-top'>
                        <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.product_card"/>
                        </t>
                    </div>
                </div>
                <div class="span8 offset4 text-center">
                    <t t-call="website_sale.product_pager" />
                </div>
            </t>
{'fraction_non_alphanumeric': 0.18327067669172933, 'fraction_numerical': 0.003246753246753247, 'mean_word_length': 1.7151472976107631, 'pattern_counts': {'":': 0, '<': 317, '<?xml version=': 2, '>': 317, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4809310', 'n_tokens_mistral': 3665, 'n_tokens_neox': 3455, 'n_words': 661}