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