[MERGE] Merge parents
bzr revid: rim@openerp.com-20131121074853-h6kxdegpspem0pz4
This commit is contained in:
@@ -261,8 +261,9 @@ class Website(openerp.addons.web.controllers.main.Home):
|
||||
|
||||
@website.route(['/robots.txt'], type='http', auth="public")
|
||||
def robots(self):
|
||||
body = request.website.render('website.robots', {'url_root': request.httprequest.url_root})
|
||||
return request.make_response(body, headers=[('Content-Type', 'text/plain')])
|
||||
response = request.website.render('website.robots', {'url_root': request.httprequest.url_root})
|
||||
response.mimetype = 'text/plain'
|
||||
return response
|
||||
|
||||
@website.route('/sitemap', type='http', auth='public', multilang=True)
|
||||
def sitemap(self):
|
||||
@@ -270,14 +271,11 @@ class Website(openerp.addons.web.controllers.main.Home):
|
||||
|
||||
@website.route('/sitemap.xml', type='http', auth="public")
|
||||
def sitemap_xml(self):
|
||||
body = request.website.render('website.sitemap_xml', {
|
||||
response = request.website.render('website.sitemap_xml', {
|
||||
'pages': request.website.enumerate_pages()
|
||||
})
|
||||
|
||||
return request.make_response(body, [
|
||||
('Content-Type', 'application/xml;charset=utf-8')
|
||||
])
|
||||
|
||||
response.headers['Content-Type'] = 'application/xml;charset=utf-8'
|
||||
return response
|
||||
|
||||
class Images(http.Controller):
|
||||
def placeholder(self, response):
|
||||
|
||||
@@ -20,8 +20,7 @@ from openerp.osv import orm, osv, fields
|
||||
from openerp.tools.safe_eval import safe_eval
|
||||
|
||||
from openerp.addons.web import http
|
||||
from openerp.addons.web.http import request
|
||||
|
||||
from openerp.addons.web.http import request, LazyResponse
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -157,7 +156,7 @@ class website(osv.osv):
|
||||
'translatable': not is_public_user and not is_master_lang and request.multilang,
|
||||
})
|
||||
|
||||
def render(self, cr, uid, ids, template, values=None, context=None):
|
||||
def _render(self, cr, uid, ids, template, values=None, context=None):
|
||||
view = self.pool.get("ir.ui.view")
|
||||
IMD = self.pool.get("ir.model.data")
|
||||
user = self.pool.get("res.users")
|
||||
@@ -221,6 +220,13 @@ class website(osv.osv):
|
||||
return self.error(cr, uid, 500 if qweb_context['editable'] else 404,
|
||||
qweb_context, context=context)
|
||||
|
||||
def render(self, cr, uid, ids, template, values=None, context=None):
|
||||
def callback(template, values, context):
|
||||
return self._render(cr, uid, ids, template, values, context)
|
||||
if values is None:
|
||||
values = {}
|
||||
return LazyResponse(callback, template=template, values=values, context=context)
|
||||
|
||||
def error(self, cr, uid, code, qweb_context, context=None):
|
||||
View = request.registry['ir.ui.view']
|
||||
return werkzeug.wrappers.Response(
|
||||
@@ -478,7 +484,7 @@ class website(osv.osv):
|
||||
object_ids = model_obj.search(cr, uid, domain, limit=step, offset=offset, order=orderby)
|
||||
object_ids = model_obj.browse(cr, uid, object_ids)
|
||||
for object_id in object_ids:
|
||||
html += request.website.render(template, {'object_id': object_id})
|
||||
html += request.website._render(template, {'object_id': object_id})
|
||||
return html
|
||||
|
||||
def get_menu(self, cr, uid, ids, context=None):
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
function beginDrag () {
|
||||
$('.popover.tour').remove();
|
||||
function goToNextStep () {
|
||||
$('#oe_snippets').hide();
|
||||
$('#snippets').toggle();
|
||||
self.movetoStep('edit-title');
|
||||
$body.off('mouseup', goToNextStep);
|
||||
}
|
||||
|
||||
@@ -68,14 +68,48 @@
|
||||
content: "You just created a new blog post. We are now going to edit it.",
|
||||
template: render('website.tour_popover', { next: "OK" }),
|
||||
},
|
||||
{
|
||||
stepId: 'post-title',
|
||||
element: 'h1[data-oe-expression="blog_post.name"]',
|
||||
placement: 'top',
|
||||
title: "Pick a title",
|
||||
content: "Choose a catchy title for your blog post.",
|
||||
template: render('website.tour_popover', { next: "OK" }),
|
||||
},
|
||||
{
|
||||
stepId: 'add-block',
|
||||
element: 'button[data-action=snippet]',
|
||||
placement: 'bottom',
|
||||
reflex: true,
|
||||
title: "Layout your blog post",
|
||||
content: "Insert blocks like text-image to layout the body of your blog post.",
|
||||
template: render('website.tour_popover'),
|
||||
onShow: function () {
|
||||
$('button[data-action=snippet]').click(function () {
|
||||
self.movetoStep('drag-image-text');
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
stepId: 'drag-image-text',
|
||||
element: '#website-top-navbar [data-snippet-id=image-text].ui-draggable',
|
||||
placement: 'bottom',
|
||||
title: "Drag & Drop a block",
|
||||
content: "Drag the 'Image Text' block and drop it in your page.",
|
||||
template: render('website.tour_popover'),
|
||||
onShow: function () {
|
||||
var $body = $(document.body);
|
||||
function beginDrag () {
|
||||
$('.popover.tour').remove();
|
||||
function goToNextStep () {
|
||||
$('#snippets').toggle();
|
||||
self.stop();
|
||||
$body.off('mouseup', goToNextStep);
|
||||
}
|
||||
$body.off('mousedown', beginDrag);
|
||||
$body.on('mouseup', goToNextStep);
|
||||
}
|
||||
$body.on('mousedown', beginDrag);
|
||||
},
|
||||
},
|
||||
];
|
||||
return this._super();
|
||||
|
||||
Reference in New Issue
Block a user