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