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