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