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