[ADD] website_forum: adding the 'Newest' filter on the forum to sort by create date

This commit is contained in:
Martin Trigaux
2014-05-15 11:23:11 +02:00
parent f0c1eb1786
commit a2edf9520b
2 changed files with 8 additions and 2 deletions
+4 -2
View File
@@ -112,9 +112,11 @@ class WebsiteForum(http.Controller):
order = 'child_count desc'
elif sorting == 'vote':
order = 'vote_count desc'
else:
sorting = 'date'
elif sorting == 'date':
order = 'write_date desc'
else:
sorting = 'creation'
order = 'create_date desc'
question_count = Post.search(cr, uid, domain, count=True, context=context)
if tag:
@@ -229,6 +229,7 @@
<t t-if="filters == 'followed'">Followed</t>
<t t-if="tag"><span t-field="tag.name"/></t>
<t t-if="sorting == 'date'"> by activity date</t>
<t t-if="sorting == 'creation'"> by creation date</t>
<t t-if="sorting == 'answered'"> by most answered</t>
<t t-if="sorting == 'vote'"> by most voted</t>
<b class="caret"/>
@@ -252,6 +253,9 @@
<li t-att-class="sorting == 'date' and 'active' or '' ">
<a t-att-href="url_for('') + '?' + keep_query( 'search', 'filters', sorting='date')">Last activity date</a>
</li>
<li t-att-class="sorting == 'creation' and 'active' or '' ">
<a t-att-href="url_for('') + '?' + keep_query( 'search', 'filters', sorting='creation')">Newest</a>
</li>
<li t-att-class="sorting == 'answered' and 'active' or '' ">
<a t-att-href="url_for('') + '?' + keep_query( 'search', 'filters', sorting='answered')">Most answered</a>
</li>