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