[FIX] website_forum: more fixes :

- display tag name in 'filter' bar when filtering on a tag
- display active tag in a blue color
- order answers: correct first, then most upvoted

bzr revid: tde@openerp.com-20140506123001-fz5gt6i9zw6ondcu
This commit is contained in:
Thibault Delavallée 2014-05-06 14:30:01 +02:00
parent 55479a4cc2
commit 69ec02b2d4
4 changed files with 12 additions and 3 deletions

View File

@ -70,6 +70,7 @@ class Post(osv.Model):
_name = 'forum.post'
_description = 'Forum Post'
_inherit = ['mail.thread', 'website.seo.metadata']
_order = "is_correct DESC, vote_count DESC"
def _get_user_vote(self, cr, uid, ids, field_name, arg, context):
res = dict.fromkeys(ids, 0)

View File

@ -21,6 +21,9 @@
background-color: #cccccc;
margin-left: 4px;
}
.question .badge-active {
background-color: #428bca;
}
.oe_grey {
background-color: #eeeeee;

View File

@ -17,6 +17,8 @@
.badge
background-color: #ccc
margin-left: 4px
.badge-active
background-color: #428bca
.oe_grey
background-color: #eeeeee

View File

@ -145,8 +145,11 @@
<span t-if="not question.active"><b> [Deleted]</b></span>
<span t-if="question.state == 'close'"><b> [Closed]</b></span>
</div>
<t t-foreach="question.tag_ids" t-as="tag">
<a t-attf-href="/forum/#{ slug(forum) }/tag/#{ tag.id }/questions" class="badge pull-right" t-field="tag.name"/>
<t t-foreach="question.tag_ids" t-as="question_tag">
<a t-attf-href="/forum/#{ slug(forum) }/tag/#{slug(question_tag)}/questions">
<span t-attf-class="pull-right badge #{tag and tag.name == question_tag.name and 'badge-active' ''}" t-field="question_tag.name"
style="margin-right: 4px;"/>
</a>
</t>
<div class="text-muted">
by <a t-attf-href="/forum/#{ slug(forum) }/user/#{ question.create_uid.id }"
@ -216,7 +219,7 @@
<t t-if="filters == 'all'">All</t>
<t t-if="filters == 'unanswered'">Unanswered</t>
<t t-if="filters == 'followed'">Followed</t>
<t t-if="filters == 'tag'">Tag</t>
<t t-if="tag"><span t-field="tag.name"/></t>
<t t-if="sorting == 'date'"> by activity date</t>
<t t-if="sorting == 'answered'"> by most answered</t>
<t t-if="sorting == 'vote'"> by most voted</t>