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