[FIX] website_forum: fixed last merge done a bit quickly: addd can_answer functional...
authorThibault Delavallée <tde@openerp.com>
Tue, 1 Jul 2014 11:43:16 +0000 (13:43 +0200)
committerThibault Delavallée <tde@openerp.com>
Tue, 1 Jul 2014 12:07:53 +0000 (14:07 +0200)
addons/website_forum/models/forum.py
addons/website_forum/views/website_forum.xml

index 900eb4e..43d10c5 100644 (file)
@@ -278,6 +278,7 @@ class Post(osv.Model):
         'closed_date': fields.datetime('Closed on', readonly=True),
         # karma
         'karma_ask': fields.function(_get_post_karma_rights, string='Karma to ask', type='integer', multi='_get_post_karma_rights'),
+        'karma_answer': fields.function(_get_post_karma_rights, string='Karma to answer', type='integer', multi='_get_post_karma_rights'),
         'karma_accept': fields.function(_get_post_karma_rights, string='Karma to accept this answer', type='integer', multi='_get_post_karma_rights'),
         'karma_edit': fields.function(_get_post_karma_rights, string='Karma to edit', type='integer', multi='_get_post_karma_rights'),
         'karma_close': fields.function(_get_post_karma_rights, string='Karma to close', type='integer', multi='_get_post_karma_rights'),
@@ -288,6 +289,7 @@ class Post(osv.Model):
         'karma_comment_convert': fields.function(_get_post_karma_rights, string='karma to convert as a comment', type='integer', multi='_get_post_karma_rights'),
         # access rights
         'can_ask': fields.function(_get_post_karma_rights, string='Can Ask', type='boolean', multi='_get_post_karma_rights'),
+        'can_answer': fields.function(_get_post_karma_rights, string='Can Answer', type='boolean', multi='_get_post_karma_rights'),
         'can_accept': fields.function(_get_post_karma_rights, string='Can Accept', type='boolean', multi='_get_post_karma_rights'),
         'can_edit': fields.function(_get_post_karma_rights, string='Can Edit', type='boolean', multi='_get_post_karma_rights'),
         'can_close': fields.function(_get_post_karma_rights, string='Can Close', type='boolean', multi='_get_post_karma_rights'),
index 73fcbef..15a1314 100644 (file)
                                 </a>
                             </li>
                             <li>
-                                <a t-attf-class="fa fa-edit #{not answer.can_edit and 'karma_required text-muted' or ''}"
-                                    t-attf-data-karma="#{not answer.can_edit and answer.karma_edit or 0}"
-                                    t-attf-href="/forum/#{slug(forum)}/post/#{slug(answer)}/edit"> Edit</a>
+                                <t t-call="website_forum.link_button">
+                                    <t t-set="url" t-value="'/forum/' + slug(forum) + '/post/' + slug(answer) + '/edit'"/>
+                                    <t t-set="label" t-value="'Edit'"/>
+                                    <t t-set="classes" t-value="'fa fa-edit'"/>
+                                    <t t-set="karma" t-value="not answer.can_edit and answer.karma_edit or 0"/>
+                                </t>
                             </li>
                             <li>
                                 <t t-call="website_forum.link_button">