[MERGE] Sync with website-al

bzr revid: tde@openerp.com-20131113093009-w6jih5xosequqowh
This commit is contained in:
Thibault Delavallée 2013-11-13 10:30:09 +01:00
commit ac54e05a21
39 changed files with 378 additions and 286 deletions

View File

@ -21,6 +21,7 @@ from PIL import Image as I
from openerp.osv import orm, fields
from openerp.tools import ustr, DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
from openerp.addons.web.http import request
REMOTE_CONNECTION_TIMEOUT = 2.5
@ -32,6 +33,31 @@ class QWeb(orm.AbstractModel):
_name = 'website.qweb'
_inherit = 'ir.qweb'
URL_ATTRS = {
'form': 'action',
'a': 'href',
'link': 'href',
'frame': 'src',
'iframe': 'src',
'script': 'src',
}
def add_template(self, into, name, node, context):
# preprocessing for multilang static urls
if request and 'url_for' in context:
router = request.httprequest.app.get_db_router(request.db).bind('')
for tag, attr in self.URL_ATTRS.items():
for e in node.getElementsByTagName(tag):
url = e.getAttribute(attr)
if url:
try:
func = router.match(url)[0]
if func.multilang:
e.setAttribute(attr, context['url_for'](url))
except Exception, e:
pass
super(QWeb, self).add_template(into, name, node, context)
def get_converter_for(self, field_type):
return self.pool.get(
'website.qweb.field.' + field_type,

View File

@ -100,25 +100,6 @@ class view(osv.osv):
return arch
URL_ATTRS = {
'form': 'action',
'a': 'href',
'link': 'href',
'frame': 'src',
'iframe': 'src',
'script': 'src',
}
def _normalize_urls(self, root):
for element in root.iter():
attr = self.URL_ATTRS.get(element.tag)
if attr is None or attr not in element.attrib:
continue
value = element.get(attr)
if not urlparse(value).scheme:
element.attrib.pop(attr)
element.set('t-' + attr, value)
def save(self, cr, uid, res_id, value, xpath=None, context=None):
""" Update a view section. The view section may embed fields to write
@ -131,10 +112,6 @@ class view(osv.osv):
arch_section = html.fromstring(
value, parser=html.HTMLParser(encoding='utf-8'))
# TODO fme: Temporary desactivated because this breaks most of the snippets
# Need to find another way to normalize multilang urls (postprocessing) ?
# self._normalize_urls(arch_section)
if xpath is None:
# value is an embedded field on its own, not a view section
self.save_embedded_field(cr, uid, arch_section, context=context)

View File

@ -37,7 +37,7 @@ def route(routes, *route_args, **route_kwargs):
@http.route(new_routes, *route_args, **route_kwargs)
@functools.wraps(f, assigned=functools.WRAPPER_ASSIGNMENTS + ('func_name',))
def wrap(*args, **kwargs):
request.route_lang = kwargs.get('lang_code', None)
request.route_lang = kwargs.pop('lang_code', None)
if not hasattr(request, 'website'):
request.multilang = f.multilang
# TODO: Select website, currently hard coded
@ -332,11 +332,22 @@ class website(osv.osv):
of the same.
:rtype: list({name: str, url: str})
"""
# FIXME: possibility to add custom converters without editing server
# would allow the creation of a pages converter generating page
# urls on its own
View = self.pool['ir.ui.view']
views = View.search_read(cr, uid, [['page', '=', True]],
fields=['name'], order='name', context=context)
xids = View.get_external_id(cr, uid, [view['id'] for view in views], context=context)
for view in views:
if xids[view['id']]:
yield {
'name': view['name'],
'url': '/page/' + xids[view['id']],
}
router = request.httprequest.app.get_db_router(request.db)
for rule in router.iter_rules():
endpoint = rule.endpoint
if not self.rule_is_enumerable(rule):
continue
@ -346,8 +357,7 @@ class website(osv.osv):
)))
for values in generated:
# rule.build returns (domain_part, rel_url)
url = rule.build(values, append_unknown=False)[1]
domain_part, url = rule.build(values, append_unknown=False)
yield {'name': url, 'url': url }
def kanban(self, cr, uid, ids, model, domain, column, template, step=None, scope=None, orderby=None, context=None):

View File

