[MERGE] Merge parents
bzr revid: rim@openerp.com-20131031140616-ihguwmmlqemmpyqy
This commit is contained in:
commit
8d0813adb0
|
@ -159,7 +159,8 @@ class WebsiteBlog(http.Controller):
|
|||
|
||||
return request.website.render("website_blog.index", values)
|
||||
|
||||
@website.route(['/blog/nav'], type='http', auth="public")
|
||||
# TODO: Refactor (used in website_blog.js for archive links)
|
||||
@website.route(['/blog/nav'], type='http', auth="public", multilang=True)
|
||||
def nav(self, **post):
|
||||
cr, uid, context = request.cr, request.uid, request.context
|
||||
blog_post_ids = request.registry['blog.post'].search(
|
||||
|
@ -171,9 +172,10 @@ class WebsiteBlog(http.Controller):
|
|||
blog_post_data = [
|
||||
{
|
||||
'id': blog_post.id,
|
||||
'name': blog_post.name,
|
||||
'website_published': blog_post.website_published,
|
||||
'category_id': blog_post.category_id and blog_post.category_id.id or False,
|
||||
'fragment': request.website.render("website_blog.blog_archive_link", {
|
||||
'blog_post': blog_post
|
||||
}),
|
||||
}
|
||||
for blog_post in request.registry['blog.post'].browse(cr, uid, blog_post_ids, context=context)
|
||||
]
|
||||
|
|
|
@ -8,15 +8,14 @@ $(document).ready(function () {
|
|||
e.preventDefault();
|
||||
var $ul = $(this).next("ul");
|
||||
if (!$ul.find('li').length) {
|
||||
// TODO: Why POST? A GET would be more appropriate...
|
||||
// This should be done server side anyway...
|
||||
$.post('/blog/nav', {'domain': $(this).data("domain")}, function (result) {
|
||||
var blog_id = +window.location.pathname.split("/").pop();
|
||||
$(JSON.parse(result)).each(function () {
|
||||
var $a = $('<a href="/blog/' + this.id + '"/>').text(this.name);
|
||||
var $li = $("<li/>").append($a);
|
||||
if (blog_id == this.id)
|
||||
$li.addClass("active");
|
||||
if (!this.website_published)
|
||||
$a.css("color", "red");
|
||||
var $li = $($.parseHTML(this.fragment));
|
||||
if (blog_id == this.id) $li.addClass("active");
|
||||
if (!this.website_published) $li.find('a').css("color", "red");
|
||||
$ul.append($li);
|
||||
});
|
||||
|
||||
|
@ -38,4 +37,4 @@ $(document).ready(function () {
|
|||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
|
@ -311,5 +311,11 @@
|
|||
</xpath>
|
||||
</template>
|
||||
|
||||
<template id="blog_archive_link">
|
||||
<li>
|
||||
<a t-href="/blog/#{blog_post.id}"><t t-esc="blog_post.name"/></a>
|
||||
</li>
|
||||
</template>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue