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