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