[REM] : archive related changes
-> remove routes related to date on blog method bzr revid: aja@tinyerp.com-20140328112008-8mhxvqxs8g1ui2mn
This commit is contained in:
@@ -38,8 +38,7 @@ class WebsiteBlog(http.Controller):
|
||||
groups = blog_post_obj.read_group(request.cr, request.uid, [], ['name', 'create_date'],
|
||||
groupby="create_date", orderby="create_date asc", context=request.context)
|
||||
for group in groups:
|
||||
group['date_begin'] = str(datetime.date(datetime.strptime(group['__domain'][0][2], tools.DEFAULT_SERVER_DATETIME_FORMAT)))
|
||||
group['date_end'] = str(datetime.date(datetime.strptime( group['__domain'][1][2], tools.DEFAULT_SERVER_DATETIME_FORMAT)))
|
||||
group['date'] = "%s_%s" % (group['__domain'][0][2], group['__domain'][1][2])
|
||||
return groups
|
||||
|
||||
@http.route([
|
||||
@@ -68,12 +67,8 @@ class WebsiteBlog(http.Controller):
|
||||
'/blog/<model("blog.blog"):blog>/page/<int:page>',
|
||||
'/blog/<model("blog.blog"):blog>/tag/<model("blog.tag"):tag>',
|
||||
'/blog/<model("blog.blog"):blog>/tag/<model("blog.tag"):tag>/page/<int:page>',
|
||||
'/blog/<model("blog.blog"):blog>/date/<string(length=10):date_begin>/<string(length=10):date_end>',
|
||||
'/blog/<model("blog.blog"):blog>/date/<string(length=10):date_begin>/<string(length=10):date_end>/page/<int:page>',
|
||||
'/blog/<model("blog.blog"):blog>/tag/<model("blog.tag"):tag>/date/<string(length=10):date_begin>/<string(length=10):date_end>',
|
||||
'/blog/<model("blog.blog"):blog>/tag/<model("blog.tag"):tag>/date/<string(length=10):date_begin>/<string(length=10):date_end>/page/<int:page>',
|
||||
], type='http', auth="public", website=True, multilang=True)
|
||||
def blog(self, blog=None, tag=None, date_begin=None,date_end=None, page=1, **opt):
|
||||
def blog(self, blog=None, tag=None, date=None, page=1, **opt):
|
||||
""" Prepare all values to display the blog.
|
||||
|
||||
:param blog: blog currently browsed.
|
||||
@@ -107,9 +102,9 @@ class WebsiteBlog(http.Controller):
|
||||
if tag:
|
||||
path_filter += 'tag/%s' % tag.id
|
||||
domain += [("tag_ids", "in", [tag.id])]
|
||||
if date_begin and date_end:
|
||||
path_filter += "date/%s/%s" % (date_begin,date_end)
|
||||
domain += [("create_date", ">=", date_begin), ("create_date", "<=", date_end)]
|
||||
if date:
|
||||
path_filter += "date/%s" % date
|
||||
domain += [("create_date", ">=", date.split("_")[0]), ("create_date", "<=", date.split("_")[1])]
|
||||
|
||||
blog_post_count = blog_post_obj.search(cr, uid, domain, count=True, context=context)
|
||||
pager = request.website.pager(
|
||||
@@ -135,7 +130,7 @@ class WebsiteBlog(http.Controller):
|
||||
'pager': pager,
|
||||
'nav_list': self.nav_list(),
|
||||
'path_filter': path_filter,
|
||||
'date': date_begin,
|
||||
'date': date,
|
||||
}
|
||||
response = request.website.render("website_blog.blog_post_short", values)
|
||||
return response
|
||||
|
||||
@@ -345,8 +345,8 @@
|
||||
<h4>Archives</h4>
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
<t t-foreach="nav_list" t-as="months">
|
||||
<li t-att-class="months['date_begin'] == date and 'active' or None">
|
||||
<a t-ignore="True" t-attf-href="/blog/#{ slug(blog) }/#{ tag and 'tag/%s/' % slug(tag) or '' }date/#{ months['date_begin'] }/#{ months['date_end'] }"><t t-esc="months['create_date']"/><span class="pull-right badge" t-esc="months['create_date_count']"/></a>
|
||||
<li t-att-class="months['date'] == date and 'active' or None">
|
||||
<a t-ignore="True" t-attf-href="/blog/#{ slug(blog) }/#{ tag and 'tag/%s/' % slug(tag) or '' }date/#{ months['date'] }"><t t-esc="months['create_date']"/><span class="pull-right badge" t-esc="months['create_date_count']"/></a>
|
||||
</li>
|
||||
</t>
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user