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