[IMP] website_blog: display list of tags on Right Column

bzr revid: chm@openerp.com-20131118150510-1cqewicjy0ibt2yg
This commit is contained in:
Christophe Matthieu 2013-11-18 16:05:10 +01:00
parent b88236393d
commit e5c2cd23fc
2 changed files with 27 additions and 0 deletions

View File

@ -133,9 +133,14 @@ class WebsiteBlog(http.Controller):
pager_end = page * self._category_post_per_page
blog_posts = blog_posts[pager_begin:pager_end]
tag_obj = request.registry['blog.tag']
tag_ids = tag_obj.search(cr, uid, [], context=context)
tags = tag_obj.browse(cr, uid, tag_ids, context=context)
values = {
'category': category,
'categories': categories,
'tags': tags,
'tag': tag,
'blog_posts': blog_posts,
'pager': pager,
@ -191,9 +196,14 @@ class WebsiteBlog(http.Controller):
category_ids = category_obj.search(cr, uid, [], context=context)
categories = category_obj.browse(cr, uid, category_ids, context=context)
tag_obj = request.registry['blog.tag']
tag_ids = tag_obj.search(cr, uid, [], context=context)
tags = tag_obj.browse(cr, uid, tag_ids, context=context)
values = {
'category': blog_post.category_id,
'categories': categories,
'tags': tags,
'tag': tag and request.registry['blog.tag'].browse(cr, uid, int(tag), context=context) or None,
'blog_post': blog_post,
'pager': pager,

View File

@ -282,6 +282,23 @@
</t>
</template>
<!-- Option: Right Column: tags -->
<template id="opt_blog_rc_tags" name="Tags"
inherit_option_id="website_blog.index" inherit_id="website_blog.index">
<xpath expr="//div[@id='blog_right_column']" position="inside">
<section class="mt32">
<h4>Tags</h4>
<ul class="nav nav-pills nav-stacked">
<t t-foreach="tags" t-as="tag_id">
<li t-att-class="tag and tag_id.id == tag.id and 'active' or None" style="display: inline-block;">
<a t-href="/blog/cat/#{ category.id }/tag/#{ tag_id.id }"><span t-field="tag_id.name"/></a>
</li>
</t>
</ul>
</section>
</xpath>
</template>
<!-- Option: Right Column: archives -->
<template id="opt_blog_rc_history" name="Archives"
inherit_option_id="website_blog.index" inherit_id="website_blog.index">