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