[imp]:improve user vote tab
bzr revid: sunilsharma.sharma07@gmail.com-20140318111229-70nqzgul8d4y21e0
This commit is contained in:
parent
d6223f2c9d
commit
8615272b2c
|
@ -161,6 +161,9 @@ class website_forum(http.Controller):
|
|||
|
||||
question_ids = Post.search(cr, uid, [('forum_id', '=', forum.id), ('create_uid', '=', user.id), ('parent_id', '=', False)], context=context)
|
||||
user_questions = Post.browse(cr, uid, question_ids, context=context)
|
||||
|
||||
post_votes = Vote.search(cr, uid, [('user_id', '=', uid)], context=context)
|
||||
vote_ids = Vote.browse(cr, uid, post_votes, context=context)
|
||||
|
||||
#showing questions in which user answered
|
||||
obj_ids = Post.search(cr, uid, [('forum_id', '=', forum.id), ('create_uid', '=', user.id), ('parent_id', '!=', False)], context=context)
|
||||
|
@ -196,7 +199,8 @@ class website_forum(http.Controller):
|
|||
'up_votes': up_votes,
|
||||
'down_votes': down_votes,
|
||||
'activities': activities,
|
||||
'posts': posts
|
||||
'posts': posts,
|
||||
'vote_post':vote_ids,
|
||||
}
|
||||
return request.website.render("website_forum.user_detail_full", values)
|
||||
|
||||
|
|
|
@ -649,6 +649,9 @@
|
|||
<li>
|
||||
<a href="#followed_question" data-toggle="tab">Followed Question</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#votes" data-toggle="tab">Votes</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content mt16">
|
||||
<div class="tab-pane active" id="questions">
|
||||
|
@ -669,6 +672,9 @@
|
|||
<div class="tab-pane" id="followed_question">
|
||||
<h1>Followed Questions</h1>
|
||||
</div>
|
||||
<div class="tab-pane" id="votes">
|
||||
<t t-call="website_forum.user_votes" />
|
||||
</div>
|
||||
<div class="tab-pane" id="activity">
|
||||
<ul class="list-unstyled">
|
||||
<li t-foreach="activities" t-as="activity">
|
||||
|
@ -707,5 +713,18 @@
|
|||
</div>
|
||||
</template>
|
||||
|
||||
<template id="user_votes">
|
||||
<div t-foreach="vote_post" t-as="vote">
|
||||
<t t-esc="vote.post_id.create_date"/>
|
||||
<span t-if="vote.vote == '1'" class="fa fa-thumbs-up text-success" style="margin-left:30px"/>
|
||||
<span t-if="vote.vote == '-1'" class="fa fa-thumbs-down text-warning" style="margin-left:30px"/>
|
||||
<t t-if="vote.post_id.parent_id">
|
||||
<a t-attf-href="/forum/#{ slug(forum) }/question/#{ vote.post_id.parent_id.id }/#answer-#{ vote.post_id.id }" t-esc="vote.post_id.parent_id.name" style="margin-left:10px"/>
|
||||
</t>
|
||||
<t t-if="not vote.post_id.parent_id">
|
||||
<a t-attf-href="/forum/#{ slug(forum) }/question/#{ vote.post_id.id }" style=" color:black;margin-left:10px" t-esc="vote.post_id.name"/>
|
||||
</t>
|
||||
</div>
|
||||
</template>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue