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