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