[MERGE] from website-al

bzr revid: chm@openerp.com-20130805083851-i7tiy5ym0ri144er
This commit is contained in:
Christophe Matthieu 2013-08-05 10:38:51 +02:00
commit 8c4e722929
5 changed files with 58 additions and 54 deletions

View File

@ -1,4 +1,17 @@
openerp.website = function(instance) {
instance.web.ActionManager.include({
// Temporary fix until un-webclientization of the editorbar
ir_actions_client: function (action) {
if (instance.web.client_actions.get_object(action.tag)) {
return this._super.apply(this, arguments);
} else {
console.warn("Action '%s' not found in registry", action.tag);
return $.when();
}
}
});
var _lt = instance.web._lt;
var QWeb = instance.web.qweb;
instance.website.EditorBar = instance.web.Widget.extend({

View File

@ -4,18 +4,16 @@
<openerp>
<data>
<template id="header">
<div class="container">
<div class="row">
<a href='/page/website.homepage' class='brand'>
<em>Open</em><b>ERP</b>
<!--<img t-att-alt="res_company.name" src='/web/binary/company_logo'/></a>-->
</a>
<ul class="nav pull-right">
<li class='pull-right'><a href="/admin">Sign in</a></li>
<li class='pull-right'><a href="/page/website.contactus">Contact us</a></li>
</ul>
</div>
</div>
<div class="container">
<a href='/page/website.homepage' class='brand'>
<em>Open</em><b>ERP</b>
<!--<img t-att-alt="res_company.name" src='/web/binary/company_logo'/></a>-->
</a>
<ul class="nav pull-right">
<li class='pull-right'><a href="/admin">Sign in</a></li>
<li class='pull-right'><a href="/page/website.contactus">Contact us</a></li>
</ul>
</div>
</template>
<template id="footer">
@ -38,12 +36,12 @@
</ul>
</div>
<div class="span4" name="about_us">
<h5 t-record="res_company" t-field="name">Company name</h5>
<h5 t-field="res_company.name">Company name</h5>
<ul class='unstyled'>
<li><a href="/page/website.contactus">Contact us</a></li>
<li><a href="/page/website.news">News</a></li>
<li><a href="/page/website.contactus">About us</a></li>
<li><a href='#'>&amp;#x2706; <span t-record="res_company" t-field="phone"/></a></li>
<li><a href='#'>&amp;#x2706; <span t-field="res_company.phone"/></a></li>
</ul>
</div>
</div>
@ -75,23 +73,19 @@
<link rel='stylesheet' href='/website/static/lib/bootstrap/css/bootstrap-responsive.css'/>
</head>
<body>
<div id='wrap'>
<header class='navbar navbar-fixed-top'>
<div class='navbar-inner'>
<t t-call="website.header"/>
</div>
</header>
<div t-raw="0">
<div class="container">
<div class="row">
<h1>I'm an empty page, please edit me...</h1>
</div>
</div>
<header class='navbar navbar-fixed-top'>
<div class='navbar-inner'>
<t t-call="website.header"/>
</div>
</header>
<div t-raw="0" id="wrap">
<div class="container">
<h1>Main Layout</h1>
</div>
</div>
<footer>
<t t-call="website.footer"/>
<p class="text-center">&amp;copy; <span t-record="res_company" t-field="name">Company name</span>.</p>
<p class="text-center">&amp;copy; <span t-field="res_company.name">Company name</span>.</p>
</footer>
<div class='oe_snippet_editor' style="display: none;">
@ -353,9 +347,7 @@
<t t-call="website.layout">
<t t-set="title">Contact us - <t t-esc="res_company.name"/></t>
<div class="container">
<div class="row">
<h2>Contact us</h2>
</div>
<h2>Contact us</h2>
<div class="row">
<div class="span8">
<p>
@ -363,19 +355,19 @@
</p><p>
We'll do our best to get back to you as soon as possible.
</p>
<div class="text-center oe_mt32" name="mail_button">
<div class="text-center mt64" name="mail_button">
<a t-att-href="'mailto:'+res_company.email" class="btn btn-primary">Send us an email</a>
</div>
</div>
<div class="span4">
<address>
<strong t-record="res_company" t-field="name">Name</strong><br/>
<span t-record="res_company" t-field="street"/><br/>
<span t-record="res_company" t-field="city"/>, <span t-record="res_company" t-field="zip"/><br/>
<span t-record="res_company" t-field="country_id"> </span><br/>
<strong t-field="res_company.name">Name</strong><br/>
<span t-field="res_company.street"/><br/>
<span t-field="res_company.city"/>, <span t-field="res_company.zip"/><br/>
<span t-field="res_company.country_id"> </span><br/>
<br/>
<span>&amp;#x2706; <span t-record="res_company" t-field="phone"><t t-esc="res_company.phone"/></span></span><br/>
<i class="icon-envelope"></i> <t t-esc="res_company.email"/>
<span>&amp;#x2706; <span t-field="res_company.phone"></span></span><br/>
<i class="icon-envelope"></i> <span t-field="res_company.email"></span>
</address>
<img class="thumbnail" t-att-src="google_map_url"/>
</div>

View File

@ -20,8 +20,9 @@ http.auth_methods['public'] = auth_method_public
class website(object):
def render(self, template, add_values={}):
script = "\n".join(['<script type="text/javascript" src="%s"></script>' % i for i in main.manifest_list('js', db=request.db)])
css = "\n".join('<link rel="stylesheet" href="%s">' % i for i in main.manifest_list('css', db=request.db))
debug = 'debug' in request.params
script = "\n".join(['<script type="text/javascript" src="%s"></script>' % i for i in main.manifest_list('js', db=request.db, debug=debug)])
css = "\n".join('<link rel="stylesheet" href="%s">' % i for i in main.manifest_list('css', db=request.db, debug=debug))
_values = {
'editable': request.uid != request.public_uid,
'request': request,
@ -35,4 +36,4 @@ class website(object):
}
_values.update(add_values)
return request.registry.get("ir.ui.view").render(request.cr, request.uid, template, _values)
website = website()
website = website()

View File

@ -73,8 +73,8 @@
<span t-att-class="'label label-success js_unpublish %%s' %% (not blog_id.website_published and 'hidden' or '')">Click to Unpublish</span>
<span t-att-class="'label label-important js_publish %%s' %% (blog_id.website_published and 'hidden' or '')">Click to Publish</span>
</a>
<h3 t-record="blog_id" t-field="subject"></h3>
<div t-record="blog_id" t-field="body"></div>
<h3 t-field="blog_id.subject"></h3>
<div t-field="blog_id.body"></div>
<small class="pull-right muted text-right">
<div><t t-esc="blog_id.read(['author_id'])[0]['author_id'][1]"/></div>
<div><t t-esc="blog_id.date"/></div>
@ -113,9 +113,9 @@
<span t-att-class="'label label-success js_unpublish %%s' %% (not blog.website_published and 'hidden' or '')">Click to Unpublish</span>
<span t-att-class="'label label-important js_publish %%s' %% (blog.website_published and 'hidden' or '')">Click to Publish</span>
</a>
<h4 class="media-heading" ><a t-att-href="'/blog/%%s/%%s' %% (blog.res_id, blog.id)" t-record="blog" t-field="subject"></a></h4>
<h4 class="media-heading" ><a t-att-href="'/blog/%%s/%%s' %% (blog.res_id, blog.id)" t-field="blog.subject"></a></h4>
<div class="media">
<div t-record="blog" t-field="body"></div>
<div t-field="blog.body"></div>
<small class="pull-right muted text-right">
<a t-att-href="'/blog/%%s/%%s' %% (blog.res_id, blog.id)">Read more </a>
<div><t t-esc="blog.read(['author_id'])[0]['author_id'][1]"/></div>

View File

@ -74,7 +74,7 @@
<template id="categories_recursive">
<li t-att-class="category.id == current_category and 'active' or ''">
<a t-att-href="'/shop/category/%%s' %% category.id"><span t-record="category" t-field="name"><t t-esc="category.name"/></span></a>
<a t-att-href="'/shop/category/%%s' %% category.id"><span t-field="category.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"/>
@ -107,13 +107,11 @@
<template id="product_card">
<div class="media oe_product span3">
<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 class="pull-left" t-att-href="'/shop/product/%%s' %% product.id">
<img class="media-object" t-att-src="'data:image/png;base64,' + product.image"/>
</a>
<a t-att-href="'/shop/product/%%s' %% product.id"><h4 class="media-heading"><span t-field="product.name"><t t-esc="product.name"/></span></h4></a>
<a class="pull-left" t-att-href="'/shop/product/%%s' %% product.id"><img class="media-object" t-att-src="'data:image/png;base64,' + product.image"/></a>
<div class="media-body">
<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="oe_ecommerce_description" t-field="product.description_sale"><t t-esc="product.description_sale"/></div>
<div class="oe_ecommerce_price"><span><span t-field="product.list_price"><t t-esc="product.list_price"/></span></span></div>
<div class="oe_button_cart">
<div class="alert mb0" t-if="editable and not product.website_published">Product not published</div>
<t t-if="product.website_published">
@ -147,7 +145,7 @@
<span t-att-class="'label label-success js_unpublish %%s' %% (not product.website_published and 'hidden' or '')">Click to Unpublish</span>
<span t-att-class="'label label-important js_publish %%s' %% (product.website_published and 'hidden' or '')">Click to Publish</span>
</a>
<h1><span t-record="product" t-field="name"><t t-esc="product.name"/></span></h1>
<h1 t-field="product.name"></h1>
<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">Add to cart
@ -155,8 +153,8 @@
</button>
</div>
<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-field="product.description_sale"></div>
<div class="oe_ecommerce_price" t-field="product.list_price"><t t-esc="product.list_price"/></div>
<t t-call="website_sale.product_recommended"/>
</div>
</t>