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