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