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