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