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