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