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