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