[FIX] website_forum: respect karma when posting questions/answers/comments + more...
[odoo/odoo.git] / addons / website_forum / views / website_forum.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <openerp>
3     <data>
4
5 <!-- Layout add nav and footer -->
6 <template id="header_footer_custom" inherit_id="website.footer_default"
7     name="Footer Questions Link">
8     <xpath expr="//ul[@id='products']" position="inside">
9         <li><a t-attf-href="/forum/%(website_forum.forum_help)d">Q&amp;A</a></li>
10         <li><a href="/forum">Forums</a></li>
11     </xpath>
12 </template>
13
14 <!-- helper -->
15 <template id="link_button">
16     <form method="POST" t-att-action="url">
17         <button t-attf-class="fa btn-link #{classes} #{karma and 'karma_required text-muted' or ''}" t-attf-data-karma="#{karma}">
18             <t t-esc="label"/></button>
19     </form>
20 </template>
21
22 <template id="assets_frontend" inherit_id="website.assets_frontend" name="website_forum assets">
23     <xpath expr="." position="inside">
24         <link rel='stylesheet' href="/web/static/lib/jquery.textext/jquery.textext.css"/>
25         <link rel='stylesheet' href='/website_forum/static/src/css/website_forum.css'/>
26         <script type="text/javascript" src="/website_forum/static/src/js/website_forum.js"/>
27         <script type="text/javascript" src="/web/static/lib/jquery.textext/jquery.textext.js"/>
28     </xpath>
29 </template>
30
31 <template id="assets_editor" inherit_id="website.assets_editor" name="Forum Editor" groups="base.group_user">
32     <xpath expr="." position="inside">
33         <script type="text/javascript" src="/website_forum/static/src/js/website.tour.forum.js"/>
34         <script type="text/javascript" src="/website_forum/static/src/js/website_forum.editor.js"/>
35     </xpath>
36 </template>
37
38 <!-- Page Index -->
39 <template id="header" name="Forum Index">
40     <t t-call="website.layout">
41         <t t-set="head">
42             <script type="text/javascript" src="/web/static/lib/ckeditor/ckeditor.js"/>
43             <script type="text/javascript">
44                 CKEDITOR.config.toolbar = [['Bold','Italic','Underline','Strike'],['NumberedList','BulletedList', 'Blockquote']
45                 ,['Outdent','Indent','Link','Unlink','Image'],] ;
46             </script>
47         </t>
48         <div class="container mt16 website_forum">
49             <div class="navbar navbar-default">
50                 <div class="navbar-header">
51                     <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#oe-help-navbar-collapse">
52                         <span class="sr-only">Toggle navigation</span>
53                         <span class="icon-bar"></span>
54                         <!-- <span class="icon-bar"></span> -->
55                         <span class="icon-bar"></span>
56                     </button>
57                     <a class="navbar-brand" t-attf-href="/forum/#{slug(forum)}">
58                         <span t-field="forum.name"/>
59                     </a>
60                 </div>
61                 <div class="collapse navbar-collapse" id="oe-help-navbar-collapse">
62                     <ul class="nav navbar-nav">
63                         <li t-att-class="filters in ('all', 'unanswered','followed','question','tag') and 'active' or '' ">
64                             <a t-attf-href="/forum/#{ slug(forum) }">Questions</a>
65                         </li>
66                         <li t-att-class="searches.get('users') and 'active' or '' ">
67                             <a t-attf-href="/forum/#{ slug(forum) }/users">People</a>
68                         </li>
69                         <li t-att-class="searches.get('tags') and 'active' or '' ">
70                             <a t-attf-href="/forum/#{ slug(forum) }/tag">Tags</a>
71                         </li>
72                         <li t-att-class="searches.get('badges') and 'active' or '' ">
73                             <a t-attf-href="/forum/#{ slug(forum) }/badge">Badges</a>
74                         </li>
75                         <li t-if="not is_public_user" t-att-class="searches.get('my_profile') and 'active' or '' ">
76                             <a t-attf-href="/forum/#{ slug(forum) }/user/#{uid}">My Profile</a>
77                         </li>
78                     </ul>
79                     <form class="navbar-form navbar-right" role="search" t-attf-action="/forum/#{ slug(forum) }" method="get">
80                         <div class="form-group">
81                             <input type="search" class="form-control"
82                                 name="search" placeholder="Search a question..."
83                                 t-att-value="search or ''"/>
84                             <button type="submit" class="btn btn-default">Search</button>
85                         </div>
86                     </form>
87                 </div>
88             </div>
89         </div>
90
91         <div id="wrap" class="container">
92             <div class="row">
93                 <div class="col-sm-9">
94                     <div t-foreach="notifications or []" t-as="notification" class="alert alert-success alert-dismissable">
95                         <button type="button" class="close notification_close" t-att-id="notification.id" data-dismiss="alert" aria-hidden="true">&amp;times;</button>
96                         <div t-field="notification.body"/>
97                         <a t-attf-href="/forum/#{ slug(forum) }/user/#{ user.id }#badges" class="fa fa-arrow-right">View Your Badges</a>
98                     </div>
99                     <t t-raw="0"/>
100                 </div>
101                 <div class="col-sm-3" id="right-column">
102                     <a t-if="not header.get('ask_hide')"
103                        t-attf-class="btn btn-primary btn-lg btn-block mb16 #{user.karma &gt;= forum.karma_ask and '' or 'karma_required'}"
104                        t-attf-href="/forum/#{slug(forum)}/ask"
105                        t-attf-data-karma="#{forum.karma_ask}">Ask a Question</a>
106                     <div class="panel panel-default">
107                         <div class="panel-heading">
108                             <h3 class="panel-title">Keep Informed</h3>
109                         </div>
110                         <div class="panel-body">
111                             <t t-call="website_mail.follow">
112                                 <t t-set="email" t-value="user.email"/>
113                                 <t t-set="object" t-value="forum"/>
114                             </t>
115                         </div>
116                     </div>
117                     <div class="panel panel-default" id="about_forum">
118                         <div class="panel-heading">
119                             <h3 class="panel-title">About This Forum</h3>
120                         </div>
121                         <div class="panel-body">
122                             <t t-raw="forum.description"/>
123                             <a t-if="not header.get('is_guidelines')" t-attf-href="/forum/#{slug(forum)}/faq" class="fa fa-arrow-right"> Read Guidelines</a>
124                             <a t-if="header.get('is_guidelines')" t-attf-href="/forum/#{slug(forum)}" class="fa fa-arrow-right"> Back to <span t-field="forum.name"/></a>
125                         </div>
126                     </div>
127                     <div t-if="header.get('question_data')">
128                         <div class="panel panel-default">
129                             <div class="panel-heading text-center">
130                                 <h3 class="panel-title">Question tools</h3>
131                             </div>
132                             <div class="panel-body text-center">
133                                 <t t-call="website_mail.follow"><t t-set="object" t-value="question"/></t>
134                                 <div class="mt8">
135                                     <strong><t t-raw="len(question.message_follower_ids)"/></strong> follower(s)
136                                 </div>
137                             </div>
138                             <div class="panel-heading text-center">
139                                 <h3 class="panel-title ">Stats</h3>
140                             </div>
141                             <div class="panel-body">
142                                 <table class="table">
143                                     <thead><tr><td> Asked: <strong><span t-field="question.create_date" t-field-options='{"format":"short"}'/></strong></td></tr></thead>
144                                     <tr><td> Seen: <strong><t t-raw="question.views"/></strong>
145                                         <span t-if="question.views&gt;1">times</span>
146                                         <span t-if="question.views&lt;=1">time</span>
147                                     </td></tr>
148                                     <tr><td> Last updated: <strong><span t-field="question.write_date" t-field-options='{"format":"short"}'/></strong></td></tr>
149                                 </table>
150                             </div>
151                         </div>
152                     </div>
153                 </div>
154             </div>
155         </div>
156         <div class="oe_structure"/>
157     </t>
158 </template>
159
160 <!-- Display a post -->
161 <template id="display_post">
162     <div class="question row">
163         <div class="col-md-2 hidden-xs text-center">
164             <div t-attf-class="box #{question.is_correct and 'oe_green' or 'oe_grey'} #{(question.child_count == 0) and 'text-muted' or ''}">
165                 <span t-esc="question.child_count"/>
166                 <div t-if="question.child_count&gt;1" class="subtitle">Answers</div>
167                 <div t-if="question.child_count&lt;=1" class="subtitle">Answer</div>
168             </div>
169         </div>
170         <div class="col-md-10 clearfix">
171             <div class="question-name">
172                 <a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(question) }" t-field="question.name"/>
173                     <span t-if="not question.active"><b> [Deleted]</b></span>
174                     <span t-if="question.state == 'close'"><b> [Closed]</b></span>
175             </div>
176             <t t-foreach="question.tag_ids" t-as="question_tag">
177                 <a t-attf-href="/forum/#{ slug(forum) }/tag/#{slug(question_tag)}/questions">
178                     <span t-attf-class="pull-right badge #{tag and tag.name == question_tag.name and 'badge-active' ''}" t-field="question_tag.name"
179                         style="margin-right: 4px;"/>
180                 </a>
181             </t>
182             <div class="text-muted">
183                 by <a t-attf-href="/forum/#{ slug(forum) }/user/#{ question.create_uid.id }"
184                     t-field="question.create_uid" t-field-options='{"widget": "contact", "country_image": true, "fields": ["name", "country_id"]}'
185                     style="display: inline-block;"/>
186                 on <span t-field="question.write_date" t-field-options='{"format":"short"}'/>
187                 <span class="visible-xs">
188                     <b t-esc="question.child_count or 0"/>
189                     <t t-if="question.child_count&gt;1">answers</t>
190                     <t t-if="question.child_count==1">answers</t>
191                 </span>
192                 with <b t-field="question.views"/> views
193                 <span t-if="question.vote_count&gt;0"> and
194                     <b t-esc="question.vote_count or 0"/>
195                     <t t-if="question.vote_count&gt;1">votes</t>
196                     <t t-if="question.vote_count==1">vote</t>
197                 </span>
198             </div>
199         </div>
200     </div>
201 </template>
202
203 <!-- Display a post as an answer -->
204 <template id="display_post_answer">
205     <div class="clearfix">
206         <div t-attf-class="pull-left text-center mb16 box #{len(answer.vote_ids) and 'oe_green' or 'oe_grey'}">
207             <div t-esc="len(answer.vote_ids)"/>
208         </div>
209         <div class="question-name" style="margin-left: 32px;">
210             <a style="font-size: 15px;" t-attf-href="/forum/#{ slug(forum) }/question/#{ answer.parent_id.id }/#answer-#{ answer.id }" t-esc="answer.parent_id.name"/>
211             <t t-if="len(answer.website_message_ids)&gt;0">
212                 (<t t-esc="len(answer.website_message_ids)"/>
213                 <t t-if="len(answer.website_message_ids)&gt;1">Comments</t>
214                 <t t-if="len(answer.website_message_ids)&lt;=1">Comment</t>)
215             </t>
216         </div>
217     </div>
218 </template>
219
220 <!-- FAQ Layout -->
221 <template id="faq">
222     <t t-call="website_forum.header">
223         <div t-field="forum.faq"/>
224     </t>
225 </template>
226
227 <!-- All Forums Layout -->
228 <template id="forum_all">
229     <t t-call="website.layout">
230         <div class="container">
231             <h1 class="mb32">Our forums</h1>
232             <div class="row">
233                 <div t-foreach="forums" t-as="forum" class="col-sm-3 text-center mb32">
234                     <a t-attf-href="/forum/#{ slug(forum) }">
235                         <div class="fa fa-5x fa-comment mb16"/>
236                         <div t-field="forum.name"/>
237                     </a>
238                 </div>
239             </div>
240         </div>
241     </t>
242 </template>
243
244 <!-- Specific Forum Layout -->
245 <template id="forum_index" name="Forum">
246     <t t-call="website_forum.header">
247         <h1 class="page-header mt0">
248             <t t-esc="question_count"/> <span>Questions</span>
249             <t t-esc="search"/>
250             <small class="dropdown" t-if="filters in ('all', 'unanswered','followed', 'tag')">
251               <a href="#" class="dropdown-toggle" data-toggle="dropdown">
252                   <t t-if="filters == 'all'">All</t>
253                   <t t-if="filters == 'unanswered'">Unanswered</t>
254                   <t t-if="filters == 'followed'">Followed</t>
255                   <t t-if="tag"><span t-field="tag.name"/></t>
256                   <t t-if="sorting == 'date'"> by activity date</t>
257                   <t t-if="sorting == 'creation'"> by creation date</t>
258                   <t t-if="sorting == 'answered'"> by most answered</t>
259                   <t t-if="sorting == 'vote'"> by most voted</t>
260                   <b class="caret"/>
261               </a>
262               <ul class="dropdown-menu">
263                   <li class="dropdown-header">Filter on</li>
264                   <li t-att-class="filters == 'all' and 'active' or '' ">
265                       <a t-att-href="url_for('') + '?' + keep_query( 'search', 'sorting', filters='all')">All</a>
266                   </li>
267                   <li t-att-class="filters == 'unanswered' and 'active' or '' ">
268                       <a t-att-href="url_for('') + '?' + keep_query( 'search', 'sorting', filters='unanswered')">Unanswered</a>
269                   </li>
270                   <li t-if="uid" t-att-class="filters == 'followed' and 'active' or '' ">
271                       <a t-att-href="url_for('') + '?' + keep_query( 'search', 'sorting', filters='followed')">Followed</a>
272                   </li>
273                   <li class="dropdown-header">Tags</li>
274                   <li t-if="tag" t-att-class="tag and 'active' or '' ">
275                       <a href=""><t t-esc="tag.name"/></a>
276                   </li>
277                   <li class="dropdown-header">Sort by</li>
278                   <li t-att-class="sorting == 'date' and 'active' or '' ">
279                       <a t-att-href="url_for('') + '?' + keep_query( 'search', 'filters', sorting='date')">Last activity date</a>
280                   </li>
281                   <li t-att-class="sorting == 'creation' and 'active' or '' ">
282                       <a t-att-href="url_for('') + '?' + keep_query( 'search', 'filters', sorting='creation')">Newest</a>
283                   </li>
284                   <li t-att-class="sorting == 'answered' and 'active' or '' ">
285                       <a t-att-href="url_for('') + '?' + keep_query( 'search', 'filters', sorting='answered')">Most answered</a>
286                   </li>
287                   <li t-att-class="sorting == 'vote' and 'active' or '' ">
288                       <a t-att-href="url_for('') + '?' + keep_query( 'search', 'filters', sorting='vote')">Most voted</a>
289                   </li>
290               </ul>
291             </small>
292         </h1>
293         <div t-foreach="question_ids" t-as="question" class="mb16">
294             <t t-call="website_forum.display_post"/>
295         </div>
296         <t t-call="website.pager"/>
297     </t>
298 </template>
299
300 <template id="404">
301     <t t-call="website_forum.header">
302         <div class="oe_structure oe_empty"/>
303         <h1 class="mt32">Question not found!</h1>
304         <p>Sorry, this question is not available anymore.</p>
305         <p>
306             <a t-attf-href="/forum">Return to the question list.</a>
307         </p>
308     </t>
309 </template>
310
311 <!-- Edition: ask your question -->
312 <template id="ask_question">
313     <t t-call="website_forum.header">
314         <h1 class="mt0">Ask your Question</h1>
315         <ul>
316             <li> please, try to make your question interesting to others </li>
317             <li> provide enough details and, if possible, give an example </li>
318             <li> be clear and concise, avoid unnecessary introductions (Hi, ... Thanks...) </li>
319         </ul>
320         <form t-attf-action="/forum/#{ slug(forum) }/question/new" method="post" role="form" class="tag_text">
321             <input type="text" name="question_name" required="True" t-attf-value="#{question_name}"
322                 class="form-control" placeholder="Enter your Question"/>
323             <h5 class="mt20">Please enter a descriptive question (should finish with a '?')</h5>
324             <input type="hidden" name="karma" t-attf-value="#{user.karma}" id="karma"/>
325             <textarea name="content" required="True" class="form-control load_editor">
326                 <t t-esc="question_content"/>
327             </textarea>
328             <br/>
329             <input type="text" name="question_tags" placeholder="Tags" class="form-control load_tags"/>
330             <br/>
331             <button t-attf-class="btn btn-primary #{(user.karma &lt;= forum.karma_ask) and 'karma_required' or ''}"
332                 id="btn_ask_your_question" t-att-data-karma="forum.karma_ask">Post Your Question</button>
333         </form>
334         <script type="text/javascript">
335             CKEDITOR.replace("content");
336         </script>
337     </t>
338 </template>
339
340 <!-- Edition: edit a post -->
341 <template id="edit_post">
342     <t t-call="website_forum.header">
343         <h3 t-if="not is_answer">Edit question</h3>
344         <h3 t-if="is_answer">Edit answer</h3>
345         <form t-attf-action="/forum/#{slug(forum)}/post/#{slug(post)}/save" method="post" role="form" class="tag_text">
346             <div t-if="not is_answer">
347                 <input type="text" name="question_name" id="question_name" required="True"
348                     t-attf-value="#{post.name}" class="form-control" placeholder="Edit your Question"/>
349                 <h5 class="mt20">Please enter a descriptive question (should finish by a '?')</h5>
350             </div>
351             <input type="hidden" name="karma" t-attf-value="#{user.karma}" id="karma"/>
352             <textarea name="content" required="True" class="form-control load_editor">
353                 <t t-esc="post.content"/>
354             </textarea>
355             <div t-if="not is_answer">
356                 <br/>
357                 <input type="text" name="question_tag" class="form-control col-md-9 load_tags" placeholder="Tags" t-attf-value="#{tags}"/>
358                 <br/>
359             </div>
360             <button class="btn btn-primary btn-lg">Save</button>
361         </form>
362         <script type="text/javascript">
363             CKEDITOR.replace("content");
364         </script>
365     </t>
366 </template>
367
368 <!-- Moderation: close a question -->
369 <template id="close_question">
370     <t t-call="website_forum.header">
371         <h1 class="mt0">Close question</h1>
372         <p class="text-muted">
373             If you close this question, it will be hidden for most users. Only
374             users having a high karma can see closed questions to moderate
375             them.
376         </p>
377         <form t-attf-action="/forum/#{ slug(forum) }/question/#{slug(question)}/close" method="post" role="form" class="form-horizontal mt32 mb64">
378             <input name="post_id" t-att-value="question.id" type="hidden"/>
379             <div class="form-group">
380                 <label class="col-md-3 control-label" for="reason">Question:</label>
381                 <div class="col-md-8 mt8">
382                     <span t-field="question.name"/>
383                 </div>
384             </div>
385             <div class="form-group">
386                 <label class="col-md-3 control-label" for="reason">Reason:</label>
387                 <div class="col-md-8">
388                     <select class="form-control" name="reason_id">
389                         <t t-foreach="reasons or []" t-as="reason">
390                             <option t-att-value="reason.id" t-att-selected="reason.id == question.closed_reason_id.id"><t t-esc="reason.name"/></option>
391                         </t>
392                     </select>
393                 </div>
394             </div>
395             <div class="form-group">
396                 <div class="col-md-offset-3 col-md-8">
397                     <button class="btn btn-primary">Close question</button>
398                     <span class="text-muted">or</span>
399                     <a class="btn btn-link" t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(question) }">back to question</a>
400                 </div>
401             </div>
402         </form>
403     </t>
404 </template>
405
406 <!-- Edition: post an answer -->
407 <template id="post_answer">
408     <h3 class="mt10">Your answer</h3>
409     <p>
410         <b>Please try to give a substantial answer.</b> If you wanted to comment on the question or answer, just
411         <b>use the commenting tool.</b> Please remember that you can always <b>revise your answers</b>
412         - no need to answer the same question twice. Also, please <b>don't forget to vote</b>
413         - it really helps to select the best questions and answers!
414     </p>
415     <form t-attf-action="/forum/#{ slug(forum) }/post/#{slug(question)}/new" method="post" role="form">
416         <input type="hidden" name="karma" t-attf-value="#{user.karma}" id="karma"/>
417         <textarea name="content" class="form-control load_editor" required="True"/>
418         <button t-attf-class="btn btn-primary mt16 #{not question.can_answer and 'karma_required' or ''}"
419                 id="btn_ask_your_question" t-att-data-karma="question.karma_answer">Post Your Answer</button>
420     </form>
421     <script type="text/javascript">
422         CKEDITOR.replace("content");
423     </script>
424 </template>
425
426 <template id="vote">
427     <div t-attf-class="box oe_grey">
428         <a t-attf-class="vote_up fa fa-thumbs-up no-decoration #{post.user_vote == 1 and 'text-success' or ''} #{((post.user_vote == 1 and not post.can_downvote) or not post.can_upvote) and 'karma_required' or ''}"
429             t-attf-data-karma="#{post.user_vote == 1 and post.karma_downvote or post.karma_upvote}"
430             t-attf-data-href="/forum/#{slug(post.forum_id)}/post/#{slug(post)}/upvote"/>
431         <span id="vote_count" t-esc="post.vote_count"/>
432         <a t-attf-class="vote_down fa fa-thumbs-down no-decoration #{post.user_vote == -1 and 'text-warning' or ''} #{((post.user_vote == -1 and not post.can_upvote) or not post.can_downvote) and 'karma_required' or ''}"
433             t-attf-data-karma="#{post.user_vote == -1 and post.karma_upvote or post.karma_downvote}"
434             t-attf-data-href="/forum/#{slug(post.forum_id)}/post/#{slug(post)}/downvote"/>
435         <div t-if="vote_count &gt; 1" class="subtitle">
436             votes
437         </div>
438         <div t-if="vote_count &lt; 2" class="subtitle">
439             vote
440         </div>
441     </div>
442 </template>
443
444 <!-- Specific Post Layout -->
445 <template id="post_description_full" name="Question Navigation">
446     <t t-call="website_forum.header">
447         <div t-attf-class="row question #{not question.active and 'alert alert-danger' or ''}">
448             <div class="col-md-2 hidden-xs text-center">
449                 <t t-call="website_forum.vote">
450                     <t t-set="post" t-value="question"/>
451                 </t>
452                 <div class="text-muted text-center">
453                     <span t-field="question.views"/> Views
454                 </div>
455                 <div class="mt4">
456                     <a t-attf-data-href="/forum/#{slug(question.forum_id)}/question/#{slug(question)}/toggle_favourite"
457                         t-attf-class="favourite_question no-decoration fa fa-2x fa-star #{question.user_favourite and 'forum_favourite_question' or ''}"/>
458                 </div>
459             </div>
460             <div class="col-md-10">
461                 <h1 class="mt0">
462                     <a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(question) }" t-field="question.name"/>
463                     <span t-if="not question.active"><b> [Deleted]</b></span>
464                     <span t-if="question.state == 'close'"><b> [Closed]</b></span>
465                 </h1>
466                 <div class="alert alert-info text-center" t-if="question.state == 'close'">
467                     <p class="mt16">
468                         <b>The question has been closed<t t-if="question.closed_reason_id"> for reason: <i t-esc="question.closed_reason_id.name"/></t></b>
469                     </p>
470                     <t t-if="question.closed_uid">
471                         <b>by <a t-attf-href="/forum/#{ slug(forum) }/user/#{ question.closed_uid.id }"
472                             t-field="question.closed_uid"
473                             t-field-options='{"widget": "contact", "fields": ["name"]}'
474                             style="display: inline-block;"/></b>
475                     </t>
476                     <b>on <span t-field="question.closed_date"/></b>
477                     <div class="mt16 mb24 text-center">
478                         <t t-call="website_forum.link_button">
479                             <t t-set="url" t-value="'/forum/' + slug(forum) + '/question/' + slug(question) + '/reopen'"/>
480                             <t t-set="label" t-value="'Reopen'"/>
481                             <t t-set="classes" t-value="'fa-arrow-right'"/>
482                             <t t-set="karma" t-value="not question.can_close and question.karma_close or 0"/>
483                         </t>
484                     </div>
485                 </div>
486                 <t t-raw="question.content"/>
487                 <div class="mt16 clearfix">
488                     <div class="pull-right">
489                         <div class="text-right">
490                             <t t-foreach="question.tag_ids" t-as="tag">
491                                 <a t-attf-href="/forum/#{ slug(forum) }/tag/#{ tag.id }/questions" class="badge" t-field="tag.name"/>
492                             </t>
493                         </div>
494                         <ul class="list-inline" id="options">
495                             <li>
496                                 <a style="cursor: pointer" t-att-data-toggle="question.can_comment and 'collapse' or ''"
497                                     t-attf-class="fa fa-comment-o #{not question.can_comment and 'karma_required text-muted' or ''}"
498                                     t-attf-data-karma="#{not question.can_comment and question.karma_comment or 0}"
499                                     t-attf-data-target="#comment#{ question._name.replace('.','') + '-' + str(question.id) }">
500                                     Comment
501                                 </a>
502                             </li>
503                             <li t-if="question.state != 'close'">
504                                 <t t-call="website_forum.link_button">
505                                     <t t-set="url" t-value="'/forum/' + slug(forum) +'/question/' + slug(question) + '/ask_for_close'"/>
506                                     <t t-set="label" t-value="'Close'"/>
507                                     <t t-set="classes" t-value="'fa-times'"/>
508                                     <t t-set="karma" t-value="not question.can_close and question.karma_close or 0"/>
509                                 </t>
510                             </li>
511                             <li t-if="question.state == 'close'">
512                                 <t t-call="website_forum.link_button">
513                                     <t t-set="url" t-value="'/forum/' + slug(forum) +'/question/' + slug(question) + '/reopen'"/>
514                                     <t t-set="label" t-value="'Reopen'"/>
515                                     <t t-set="classes" t-value="'fa-undo'"/>
516                                     <t t-set="karma" t-value="not question.can_close and question.karma_close or 0"/>
517                                 </t>
518                             </li>
519                             <li>
520                                 <t t-call="website_forum.link_button">
521                                     <t t-set="url" t-value="'/forum/' + slug(forum) +'/post/' + slug(question) + '/edit'"/>
522                                     <t t-set="label" t-value="'Edit'"/>
523                                     <t t-set="classes" t-value="'fa-edit'"/>
524                                     <t t-set="karma" t-value="not question.can_edit and question.karma_edit or 0"/>
525                                 </t>
526                             </li>
527                             <li t-if="question.active">
528                                 <t t-call="website_forum.link_button">
529                                     <t t-set="url" t-value="'/forum/' + slug(forum) +'/question/' + slug(question) + '/delete'"/>
530                                     <t t-set="label" t-value="'Delete'"/>
531                                     <t t-set="classes" t-value="'fa-trash-o'"/>
532                                     <t t-set="karma" t-value="not question.can_unlink and question.karma_unlink or 0"/>
533                                 </t>
534                             </li>
535                             <li t-if="not question.active">
536                                 <t t-call="website_forum.link_button">
537                                     <t t-set="url" t-value="'/forum/' + slug(forum) +'/question/' + slug(question) + '/undelete'"/>
538                                     <t t-set="label" t-value="'Undelete'"/>
539                                     <t t-set="classes" t-value="'fa-trash-o'"/>
540                                     <t t-set="karma" t-value="not question.can_unlink and question.karma_unlink or 0"/>
541                                 </t>
542                             </li>
543                         </ul>
544                     </div>
545                     <div>
546                         <img class="pull-left img img-circle img-avatar" t-attf-src="/forum/user/#{question.create_uid.id}/avatar"/>
547                         <div>
548                             <a t-attf-href="/forum/#{ slug(forum) }/user/#{ question.create_uid.id }"
549                                 t-field="question.create_uid"
550                                 t-field-options='{"widget": "contact", "country_image": true, "fields": ["name", "country_id"]}'
551                                 style="display: inline-block;"/>
552                             <div t-field="question.create_uid" t-field-options='{"widget": "contact", "badges": true, "fields": ["karma"]}'/>
553                             <span class="text-muted">Asked on <span t-field="question.create_date" t-field-options='{"format":"short"}'/></span>
554                         </div>
555                     </div>
556                     <div class="visible-xs text-center">
557                         <t t-call="website_forum.vote">
558                             <t t-set="post" t-value="question"/>
559                         </t>
560                         <div class="text-muted text-center">
561                             <span t-field="question.views"/> Views
562                         </div>
563                         <div class="mt4">
564                             <a t-attf-data-href="/forum/#{slug(question.forum_id)}/question/#{slug(question)}/toggle_favourite"
565                                 t-attf-class="favourite_question no-decoration fa fa-2x fa-star #{question.user_favourite and 'forum_favourite_question' or ''}"/>
566                         </div>
567                     </div>
568                 </div>
569                 <t t-call="website_forum.post_comment">
570                     <t t-set="object" t-value="question"/>
571                 </t>
572             </div>
573         </div>
574         <hr/>
575
576         <div t-foreach="question.child_ids" t-as="answer" class="mt16 mb32">
577             <a t-attf-id="answer-#{str(answer.id)}"/>
578             <div t-attf-class="forum_answer row" t-attf-id="answer_#{answer.id}" >
579                 <div class="col-md-2 hidden-xs text-center">
580                     <t t-call="website_forum.vote">
581                         <t t-set="post" t-value="answer"/>
582                     </t>
583                     <div class="text-muted mt8">
584                         <a t-attf-class="accept_answer fa fa-2x fa-check-circle no-decoration #{answer.is_correct and 'oe_answer_true' or 'oe_answer_false'} #{not answer.can_accept and 'karma_required' or ''}"
585                             t-attf-data-karma="#{answer.karma_accept}"
586                             t-attf-data-href="/forum/#{slug(question.forum_id)}/post/#{slug(answer)}/toggle_correct"/>
587                     </div>
588                 </div>
589                 <div class="col-md-10 clearfix">
590                     <t t-raw="answer.content"/>
591                     <div class="mt16">
592                         <ul class="list-inline pull-right">
593                             <li>
594                                 <a t-attf-class="fa fa-comment-o #{not answer.can_comment and 'karma_required text-muted' or ''}"
595                                     t-attf-data-karma="#{not answer.can_comment and answer.karma_comment or 0}"
596                                     style="cursor: pointer" t-att-data-toggle="answer.can_comment and 'collapse' or ''"
597                                     t-attf-data-target="#comment#{ answer._name.replace('.','') + '-' + str(answer.id) }"> Comment
598                                 </a>
599                             </li>
600                             <li>
601                                 <t t-call="website_forum.link_button">
602                                     <t t-set="url" t-value="'/forum/' + slug(forum) + '/post/' + slug(answer) + '/edit'"/>
603                                     <t t-set="label" t-value="'Edit'"/>
604                                     <t t-set="classes" t-value="'fa fa-edit'"/>
605                                     <t t-set="karma" t-value="not answer.can_edit and answer.karma_edit or 0"/>
606                                 </t>
607                             </li>
608                             <li>
609                                 <t t-call="website_forum.link_button">
610                                     <t t-set="url" t-value="'/forum/' + slug(forum) + '/post/' + slug(answer) + '/delete'"/>
611                                     <t t-set="label" t-value="'Delete'"/>
612                                     <t t-set="classes" t-value="'fa-trash-o'"/>
613                                     <t t-set="karma" t-value="not answer.can_unlink and answer.karma_unlink or 0"/>
614                                 </t>
615                             </li>
616                             <li>
617                                 <t t-call="website_forum.link_button">
618                                     <t t-set="url" t-value="'/forum/' + slug(forum) + '/post/' + slug(answer) + '/convert_to_comment'"/>
619                                     <t t-set="label" t-value="'Convert as a comment'"/>
620                                     <t t-set="classes" t-value="'fa-magic'"/>
621                                     <t t-set="karma" t-value="not answer.can_comment_convert and answer.karma_comment_convert or 0"/>
622                                 </t>
623                             </li>
624                         </ul>
625                         <img class="pull-left img img-circle img-avatar" t-attf-src="/forum/user/#{answer.create_uid.id}/avatar"/>
626                         <div>
627                             <a t-attf-href="/forum/#{ slug(forum) }/user/#{ answer.create_uid.id }"
628                                 t-field="answer.create_uid"
629                                 t-field-options='{"widget": "contact", "country_image": true, "fields": ["name", "country_id"]}'
630                                 style="display: inline-block;"/>
631                             <div t-field="answer.create_uid" t-field-options='{"widget": "contact", "badges": true, "fields": ["karma"]}'/>
632                             <span class="text-muted">Answered on <span t-field="answer.create_date" t-field-options='{"format":"short"}'/></span>
633                         </div>
634                         <div class="visible-xs text-center">
635                             <t t-call="website_forum.vote">
636                                 <t t-set="post" t-value="answer"/>
637                             </t>
638                             <div class="text-muted mt8">
639                                 <a t-attf-class="accept_answer fa fa-2x fa-check-circle no-decoration #{answer.is_correct and 'oe_answer_true' or 'oe_answer_false'} #{not answer.can_accept and 'karma_required' or ''}"
640                                     t-attf-data-karma="#{answer.karma_accept}"
641                                     t-attf-data-href="/forum/#{slug(question.forum_id)}/post/#{slug(answer)}/toggle_correct"/>
642                             </div>
643                         </div>
644                     </div>
645                     <t t-call="website_forum.post_comment">
646                         <t t-set="object" t-value="answer"/>
647                     </t>
648                 </div>
649             </div>
650         </div>
651         <div t-if="not question.uid_has_answered">
652             <t t-call="website_forum.post_answer"/>
653         </div>
654         <div t-if="question.uid_has_answered" class="mb16">
655             <a class="btn btn-primary" t-attf-href="/forum/#{slug(forum)}/question/#{slug(question)}/edit_answer">Edit Your Previous Answer</a>
656             <span class="text-muted">(only one answer per question is allowed)</span>
657         </div>
658     </t>
659 </template>
660
661 <!-- Utility template: Post a Comment -->
662 <template id="post_comment">
663     <div class="row clearfix">
664         <div class="col-sm-10 col-sm-offset-2">
665             <div t-foreach="reversed(object.website_message_ids)" t-as="message" class="comment oe_comment_grey">
666                 <small class="text-muted">
667                     <t t-set="required_karma" t-value="message.author_id.id == user.partner_id.id and object.forum_id.karma_comment_unlink_own or object.forum_id.karma_comment_unlink_all"/>
668                     <t t-call="website_forum.link_button">
669                         <t t-set="url" t-value="'/forum/' + slug(forum) + '/post/' + slug(object) + '/comment/' + slug(message) + '/delete'"/>
670                         <t t-set="label" t-value="' '"/>
671                         <t t-set="karma" t-value="user.karma&lt;required_karma and required_karma or 0"/>
672                         <t t-set="classes" t-value="'close comment_delete fa-times'"/>
673                     </t>
674
675                     <span t-field="message.body"/>
676                     <t t-set="required_karma" t-value="message.author_id.id == user.partner_id.id and object.forum_id.karma_comment_convert_own or object.forum_id.karma_comment_convert_all"/>
677                     <t t-call="website_forum.link_button">
678                         <t t-set="url" t-value="'/forum/' + slug(forum) + '/post/' + slug(object) + '/comment/' + slug(message) + '/convert_to_answer'"/>
679                         <t t-set="label" t-value="'Convert as an answer'"/>
680                         <t t-set="karma" t-value="user.karma&lt;required_karma and required_karma or 0"/>
681                         <t t-set="classes" t-value="'fa-magic pull-right'"/>
682                     </t>
683                     <a t-attf-href="/forum/#{slug(forum)}/partner/#{message.author_id.id}"
684                         t-field="message.author_id" t-field-options='{"widget": "contact", "country_image": true, "fields": ["name", "country_id"]}'
685                         style="display: inline-block;"/>
686                     on <span t-field="message.date" t-field-options='{"format":"short"}'/>
687                 </small>
688             </div>
689             <div class="css_editable_mode_hidden">
690                 <form t-attf-id="comment#{ object._name.replace('.','') + '-' + str(object.id) }" class="collapse oe_comment_grey"
691                         t-attf-action="/forum/#{slug(forum)}/post/#{slug(object)}/comment" method="POST">
692                     <input name="post_id" t-att-value="object.id" type="hidden" class="mt8"/>
693                     <textarea name="comment" class="form-control" placeholder="Comment this post..."/>
694                     <button type="submit" class="btn btn-primary mt8">Post</button>
695                 </form>
696             </div>
697         </div>
698     </div>
699 </template>
700
701 <template id="tag">
702     <t t-call="website_forum.header">
703         <h1 class="mt0">
704             Tags
705         </h1>
706         <p class="text-muted">
707             A tag is a label that categorizes your question with other,
708             similar questions. Using the right tags makes it easier for
709             others to find and answer your question.
710         </p>
711         <div class="row">
712             <div class="col-sm-3 mt16" t-foreach="tags" t-as="tag">
713                 <a t-attf-href="/forum/#{ slug(forum) }/tag/#{ slug(tag) }/questions?{{ keep_query( filters='tag') }}" class="badge">
714                     <span t-field="tag.name"/>
715                 </a>
716                 <span>
717                     X <t t-esc="tag.posts_count"/>
718                 </span>
719             </div>
720         </div>
721     </t>
722 </template>
723
724 <template id="badge">
725     <t t-call="website_forum.header">
726         <h1 class="mt0">
727             Badges
728         </h1>
729         <p>
730             Besides gaining reputation with your questions and answers,
731             you receive badges for being especially helpful. Badges
732             appear on your profile page, and your posts.
733         </p>
734         <table class="table mt32 mb64">
735             <tr t-foreach="badges" t-as="badge">
736                 <td>
737                     <a t-attf-href="/forum/#{ slug(forum) }/badge/#{ slug(badge) }" class="badge pull-left">
738                         <span t-if="badge.level == 'gold'" class="fa fa-circle badge-gold"/>
739                         <span t-if="badge.level == 'silver'" class="fa fa-circle badge-silver"/>
740                         <span t-if="badge.level == 'bronze'" class="fa fa-circle badge-bronze"/>
741                         <span t-field="badge.name"/>
742                     </a>
743                 </td><td>
744                     <b t-esc="badge.stat_count_distinct"/>
745                     <i class="text-muted">awarded users</i>
746                 </td><td>
747                     <span t-field="badge.description"/>
748                 </td>
749             </tr>
750         </table>
751     </t>
752 </template>
753
754 <template id="badge_user">
755     <t t-call="website_forum.header">
756         <h3 class="mt32 mb32">
757             <b>Badge "<span t-field="badge.name"/>"</b>
758         </h3>
759         <div>
760             <div class="pull-left badge">
761                 <span t-if="badge.level == 'gold'" class="fa fa-circle badge-gold"/>
762                 <span t-if="badge.level == 'silver'" class="fa fa-circle badge-silver"/>
763                 <span t-if="badge.level == 'bronze'" class="fa fa-circle badge-bronze"/>
764                 <span t-field="badge.name"/>
765             </div>
766             <span t-field="badge.description" style="margin-left:20px"/>
767         </div>
768         <h4 class="mt32">
769             <t class="pull-left" t-esc="badge.stat_count_distinct"/>
770             <span t-if="badge.stat_count_distinct&gt;1">users</span>
771             <span t-if="badge.stat_count_distinct&lt;=1">user</span>
772             received this badge:
773         </h4>
774         <div class="row">
775             <div class="col-sm-3 mt16" t-foreach="users" t-as="user">
776                 <img class="pull-left img img-circle img-avatar" t-attf-src="/forum/user/#{user.id}/avatar"/>
777                 <div>
778                     <a t-attf-href="/forum/#{slug(forum)}/user/#{user.id}" t-field="user.name"/>
779                 </div>
780             </div>
781         </div>
782     </t>
783 </template>
784
785 <template id="users">
786     <t t-call="website_forum.header">
787         <div t-foreach="users" t-as="row_users" class="row mt16">
788             <div t-foreach="row_users" t-as="user" class="col-sm-4">
789                 <img class="pull-left img img-circle img-avatar" t-attf-src="/forum/user/#{user.id}/avatar"/>
790                 <div>
791                     <a t-attf-href="/forum/#{slug(forum)}/user/#{user.id}" t-field="user.name"/>
792                     <t t-if="user.country_id">
793                         <span t-field="user.country_id.image" t-field-options='{"widget": "image", "class": "country_flag"}'/>
794                     </t>
795                     <b><t t-esc="user.karma"/></b>
796                     <t t-raw="separator"/>
797                     <div>
798                         <b> badges:</b>
799                         <span class="fa fa-circle badge-gold"/>
800                         <t t-esc="user.gold_badge"/>
801                         <span class="fa fa-circle badge-silver"/>
802                         <t t-esc="user.silver_badge"/>
803                         <span class="fa fa-circle badge-bronze"/>
804                         <t t-esc="user.bronze_badge"/>
805                     </div>
806                     <t t-raw="0"/>
807                 </div>
808             </div>
809         </div>
810         <div class="pull-left">
811             <t t-call="website.pager"/>
812         </div>
813     </t>
814 </template>
815
816 <!--Private profile-->
817 <template id="private_profile">
818     <t t-call="website_forum.header">
819         <h1 class="mt32">This profile is private!</h1>
820         <p>
821             <a t-attf-href="/forum/#{slug(forum)}">Return to the question list.</a>
822         </p>
823     </t>
824 </template>
825
826 <template id="edit_profile">
827     <t t-call="website_forum.header">
828         <h3>Edit Profile</h3>
829         <div class="row">
830             <div class="col-md-2">
831                 <img class="img img-responsive img-circle" t-attf-src="/forum/user/#{user.id}/avatar"/>
832             </div>
833             <div class="col-md-10">
834             <form t-attf-action="/forum/#{slug(forum)}/user/#{slug(user)}/save" method="post" role="form" class="form-horizontal">
835                 <input name="user_id" t-att-value="user.id" type="hidden"/>
836                 <div class="form-group">
837                     <label class="col-md-2 control-label mb16" for="user_name">Real name</label>
838                     <div class="col-md-8 mb16">
839                         <input type="text" class="form-control" name="name" id="user_name" required="True" t-attf-value="#{user.name}"/>
840                     </div>
841                 </div>
842                 <div class="form-group">
843                     <label class="col-md-2 control-label mb16" for="user_website_published" t-if="user.id == uid">Public profile</label>
844                     <div class="col-md-8 mb16" t-if="user.id == uid">
845                         <input type="checkbox" class="mt8" name="website_published" id="user_website_published" value="True" t-if="not user.website_published"/>
846                         <input type="checkbox" class="mt8" name="website_published" id="user_website_published" value="True" checked="checked" t-if="user.website_published"/>
847                     </div>
848                 </div>
849                 <div class="form-group">
850                     <label class="col-md-2 control-label mb16" for="user_website">Website</label>
851                     <div class="col-md-8 mb16">
852                         <input type="text" class="form-control" name="website" id="user_website" t-attf-value="#{user.partner_id.website or ''}"/>
853                     </div>
854                 </div>
855                 <div class="form-group">
856                     <div t-if="email_required" class="alert alert-danger alert-dismissable oe_forum_email_required">
857                         <button type="button" class="close" data-dismiss="alert">x</button>
858                         <p>Please enter a valid email address in order to receive notifications from answers or comments.</p>
859                     </div>
860                     <label class="col-md-2 control-label mb16" for="user_email">Email</label>
861                     <div class="col-md-8 mb16">
862                         <input type="text" class="form-control" name="email" id="user_email" required="True" t-attf-value="#{user.partner_id.email}"/>
863                     </div>
864                 </div>
865                 <div class="form-group">
866                     <label class="col-md-2 control-label mb16" for="user_city">City</label>
867                     <div class="col-md-8 mb16">
868                         <input type="text" class="form-control" name="city" id="user_city" t-attf-value="#{user.partner_id.city or ''}"/>
869                     </div>
870                 </div>
871                 <div class="form-group">
872                     <label class="col-md-2 control-label mb16">Country</label>
873                     <div class="col-md-8 mb16">
874                         <select class="form-control" name="country">
875                             <option value="">Country...</option>
876                             <t t-foreach="countries or []" t-as="country">
877                                 <option t-att-value="country.id" t-att-selected="country.id == user.partner_id.country_id.id"><t t-esc="country.name"/></option>
878                             </t>
879                          </select>
880                     </div>
881                 </div>
882                 <!--Note: using website_description fiels instead of using commnt firld of partner-->
883                 <div class="form-group">
884                     <label class="col-md-2 control-label mb16" for="description">Biography</label>
885                     <div class="col-md-8 mb16">
886                         <textarea name="description" id="description" style="min-height: 120px" required="True" 
887                             class="form-control load_editor"><t t-esc="user.partner_id.website_description"/></textarea>
888                     </div>
889                 </div>
890                 <div class="col-sm-offset-2 col-md-2 mb16">
891                     <button class="btn btn-primary btn-lg">Update</button>
892                 </div>
893             </form>
894             </div>
895         </div>
896         <script type="text/javascript">
897             CKEDITOR.replace("description");
898         </script>
899     </t>
900 </template>
901
902 <template id="user_detail_full">
903     <t t-call="website_forum.header">
904         <h1 class="mt0 page-header">
905             <span t-field="user.name"/>
906             <small>profile</small>
907             <t t-call="website.publish_management" groups="base.group_website_publisher">
908                 <t t-set="object" t-value="user"/>
909             </t>
910         </h1>
911         <div class="row">
912             <div class="col-sm-2">
913                 <img class="img img-responsive img-circle" t-attf-src="/forum/user/#{user.id}/avatar"/>
914             </div>
915             <div class="col-sm-10">
916                 <table class="table table-condensed">
917                 <tr>
918                     <td rowspan="2" valign="top"><span class="text-muted">contributions</span></td>
919                     <td>member since</td>
920                     <td><span t-field="user.create_date" t-field-options='{"format": "short"}'/></td>
921                 </tr><tr>
922                     <td>last connection</td>
923                     <td><span t-field="user.login_date" t-field-options='{"format": "short"}'/></td>
924                 </tr>
925                 <tr>
926                     <td rowspan="2" valign="top"><span class="text-muted">bio</span></td>
927                     <td>website</td>
928                     <td>
929                         <a t-att-href="user.website" t-if="user.website">
930                             <span t-field="user.website"/>
931                         </a>
932                     </td>
933                 </tr><tr>
934                     <td>location</td>
935                     <td>
936                         <span t-field="user.city"/>
937                         <span t-if="user.city and user.country_id">, </span>
938                         <span t-field="user.country_id"/>
939                         <t t-if="user.country_id"> <span t-field="user.country_id.image" t-field-options='{"widget": "image", "class": "country_flag"}'/></t>
940
941                     </td>
942                 </tr>
943                 <tr>
944                     <td rowspan="2" valign="top"><span class="text-muted">stats</span></td>
945                     <td>karma</td>
946                     <td><span t-field="user.karma"/></td>
947                 </tr><tr>
948                     <td>votes</td>
949                     <td>
950                         <span class="fa fa-thumbs-up"/>
951                         <span t-esc="up_votes"/>
952                         <span class="fa fa-thumbs-down"/>
953                         <span t-esc="down_votes"/>
954                     </td>
955                 </tr>
956                 </table>
957                 <div class="well well-sm">
958                     <span t-field="user.partner_id.website_description" class="oe_no_empty"/>
959                     <t t-if="uid == user.id">
960                         <a class="fa fa-arrow-right" t-attf-href="/forum/#{slug(forum)}/user/#{slug(user)}/edit"> Edit Your Bio</a>
961                     </t>
962                 </div>
963             </div>
964         </div>
965
966         <ul class="nav nav-tabs">
967             <li class="active">
968                 <a href="#questions" data-toggle="tab"><t t-esc="count_questions"/> Questions</a>
969             </li>
970             <li>
971                 <a href="#answers" data-toggle="tab"><t t-esc="count_answers"/> Answers</a>
972             </li>
973             <li t-if="uid == user.id">
974                 <a href="#favourite_question" data-toggle="tab"><t t-esc="len(favourite)"/> Favourite Questions</a>
975             </li>
976             <li t-if="uid == user.id">
977                 <a href="#followed_question" data-toggle="tab"><t t-esc="len(followed)"/> Followed Questions</a>
978             </li>
979             <li t-if="uid == user.id">
980                 <a href="#activity" data-toggle="tab">Activity</a>
981             </li>
982             <li>
983                 <a href="#badges" data-toggle="tab">Badges</a>
984             </li>
985             <li t-if="uid == user.id">
986                 <a href="#votes" data-toggle="tab">Votes</a>
987             </li>
988         </ul>
989         <div class="tab-content mt16">
990             <div class="tab-pane active" id="questions">
991                 <div class="mb16" t-foreach="questions" t-as="question">
992                     <t t-call="website_forum.display_post"/>
993                 </div>
994             </div><div class="tab-pane" id="answers">
995                 <div t-foreach="answers" t-as="answer">
996                     <t t-call="website_forum.display_post_answer"/>
997                 </div>
998             </div>
999             <div class="tab-pane" id="karma">
1000                 <h1>Karma</h1>
1001             </div>
1002             <div class="tab-pane" id="badges">
1003                 <t t-call="website_forum.user_badges"/>
1004             </div>
1005             <div class="tab-pane" id="favourite_question" t-if="uid == user.id">
1006                 <div t-foreach="favourite" t-as="question">
1007                     <t t-call="website_forum.display_post"/>
1008                 </div>
1009             </div>
1010             <div class="tab-pane" id="followed_question" t-if="uid == user.id">
1011                 <div t-foreach="followed" t-as="question" class="mb16">
1012                     <t t-call="website_forum.display_post"/>
1013                 </div>
1014             </div>
1015             <div class="tab-pane" id="votes" t-if="uid == user.id">
1016                 <t t-call="website_forum.user_votes"/>
1017             </div>
1018             <div class="tab-pane" id="activity" t-if="uid == user.id">
1019                 <ul class="list-unstyled">
1020                     <li t-foreach="activities" t-as="activity">
1021                         <span t-field="activity.date" t-field-options='{"format": "short"}'/>
1022                         <span t-esc="activity.subtype_id.name" class="label label-info"/>
1023                         <t t-set="post" t-value="posts[activity.res_id]"/>
1024                         <span t-if="post[1]">
1025                             <a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(post[0]) }#answer-#{ str(post[1].id) }">
1026                                 <span t-esc="post[0].name"/>
1027                             </a>
1028                         </span>
1029                         <span t-if="not post[1]">
1030                             <a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(post[0]) }">
1031                                 <span t-esc="post[0].name"/>
1032                             </a>
1033                         </span>
1034                     </li>
1035                 </ul>
1036             </div>
1037         </div>
1038     </t>
1039 </template>
1040
1041 <template id="user_badges">
1042     <table class="table mt32 mb64">
1043         <tr t-foreach="user.badge_ids" t-as="badge">
1044             <td>
1045                 <a t-attf-href="/forum/#{ slug(forum) }/badge/#{ slug(badge.badge_id) }" class="badge pull-left">
1046                     <span t-if="badge.badge_id.level == 'gold'" class="fa fa-circle badge-gold"/>
1047                     <span t-if="badge.badge_id.level == 'silver'" class="fa fa-circle badge-silver"/>
1048                     <span t-if="badge.badge_id.level == 'bronze'" class="fa fa-circle badge-bronze"/>
1049                     <span t-field="badge.badge_id.name"/>
1050                 </a>
1051             </td><td>
1052                 <b t-esc="badge.badge_id.stat_count_distinct"/>
1053                 <i class="text-muted">awarded users</i>
1054             </td><td>
1055                 <span t-field="badge.badge_id.description"/>
1056             </td>
1057         </tr>
1058     </table>
1059     <div class="mb16" t-if="not user.badge_ids">
1060         <b>No badge yet!</b><br/>
1061         <a t-attf-href="/forum/#{ slug(forum) }/badge" class="fa fa-arrow-right"> Check available badges</a>
1062     </div>
1063 </template>
1064
1065 <template id="user_votes">
1066     <div t-foreach="vote_post" t-as="vote">
1067         <t t-esc="vote.post_id.create_date"/>
1068         <span t-if="vote.vote == '1'" class="fa fa-thumbs-up text-success" style="margin-left:30px"/>
1069         <span t-if="vote.vote == '-1'" class="fa fa-thumbs-down text-warning" style="margin-left:30px"/>
1070         <t t-if="vote.post_id.parent_id">
1071             <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"/>
1072         </t>
1073         <t t-if="not vote.post_id.parent_id">
1074             <a t-attf-href="/forum/#{ slug(forum) }/question/#{ vote.post_id.id }" style=" color:black;margin-left:10px" t-esc="vote.post_id.name"/>
1075         </t>
1076     </div>
1077     <div class="mb16" t-if="not vote_post">
1078         <b>No vote given by you yet!</b>
1079     </div>
1080 </template>
1081
1082 <!-- User Navbar -->
1083 <template id="content_new_forum" inherit_id="website.user_navbar" groups="base.group_user">
1084     <xpath expr="//ul[@id='oe_systray']/li/ul[@class='dropdown-menu oe_content_menu']" position="inside">
1085         <li><a href="#" data-action="new_forum">New Forum</a></li>
1086     </xpath>
1087 </template>
1088
1089     </data>
1090 </openerp>