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