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