@ -1,3 +1,4 @@
@charset "utf-8";
/* ---- CKEditor Minimal Reset ---- */
.navbar.navbar-inverse .cke_chrome {
border: none;

View File

@ -362,6 +362,7 @@ footer {
.parallax {
position: relative;
background-size: 100%;
}
.parallax.oe_small {
height: 200px;

View File

@ -277,6 +277,7 @@ footer
.parallax
position: relative
background-size: 100%
&.oe_small
height: 200px
&.oe_medium

View File

@ -27,7 +27,7 @@
website.menu.EditMenuDialog = website.editor.Dialog.extend({
template: 'website.menu.dialog.edit',
events: _.extend({}, website.editor.Dialog.prototype.events, {
'click button.js_add_menu': 'add_menu',
'click a.js_add_menu': 'add_menu',
'click button.js_edit_menu': 'edit_menu',
'click button.js_delete_menu': 'delete_menu',
}),
@ -40,8 +40,6 @@
},
start: function () {
var r = this._super.apply(this, arguments);
var button = openerp.qweb.render('website.menu.dialog.footer-button');
this.$('.modal-footer').prepend(button);
this.$('.oe_menu_editor').nestedSortable({
listType: 'ul',
handle: 'div',

View File

@ -0,0 +1,111 @@
(function () {
'use strict';
var website = openerp.website;
website.snippet = {};
website.snippet.start_animation = function () {
$("[data-snippet-id]").each(function() {
var $snipped_id = $(this);
if ( !$snipped_id.parents("#oe_snippets").length &&
!$snipped_id.parent("body").length &&
!$snipped_id.data("snippet-view") &&
website.snippet.animationRegistry[$snipped_id.data("snippet-id")]) {
var snippet = new website.snippet.animationRegistry[$snipped_id.data("snippet-id")]($snipped_id);
$snipped_id.data("snippet-view", snippet);
}
});
};
website.snippet.stop_animation = function () {
$("[data-snippet-id]").each(function() {
var $snipped_id = $(this);
if ($snipped_id.data("snippet-view")) {
$snipped_id.data("snippet-view").stop();
$snipped_id.data("snippet-view", false);
}
});
};
$(document).ready(website.snippet.start_animation);
website.snippet.animationRegistry = {};
website.snippet.Animation = openerp.Class.extend({
$: function () {
return this.$el.find.apply(this.$el, arguments);
},
init: function (dom) {
this.$el = this.$target = $(dom);
this.start();
},
/*
* start
* This method is called after init
*/
start: function () {
},
/*
* stop
* This method is called to stop the animation (e.g.: when rte is launch)
*/
stop: function () {
},
});
website.snippet.animationRegistry.carousel = website.snippet.Animation.extend({
start: function () {
this.$target.carousel({interval: false});
},
});
website.snippet.animationRegistry.parallax = website.snippet.Animation.extend({
start: function () {
var self = this;
setTimeout(function () {self.set_values();});
this.on_scroll = function () {
var speed = parseFloat(self.$target.attr("data-scroll-background-ratio") || 0);
if (speed == 1) return;
var offset = parseFloat(self.$target.attr("data-scroll-background-offset") || 0);
var top = offset + window.scrollY * speed;
self.$target.css("background-position", "0px " + top + "px");
};
this.on_resize = function () {
self.set_values();
};
$(window).on("scroll", this.on_scroll);
$(window).on("resize", this.on_resize);
},
stop: function () {
$(window).off("scroll", this.on_scroll)
.off("resize", this.on_resize);
},
set_values: function () {
var self = this;
var speed = parseFloat(self.$target.attr("data-scroll-background-ratio") || 0);
if (speed == 1) {
this.$target.css("background-attachment", "fixed").css("background-position", "0px 0px");
return;
} else {
this.$target.css("background-attachment", "scroll");
}
this.$target.attr("data-scroll-background-offset", 0);
var img = new Image();
img.onload = function () {
var offset = 0;
var padding = parseInt($(document.body).css("padding-top"));
if (speed < 1) {
var inner_offset = self.$target.outerHeight() - this.height / this.width * document.body.clientWidth;
var outer_offset = self.$target.offset().top - (document.body.clientHeight - self.$target.outerHeight()) - padding;
offset = - outer_offset * speed + inner_offset;
} else {
offset = - self.$target.offset().top * speed;
}
self.$target.attr("data-scroll-background-offset", offset);
$(window).scroll();
};
img.src = this.$target.css("background-image").replace(/url\(['"]*|['"]*\)/g, "");
}
});
})();

View File

@ -1,21 +1,6 @@
(function () {
'use strict';
var start_snippet_animation = function () {
hack_to_add_snippet_id();
$("[data-snippet-id]").each(function() {
var $snipped_id = $(this);
if ( !$snipped_id.parents("#oe_snippets").length &&
typeof $snipped_id.data("snippet-view") === 'undefined' &&
website.snippet.animationRegistry[$snipped_id.data("snippet-id")]) {
var snippet = new website.snippet.animationRegistry[$snipped_id.data("snippet-id")]($snipped_id);
$snipped_id.data("snippet-view", snippet);
}
});
};
$(document).ready(start_snippet_animation);
var website = openerp.website;
website.add_template_file('/website/static/src/xml/website.snippets.xml');
@ -39,7 +24,8 @@
this.on('rte:ready', this, function () {
self.snippets.$button.removeClass("hidden");
start_snippet_animation();
website.snippet.stop_animation();
website.snippet.start_animation();
self.trigger('rte:snippets_ready');
});
@ -58,7 +44,6 @@
/* ----- SNIPPET SELECTOR ---- */
website.snippet = {};
var observer = new website.Observer(function (mutations) {
if (!_(mutations).find(function (m) {
return m.type === 'childList' && m.addedNodes.length > 0;
@ -88,6 +73,10 @@
});
}
$(document).ready(function() {
hack_to_add_snippet_id();
});
website.snippet.selector = [];
website.snippet.BuildingBlock = openerp.Widget.extend({
template: 'website.snippets',
@ -219,16 +208,10 @@
if ($snipped_id.data("snippet-editor")) {
$snipped_id.data("snippet-editor").onBlur();
}
if ($snipped_id.data("snippet-view")) {
$snipped_id.data("snippet-view").onBlurEdit();
}
}
},
snippet_focus: function ($snipped_id) {
if ($snipped_id) {
if ($snipped_id.data("snippet-view")) {
$snipped_id.data("snippet-view").onFocusEdit();
}
if ($snipped_id.data("snippet-editor")) {
$snipped_id.data("snippet-editor").onFocus();
}
@ -367,9 +350,7 @@
if(action === 'insert'){
$target = $toInsert;
if (website.snippet.animationRegistry[snipped_id]) {
new website.snippet.animationRegistry[snipped_id]($target);
}
website.snippet.start_animation();
self.create_overlay($target);
$target.data("snippet-editor").drop_and_build_snippet($target);
@ -547,34 +528,6 @@
});
website.snippet.animationRegistry = {};
website.snippet.Animation = openerp.Class.extend({
$: function () {
return this.$el.find.apply(this.$el, arguments);
},
init: function (dom) {
this.$el = this.$target = $(dom);
this.start();
},
/*
* start
* This method is called after init
*/
start: function () {
},
/* onFocusEdit
* if they are an editor for this data-snippet-id
* Called before onFocus of snippet editor
*/
onFocusEdit : function () {},
/* onBlurEdit
* if they are an editor for this data-snippet-id
* Called after onBlur of snippet editor
*/
onBlurEdit : function () {},
});
website.snippet.editorRegistry = {};
website.snippet.Editor = openerp.Class.extend({
init: function (parent, dom) {
@ -797,7 +750,7 @@
},
change_background: function (bg, ul_options) {
change_background: function (bg, ul_options, callback) {
var self = this;
this.set_options_background(bg, ul_options);
var $ul = this.$editor.find(ul_options);
@ -819,6 +772,9 @@
});
editor.appendTo($('body'));
}
if (callback) {
callback();
}
})
.on('mouseover', function (event) {
if ($(this).data("value")) {
@ -1033,11 +989,6 @@
},
});
website.snippet.animationRegistry.carousel = website.snippet.Animation.extend({
start: function () {
this.$target.carousel({interval: false});
},
});
website.snippet.editorRegistry.carousel = website.snippet.editorRegistry.resize.extend({
drop_and_build_snippet: function() {
var id = 0;
@ -1211,8 +1162,11 @@
website.snippet.editorRegistry.parallax = website.snippet.editorRegistry.resize.extend({
start : function () {
var self = this;
this._super();
this.change_background(this.$target, 'ul[name="parallax-background"]');
this.change_background(this.$target, 'ul[name="parallax-background"]', function () {
self.$target.data("snippet-view").set_values();
});
this.scroll();
this.change_size();
},
@ -1228,11 +1182,15 @@
var speed = $(this).data('value');
self.$target.attr('data-scroll-background-ratio', speed);
self.$target.data("snippet-view").set_values();
return false;
});
this.$target.data("snippet-view").set_values();
},
clean_for_save: function () {
this._super();
this.$target.find(".parallax").css("background-position", '');
this.$target.find(".parallax")
.css("background-position", '')
.removeAttr("data-scroll-background-offset");
},
change_size: function () {
var self = this;
@ -1251,6 +1209,7 @@
$li.removeClass("active");
$(this).addClass("active");
self.$target.data("snippet-view").set_values();
return false;
})
.on('mouseover', function (event) {
self.$target.removeClass('oe_big oe_small oe_medium');
@ -1262,39 +1221,6 @@
});
}
});
website.snippet.animationRegistry.parallax = website.snippet.Animation.extend({
start: function () {
var self = this;
this.set_values();
var on_scroll = function () {
var speed = parseFloat(self.$target.attr("data-scroll-background-ratio") || 0);
if (speed == 1) return;
var offset = parseFloat(self.$target.attr("data-scroll-background-offset") || 0);
var top = offset + window.scrollY * speed;
self.$target.css("background-position", "0px " + top + "px");
};
$(window).off("scroll").on("scroll", on_scroll);
},
set_values: function () {
var self = this;
var speed = parseFloat(self.$target.attr("data-scroll-background-ratio") || 0);
if (speed == 1) {
this.$target.css("background-attachment", "fixed").css("background-position", "0px 0px");
return;
} else {
this.$target.css("background-attachment", "scroll");
}
this.$target.attr("data-scroll-background-offset", 0);
var img = new Image();
img.onload = function () {
self.$target.attr("data-scroll-background-offset", self.$target.outerHeight() - this.height);
$(window).scroll();
};
img.src = this.$target.css("background-image").replace(/url\(['"]*|['"]*\)/g, "");
}
});
/*
* data-snippet-id automatically setted

View File

@ -21,19 +21,19 @@
</ul>
</li>
</t>
<t t-name="website.menu.dialog.footer-button">
<button type="button" class="btn pull-left js_add_menu btn-success">
<i class="icon-plus-sign"/> Add Menu Entry
</button>
</t>
<t t-name="website.menu.dialog.edit">
<t t-call="website.editor.dialog">
<t t-set="title">Edit Structure</t>
<t t-set="title">Edit Menu</t>
<ul class="oe_menu_editor">
<t t-foreach="widget.menu.children" t-as="submenu">
<t t-call="website.menu.dialog.submenu"/>
</t>
</ul>
<p class="mt32">
<a href="#" class="js_add_menu">
<i class="icon-plus-sign"/> Add Menu Entry
</a>
</p>
</t>
</t>
<t t-name="website.menu.dialog.add" t-extend="website.editor.dialog.link">

View File

@ -61,9 +61,16 @@
<h3 class="modal-title">Mobile preview</h3>
</div>
<div class="modal-body">
<div>
<iframe id="mobile-viewport" class="oe_mobile_viewport" src="?mobile-preview=true"></iframe>
</div>
<iframe id="mobile-viewport" class="oe_mobile_viewport" src="?mobile-preview=true"></iframe>
<script>
var $o = $('<div style="width:50px; overflow:scroll;"><div style="width:100%;"></div></div>');
$o.appendTo("body");
var scrollSize = 50 - $o.find("div").innerWidth();
$o.remove();
$(".modal-body").css({'overflow': 'hidden', 'margin-right': '5px'});
$(".oe_mobile_viewport").css({'width': (320 + scrollSize + 5) + 'px'});
</script>
</div>
</div>
</div>

View File

@ -703,8 +703,8 @@
<li data-value="0.3"><a>Very Slow</a></li>
<li data-value="0.6"><a>Slow</a></li>
<li data-value="1"><a>Fixed</a></li>
<li data-value="1.5"><a>Fast</a></li>
<li data-value="2"><a>Very Fast</a></li>
<li data-value="1.4"><a>Fast</a></li>
<li data-value="1.7"><a>Very Fast</a></li>
</ul>
</li>
<div class="oe_snippet_body parallax oe_small oe_structure"

View File

@ -77,6 +77,7 @@
<script type="text/javascript" src="/web/static/src/js/openerpframework.js"></script>
<script type="text/javascript" src="/website/static/src/js/website.js"></script>
<script t-if="not translatable" type="text/javascript" src="/website/static/src/js/website.snippets.animation.js"></script>
<t t-if="editable">
<script type="text/javascript" src="/website/static/lib/ckeditor/ckeditor.js"></script>
@ -98,7 +99,7 @@
<script type="text/javascript" src="/website/static/src/js/website.seo.js"></script>
<script type="text/javascript" src="/website/static/src/js/website.tour.js"></script>
<script type="text/javascript" src="/website/static/src/js/website.tour.basic.js"></script>
<script t-if="not translatable" type="text/javascript" src="/website/static/src/js/website.snippets.js"></script>
<script t-if="not translatable" type="text/javascript" src="/website/static/src/js/website.snippets.editor.js"></script>
<script t-if="not translatable" type="text/javascript" src="/website/static/src/js/website.ace.js"></script>
<script t-if="translatable" type="text/javascript" src="/website/static/src/js/website.translator.js"></script>
</t>
@ -147,13 +148,13 @@
<div class="col-md-3" name="product">
<h4>Our products &amp; Services</h4>
<ul class="list-unstyled" name="products">
<li><a t-href="/">Home</a></li>
<li><a href="/">Home</a></li>
</ul>
</div>
<div class="col-md-3" name="info">
<h4 name="info_title">Connect with us</h4>
<ul class="list-unstyled">
<li><a t-href="/page/website.contactus">Contact us</a></li>
<li><a href="/page/website.contactus">Contact us</a></li>
</ul>
<ul class="list-unstyled">
<li><i class="icon-phone"></i> <span t-field="res_company.phone"></span></li>
@ -209,7 +210,7 @@
<a class="label label-danger" href="https://openerp.com/apps/website">OpenERP</a>
</div>
<div class="pull-left text-muted">
Copyright &amp;copy; <span t-field="res_company.name">Company name</span> - <a t-href="/sitemap">Sitemap</a>
Copyright &amp;copy; <span t-field="res_company.name">Company name</span> - <a href="/sitemap">Sitemap</a>
</div>
</div>
</footer>
@ -366,7 +367,7 @@
<div class="well mt32">
<p>This page does not exists, but you can create it as you are administrator of this site.</p>
<a class="btn btn-primary" t-att-href="'/pagenew/'+path">Create Page</a>
<span class="text-muted">or</span> <a t-href="/sitemap">Search a Page</a>
<span class="text-muted">or</span> <a href="/sitemap">Search a Page</a>
</div>
<div class="text-center text-muted">Edit the content bellow this line to adapt the default "page not found" page.</div>
</div>
@ -381,8 +382,8 @@
</p>
<p>Maybe you were looking for one of these popular pages ?</p>
<ul>
<li><a t-href="/">Homepage</a></li>
<li><a t-href="/page/website.contactus/">Contact Us</a></li>
<li><a href="/">Homepage</a></li>
<li><a href="/page/website.contactus/">Contact Us</a></li>
</ul>
</div>
</div>
@ -420,8 +421,8 @@
</p>
<pre t-if="editable" t-esc="error"/>
<ul>
<li><a t-href="/">Homepage</a></li>
<li><a t-href="/page/website.contactus/">Contact Us</a></li>
<li><a href="/">Homepage</a></li>
<li><a href="/page/website.contactus/">Contact Us</a></li>
</ul>
</div>
</div>
@ -505,64 +506,67 @@ Sitemap: <t t-esc="url_root"/>sitemap.xml
<template id="aboutus" name="About us" page="True">
<t t-call="website.layout">
<div id="wrap" class="oe_structure">
<div id="wrap">
<div class="oe_structure">
<section data-snippet-id="title">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="text-center">About us</h1>
<h3 class="text-muted text-center">Great products for great people</h3>
<section data-snippet-id="title">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="text-center">About us</h1>
<h3 class="text-muted text-center">Great products for great people</h3>
</div>
</div>
</div>
</section>
<section data-snippet-id="text-image">
<div class="container">
<div class="row">
<div class="col-md-6 mt32">
<p>
We are a team of passionated people whose goal is to improve everyone's
life through disruptive products. We build great products to solve your
business problems.
</p>
<p>
Our products are designed for small to medium companies willing to optimize
their performance.
</p>
</div>
<div class="col-md-4 col-md-offset-2 mt16 mb16">
<img src="/website/static/src/img/library/business_conference.jpg" class="img img-responsive shadow" alt="Our Team"/>
</div>
</div>
</div>
</section>
<div class="parallax oe_structure mt16 oe_medium mb64" data-scroll-background-ratio="0.6" data-snippet-id="parallax" style="background-image: url(http://localhost:8069/website/static/src/img/parallax/parallax_bg.jpg); background-attachment: scroll; background-position: 0px 0px; ">
<section class="mb32 mt16" data-snippet-id="references">
<div class="container">
<div class="row">
<div class="col-md-12 mt16 mb8">
<h1 class="text-center">What do customers say about us...</h1>
</div>
<div class="col-md-4 col-md-offset-1 mt16 mb0">
<blockquote data-snippet-id="quote">
<p><span style="background-color:#FFFFFF;">Write here a quote from one of your customer. Quotes are are great way to give confidence in your products or services.</span></p>
<small><span style="background-color:#FFFFFF;">Author of this quote</span></small>
</blockquote>
</div>
<div class="col-md-4 col-md-offset-2 mt16 mb32">
<blockquote data-snippet-id="quote">
<p><span style="background-color:#FFFFFF;">OpenERP provides essential platform for our project management. Things are better organized and more visible with it.</span></p>
<small><span style="background-color:#FFFFFF;">John Doe, CEO</span></small>
</blockquote>
</div>
</div>
</div>
</section>
</div>
</div>
</section>
<section data-snippet-id="text-image">
<div class="container">
<div class="row">
<div class="col-md-6 mt32">
<p>
We are a team of passionated people whose goal is to improve everyone's
life through disruptive products. We build great products to solve your
business problems.
</p>
<p>
Our products are designed for small to medium companies willing to optimize
their performance.
</p>
</div>
<div class="col-md-4 col-md-offset-2 mt16 mb16">
<img src="/website/static/src/img/library/business_conference.jpg" class="img img-responsive shadow" alt="Our Team"/>
</div>
</div>
</div>
</section>
<div class="parallax oe_structure mt16 oe_medium mb64" data-scroll-background-offset="0" data-scroll-background-ratio="1" data-snippet-id="parallax" style="background-image: url(http://localhost:8069/website/static/src/img/parallax/parallax_bg.jpg); background-attachment: scroll; background-position: 0px 0px; ">
<section class="mb32 mt16" data-snippet-id="references">
<div class="container">
<div class="row">
<div class="col-md-12 mt16 mb8">
<h1 class="text-center">What do customers say about us...</h1>
</div>
<div class="col-md-4 col-md-offset-1 mt16 mb0">
<blockquote data-snippet-id="quote">
<p><span style="background-color:#FFFFFF;">Write here a quote from one of your customer. Quotes are are great way to give confidence in your products or services.</span></p>
<small><span style="background-color:#FFFFFF;">Author of this quote</span></small>
</blockquote>
</div>
<div class="col-md-4 col-md-offset-2 mt16 mb32">
<blockquote data-snippet-id="quote">
<p><span style="background-color:#FFFFFF;">OpenERP provides essential platform for our project management. Things are better organized and more visible with it.</span></p>
<small><span style="background-color:#FFFFFF;">John Doe, CEO</span></small>
</blockquote>
</div>
</div>
</div>
</section>
</div>
<div class="oe_structure"></div>
</div>
</t>
</template>

View File

@ -177,7 +177,7 @@ class WebsiteBlog(http.Controller):
context=dict(context, mail_create_nosubcribe=True))
return werkzeug.utils.redirect(request.httprequest.referrer + "#comments")
@website.route(['/blog/<int:category_id>/new'], type='http', auth="public")
@website.route(['/blog/<int:category_id>/new'], type='http', auth="public", multilang=True)
def blog_post_create(self, category_id=None, **post):
cr, uid, context = request.cr, request.uid, request.context
create_context = dict(context, mail_create_nosubscribe=True)

View File

@ -263,7 +263,7 @@
through your <b>blog entries</b>, referenced in Google.
</p>
<div>
<a t-href="/page/website.contactus"><button class="btn btn-primary">Contact us</button></a>
<a href="/page/website.contactus"><button class="btn btn-primary">Contact us</button></a>
</div>
</section>
</xpath>

View File

@ -4,7 +4,7 @@
<template id="contactus_form" name="Contact Form" inherit_id="website.contactus" inherit_option_id="website.contactus">
<xpath expr="//div[@name='mail_button']" position="replace">
<form t-action="/crm/contactus" method="post" class="form-horizontal mt32" >
<form action="/crm/contactus" method="post" class="form-horizontal mt32" >
<div t-attf-class="form-group #{error and 'contact_name' in error and 'has-error' or ''}">
<label class="col-md-3 col-sm-4 control-label" for="contact_name">Your Name</label>
<div class="col-md-7 col-sm-8">

View File

@ -6,7 +6,7 @@
<!-- Layout add nav and footer -->
<template id="footer_custom" inherit_id="website.layout" name="Footer Partners Link">
<xpath expr="//footer//div[@name='info']/ul" position="inside">
<li><a t-href="/partners/">Partners</a></li>
<li><a href="/partners/">Partners</a></li>
</xpath>
</template>
@ -52,7 +52,7 @@
<t t-call="website.pager">
<t t-set="classname">pull-left</t>
</t>
<form t-action="/partners/" method="get" class="navbar-search pull-right pagination form-inline">
<form action="/partners/" method="get" class="navbar-search pull-right pagination form-inline">
<div class="form-group">
<input type="text" name="search" class="search-query col-md-2 mt4 form-control" placeholder="Search" t-att-value="name_search"/>
</div>

View File

@ -5,7 +5,7 @@
<!-- Layout add nav and footer -->
<template id="footer_custom" inherit_id="website.layout" name="Footer Customer References Link">
<xpath expr="//footer//div[@name='info']/ul" position="inside">
<li><a t-href="/customers/">Customer References</a></li>
<li><a href="/customers/">Customer References</a></li>
</xpath>
</template>

View File

@ -11,7 +11,7 @@ Online Events
""",
'author': 'OpenERP SA',
'depends': ['website', 'website_mail', 'event_sale', 'website_sale'],
'depends': ['website', 'website_partner', 'website_mail', 'event_sale', 'website_sale'],
'data': [
'data/event_data.xml',
'views/website_event.xml',

View File

@ -51,20 +51,20 @@ class event(osv.osv):
'website_published': False,
}
def _check_organizer_id_published(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
if obj.website_published and obj.organizer_id and not obj.organizer_id.website_published:
return False
return True
def _check_address_id_published(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
if obj.website_published and obj.address_id and not obj.address_id.website_published:
return False
return True
_constraints = [
(_check_organizer_id_published, "This event can't be published if the field Orginizer is not website published.", ['organizer_id','website_published']),
(_check_address_id_published, "This event can't be published if the field Location is not website published.", ['address_id','website_published']),
]
# def _check_organizer_id_published(self, cr, uid, ids, context=None):
# for obj in self.browse(cr, uid, ids, context=context):
# if obj.website_published and obj.organizer_id and not obj.organizer_id.website_published:
# return False
# return True
# def _check_address_id_published(self, cr, uid, ids, context=None):
# for obj in self.browse(cr, uid, ids, context=context):
# if obj.website_published and obj.address_id and not obj.address_id.website_published:
# return False
# return True
# _constraints = [
# (_check_organizer_id_published, "This event can't be published if the field Orginizer is not website published.", ['organizer_id','website_published']),
# (_check_address_id_published, "This event can't be published if the field Location is not website published.", ['address_id','website_published']),
# ]
def google_map_img(self, cr, uid, ids, zoom=8, width=298, height=298, context=None):
partner = self.browse(cr, uid, ids[0], context=context)

View File

@ -3,3 +3,4 @@ access_event_event_public,event.event.public,event.model_event_event,base.group_
access_event_type_public,event.type.public,event.model_event_type,base.group_public,1,0,0,0
access_event_event_ticket_public,event.event.ticket.public,event_sale.model_event_event_ticket,base.group_public,1,0,0,0
access_event_product_product_public,event.product.product.public,product.model_product_product,base.group_public,1,0,0,0
access_event_product_template_public,event.product.template.public,product.model_product_template,base.group_public,1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
3 access_event_type_public event.type.public event.model_event_type base.group_public 1 0 0 0
4 access_event_event_ticket_public event.event.ticket.public event_sale.model_event_event_ticket base.group_public 1 0 0 0
5 access_event_product_product_public event.product.product.public product.model_product_product base.group_public 1 0 0 0
6 access_event_product_template_public event.product.template.public product.model_product_template base.group_public 1 0 0 0

View File

@ -24,7 +24,17 @@
<record id="event_product_product_public" model="ir.rule">
<field name="name">Product linked to event: Public</field>
<field name="model_id" ref="product.model_product_product"/>
<field name="domain_force">[("event_type_id", "!=", False), ('event_ticket_ids.event_id.website_published', '=', True)]</field>
<field name="domain_force">[('event_ticket_ids.event_id.website_published', '=', True)]</field>
<field name="groups" eval="[(4, ref('base.group_public'))]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="False"/>
<field name="perm_create" eval="False"/>
<field name="perm_unlink" eval="False"/>
</record>
<record id="event_product_template_public" model="ir.rule">
<field name="name">Product template linked to event: Public</field>
<field name="model_id" ref="product.model_product_template"/>
<field name="domain_force">[('product_variant_ids.event_ticket_ids.event_id.website_published', '=', True)]</field>
<field name="groups" eval="[(4, ref('base.group_public'))]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="False"/>

View File

@ -5,7 +5,7 @@
<!-- Layout add nav and footer -->
<template id="header_footer_custom" inherit_id="website.layout" name="Footer Events Link">
<xpath expr="//footer//ul[@name='products']" position="inside">
<li><a t-href="/event">Events</a></li>
<li><a href="/event">Events</a></li>
</xpath>
</template>
@ -315,7 +315,7 @@
<li t-if="event_id.country_id">
<a t-href="/event?country=#{event_id.country_id.id}"><strong><span class="icon-double-angle-right"/> Other Events in <span t-esc="event_id.country_id.name"/></strong></a>
</li>
<li><a t-href="/event"><strong><span class="icon-double-angle-right"/> All Events</strong></a></li>
<li><a href="/event"><strong><span class="icon-double-angle-right"/> All Events</strong></a></li>
</ul>
</div>
</div>

View File

@ -1,4 +0,0 @@
.col-wrap .colsize {
height: 300px;
}

View File

@ -3,26 +3,23 @@
<data>
<!-- Page -->
<template id="aboutus" inherit_id="website.aboutus" name="Our Team">
<xpath expr="//div[@id='aboutus']" position="inside">
<t t-set="head">
<link rel='stylesheet' href='/website_hr/static/src/css/website_hr.css'/>
<t t-raw="head or ''"/>
</t>
<div class="clearfix"/>
<div class="col-sm-12 text-center" t-if="len(employee_ids)">
<h2>Our Team</h2>
</div>
<div t-foreach="employee_ids" t-as="employee" class="col-sm-3 col-lg-2 mt16 text-center colsize">
<t t-call="website.publish_management"><t t-set="object" t-value="employee"/></t>
<div class="clearfix"/>
<img t-att-src="employee.img('image_medium')" class="img shadow img-rounded"/>
<div class="mt8">
<strong t-field="employee.name"></strong>
<template id="aboutus" inherit_id="website.aboutus" inherit_option_id="website.aboutus" name="Our Team">
<xpath expr="//div[@class='oe_structure'][last()]" position="inside">
<section class="container">
<div class="col-sm-12 text-center" t-if="len(employee_ids)">
<h2>Our Team</h2>
</div>
<div t-field="employee.job_id"/>
<div t-field="employee.public_info" class="text-muted mt16"/>
</div>
<div t-foreach="employee_ids" t-as="employee" class="col-sm-3 col-lg-2 mt16 text-center colsize">
<t t-call="website.publish_management"><t t-set="object" t-value="employee"/></t>
<div class="clearfix"/>
<img t-att-src="employee.img('image_medium')" class="img shadow img-rounded"/>
<div class="mt8">
<strong t-field="employee.name"></strong>
</div>
<div t-field="employee.job_id"/>
<div t-field="employee.public_info" class="text-muted mt16"/>
</div>
</section>
</xpath>
</template>

View File

@ -9,7 +9,7 @@ OpenERP Contact Form
""",
'author': 'OpenERP SA',
'depends': ['hr_recruitment', 'website_mail'],
'depends': ['website_partner', 'hr_recruitment', 'website_mail'],
'data': [
'data/website_hr_recruitment_data.xml',
'views/website_hr_recruitment.xml',

View File

@ -91,17 +91,4 @@ class website_hr_recruitment(http.Controller):
@website.route('/job/publish', type='json', auth="admin", multilang=True)
def publish (self, id, object):
res = controllers.publish(id, object)
hr_job = request.registry[object]
id = int(id)
rec = hr_job.browse(request.cr, request.uid, id)
vals = {}
if rec.website_published:
vals['state'] = 'recruit'
if not rec.no_of_recruitment:
vals ['no_of_recruitment'] = 1.0
else:
vals['state'] = 'open'
hr_job.write(request.cr, request.uid, [rec.id], vals, context=request.context)
return res

View File

@ -10,3 +10,12 @@ class hr_job(osv.osv):
'website_published': fields.boolean('Available in the website'),
'website_description': fields.html('Description for the website'),
}
def _check_address_id_published(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
if obj.website_published and obj.address_id and not obj.address_id.website_published:
return False
return True
_constraints = [
(_check_address_id_published, "This Jobpost can't be published if the field Job Location is not website published.", ['address_id','website_published']),
]

View File

@ -9,7 +9,7 @@
<template id="job_footer_custom" inherit_id="website.layout" name="Footer Job Link">
<xpath expr="//footer//div[@name='info']/ul" position="inside">
<li><a t-href="/jobs">Jobs</a></li>
<li><a href="/jobs">Jobs</a></li>
</xpath>
</template>
@ -83,7 +83,7 @@
<div class="container">
<div class="row">
<div class="col-md-12 text-center mt16 mb16">
<a t-href="/job/apply" class="btn btn-primary btn-lg">Apply</a>
<a href="/job/apply" class="btn btn-primary btn-lg">Apply</a>
</div>
</div>
</div>
@ -102,7 +102,7 @@
<div class="row">
<div class="col-sm-5">
<ol class="breadcrumb mb0">
<li><a t-href="/jobs">Our Jobs</a></li>
<li><a href="/jobs">Our Jobs</a></li>
<li class="active"><span t-field="job.name"></span></li>
</ol>
</div><div class="col-sm-7">
@ -220,7 +220,7 @@
<div class="container">
<div class="row">
<div class="col-md-12 text-center mt16 mb16">
<a t-href="/" class="btn btn-primary btn-lg">Continue To Our Website</a>
<a href="/" class="btn btn-primary btn-lg">Continue To Our Website</a>
</div>
</div>
</div>
@ -233,7 +233,7 @@
<template id="job_departments" inherit_option_id="website_hr_recruitment.index" name="Filter on Departments">
<xpath expr="//div[@id='jobs_grid_left']" position="inside">
<ul class="nav nav-pills nav-stacked mb32">
<li t-att-class=" '' if active else 'active' "><a t-href="/jobs">All Departments</a></li>
<li t-att-class=" '' if active else 'active' "><a href="/jobs">All Departments</a></li>
<t t-foreach="departments" t-as="department">
<li t-att-class="department.id == active and 'active' or ''">
<a t-href="/jobs/department/#{ department.id }/" ><span t-field="department.name"/></a>
@ -249,7 +249,7 @@
<template id="job_offices" inherit_option_id="website_hr_recruitment.index" name="Filter on Offices">
<xpath expr="//div[@id='jobs_grid_left']" position="inside">
<ul class="nav nav-pills nav-stacked mb32">
<li t-att-class=" '' if office else 'active' "><a t-href="/jobs">All Offices</a></li>
<li t-att-class=" '' if office else 'active' "><a href="/jobs">All Offices</a></li>
<t t-foreach="offices" t-as="thisoffice">
<li t-att-class="thisoffice.id == office and 'active' or ''">
<a t-href="/jobs/office/#{ thisoffice.id }/" >

View File

@ -5,7 +5,7 @@
<!-- Layout add nav and footer -->
<template id="footer_custom" inherit_id="website.layout" name="Footer Associations Link">
<xpath expr="//footer//div[@name='info']/ul" position="inside">
<li><a t-href="/members/">Associations</a></li>
<li><a href="/members/">Associations</a></li>
</xpath>
</template>
@ -35,7 +35,7 @@
<div class="col-md-4" id="left_column">
<ul class="nav nav-pills nav-stacked mt16">
<li class="nav-header"><h3>Associations</h3></li>
<li t-att-class="membership and '' or 'active'"><a t-href="/members/">All</a></li>
<li t-att-class="membership and '' or 'active'"><a href="/members/">All</a></li>
<t t-foreach="memberships" t-as="membership_id">
<li t-att-class="membership and membership_id.id == membership.id and 'active' or ''">
<a t-href="/members/association/#{ membership_id.id }"><t t-esc="membership_id.name"/></a>
@ -48,7 +48,7 @@
<t t-call="website.pager">
<t t-set="classname">pull-left</t>
</t>
<form t-action="/members/" method="get" class="navbar-search pull-right pagination form-inline">
<form action="/members/" method="get" class="navbar-search pull-right pagination form-inline">
<div class="form-group">
<input type="text" name="name" class="search-query col-md-2 mt4 form-control" placeholder="Search" t-att-value="post.get('name', '')"/>
</div>

View File

@ -31,6 +31,7 @@
'views/res_partner_view.xml',
'views/website_partner_view.xml',
'security/website_partner_security.xml',
'data/website_data.xml',
],
'css': [
],

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="base.main_company" model="res.company">
<field name="website_published">True</field>
</record>
</data>
</openerp>

View File

@ -1 +1,2 @@
import res_partner
import res_partner
import res_company

View File

@ -0,0 +1,11 @@
# -*- coding: utf-8 -*-
from openerp.osv import osv, fields
class WebsiteResCompany(osv.Model):
_inherit = 'res.company'
_columns = {
'website_published': fields.related('partner_id', 'website_published', string='Publish', help="Publish on the website"),
}

View File

@ -342,7 +342,7 @@ class Ecommerce(http.Controller):
return request.website.render("website_sale.products", values)
@website.route(['/shop/product/<model("product.template"):product>/'], type='http', auth="public", multilang=True)
def product(self, product, search='', category='', filter='', promo=None, lang_code=None):
def product(self, product, search='', category='', filter='', promo=None):
if promo:
self.change_pricelist(promo)

View File

@ -10,4 +10,5 @@ access_sale_order_public,sale.order.public,model_sale_order,base.group_public,1,
access_sale_order_line_public,sale.order.line.public,model_sale_order_line,base.group_public,1,0,0,0
access_product_attribute,product.attribute.public,website_sale.model_product_attribute,base.group_public,1,0,0,0
access_product_attribute_value,product.attribute.value.public,website_sale.model_product_attribute_value,base.group_public,1,0,0,0
access_product_attribute_product,product.attribute.product.public,website_sale.model_product_attribute_product,base.group_public,1,0,0,0
access_product_attribute_product,product.attribute.product.public,website_sale.model_product_attribute_product,base.group_public,1,0,0,0
access_website_product_style,website.product.style.public,website_sale.model_website_product_style,base.group_public,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
10 access_sale_order_line_public sale.order.line.public model_sale_order_line base.group_public 1 0 0 0
11 access_product_attribute product.attribute.public website_sale.model_product_attribute base.group_public 1 0 0 0
12 access_product_attribute_value product.attribute.value.public website_sale.model_product_attribute_value base.group_public 1 0 0 0
13 access_product_attribute_product product.attribute.product.public website_sale.model_product_attribute_product base.group_public 1 0 0 0
14 access_website_product_style website.product.style.public website_sale.model_website_product_style base.group_public 1 0 0 0

View File

@ -58,9 +58,12 @@
.product_price {
position: absolute;
right: 15px;
left: 15px;
bottom: 5px;
bottom: 0;
z-index: 6;
background: rgba(255, 255, 255, 0.6);
padding: 5px 0;
}
.oe_mycart .input-group-addon {

View File

@ -54,9 +54,12 @@
padding-bottom: 24px
.product_price
position: absolute
right: 15px
left: 15px
bottom: 5px
bottom: 0
z-index: 6
background: rgba(255,255,255,0.6)
padding: 5px 0
.oe_mycart
.input-group-addon

View File

@ -7,7 +7,7 @@
<template id="header" inherit_id="website.layout" name="Header Shop My Cart Link">
<xpath expr="//header//ul[@id='top_menu']/li" position="before">
<li t-att-class="(not website_sale_order or not website_sale_order.get_total_quantity()) and 'hidden' or ''">
<a t-href="/shop/mycart/">
<a href="/shop/mycart/">
<i class="icon-shopping-cart"></i>
My cart <sup t-attf-class="my_cart_quantity label label-primary"
t-esc="website_sale_order and website_sale_order.get_total_quantity() or ''"/>
@ -95,7 +95,7 @@
<t t-set="classname">pull-right</t>
<t t-set="style">padding-left: 5px;</t>
</t>
<form t-action="/shop/" method="get" class="pull-right pagination form-inline" style="padding-right: 5px;">
<form action="/shop/" method="get" class="pull-right pagination form-inline" style="padding-right: 5px;">
<t t-call="website_sale.search" />
</form>
</div>
@ -218,7 +218,7 @@
<!-- List view of products -->
<template id="list_view" inherit_option_id="website_sale.products" name="List View">
<xpath expr="//div[@id='products_grid']/table" position="replace">
<xpath expr="//div[@id='products_grid']//table" position="replace">
<div class="row">
<t t-set="products" t-value="Ecommerce.get_products(product_ids)"/>
<t t-foreach="products" t-as="product">
@ -245,7 +245,7 @@
<div class="row">
<div class="col-sm-5">
<ol class="breadcrumb">
<li><a t-href="/shop">Products</a></li>
<li><a href="/shop">Products</a></li>
<li t-if="search.get('category')"><a t-href="/shop/" t-keep-query="category,search,facettes"><span t-field="category.name"/></a></li>
<li class="active"><span t-field="product.name"></span></li>
</ol>
@ -262,7 +262,7 @@
</li>
</t>
</div><div class="col-sm-3 col-sm-offset-1">
<form t-action="/shop/" method="get" class="pull-right">
<form action="/shop/" method="get" class="pull-right">
<t t-call="website_sale.search" />
</form>
</div>
@ -276,7 +276,7 @@
</div><div class="col-sm-5 col-md-5 col-lg-4 col-lg-offset-1">
<h1 t-field="product.name">Product Name</h1>
<form t-action="./add_cart/" class="js_add_cart_json">
<form action="./add_cart/" class="js_add_cart_json">
<input type="hidden" t-if="len(product.product_variant_ids) &lt;= 1" name="product_id" t-att-value="product.id"/>
<t t-if="len(product.product_variant_ids) &gt; 1">
<label label-default="label-default" class="radio" t-foreach="product.product_variant_ids" t-as="product">
@ -472,8 +472,8 @@
</thead>
</table>
<div class="clearfix"/>
<a t-href="/shop" class="btn btn-default mb32"><span class="icon-long-arrow-left"/> Continue Shopping</a>
<a t-if="website_sale_order and website_sale_order.order_line" t-href="/shop/checkout/" class="btn btn-primary pull-right mb32">Process Checkout <span class="icon-long-arrow-right"/></a>
<a href="/shop" class="btn btn-default mb32"><span class="icon-long-arrow-left"/> Continue Shopping</a>
<a t-if="website_sale_order and website_sale_order.order_line" href="/shop/checkout/" class="btn btn-primary pull-right mb32">Process Checkout <span class="icon-long-arrow-right"/></a>
<div class="oe_structure"/>
</div>
<div class="col-md-3 text-muted" id="right_column">
@ -501,7 +501,7 @@
<template id="products_categories" inherit_option_id="website_sale.products" name="Product Categories">
<xpath expr="//div[@id='products_grid_before']" position="inside">
<ul class="nav nav-pills nav-stacked mt16">
<li t-att-class=" '' if search.get('category') else 'active' "><a t-href="/shop/">All Products</a></li>
<li t-att-class=" '' if search.get('category') else 'active' "><a href="/shop/">All Products</a></li>
<t t-set="categ" t-value="Ecommerce.get_categories()"/>
<t t-foreach="categ[0]" t-as="category">
<t t-call="website_sale.categories_recursive"/>
@ -614,7 +614,7 @@
<p>
Have a coupon code? Fill in this field and apply.
</p>
<form t-if="website_sale_order and website_sale_order.order_line" t-action="/shop/mycart/" method="post" class="mb32">
<form t-if="website_sale_order and website_sale_order.order_line" action="/shop/mycart/" method="post" class="mb32">
<div class="input-group">
<input name="promo" class='form-control' type="text" placeholder="code..." t-att-value="website_sale_order.pricelist_id.code or ''"/>
<div class="input-group-btn">
@ -645,7 +645,7 @@
<li class="text-muted">Confirmation<span class="chevron"></span></li>
</ul>
<h1>Your Address</h1>
<form t-action="/shop/confirm_order/" method="post">
<form action="/shop/confirm_order/" method="post">
<div class="row">
<div class="col-md-8 oe_mycart">
@ -899,6 +899,7 @@
<t t-foreach="payments" t-as="payment">
<div t-att-data-id="payment.id" t-raw="payment._content" class="hidden"/>
</t>
<<<<<<< TREE
</div>
<div class="js_payment_validation mb64" t-if="payment_acquirer_id">
@ -1007,6 +1008,7 @@
</div>
<h2>Tanks you for your order.</h2>
<a href="/shop/payment_validate/" class="btn btn-primary mt16">Validate &amp; Pay <span class="icon-long-arrow-right"/></a>
</div>
<div class="oe_structure"/>