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