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