[FIX] website_forum: fixed comment unlink action :
authorThibault Delavallée <tde@openerp.com>
Wed, 27 Aug 2014 08:57:29 +0000 (10:57 +0200)
committerThibault Delavallée <tde@openerp.com>
Wed, 27 Aug 2014 09:41:51 +0000 (11:41 +0200)
- fixed call to a wrong method
- fixed button display, now based on the standard way of managing karma (popup when
not having the required karma)
- fixed button display karma computation
- some css tweaking for this button

addons/website_forum/controllers/main.py
addons/website_forum/static/src/css/website_forum.css
addons/website_forum/static/src/css/website_forum.sass
addons/website_forum/views/website_forum.xml

index a3a9b58..d68ade3 100644 (file)
@@ -596,4 +596,4 @@ class WebsiteForum(http.Controller):
     def delete_comment(self, forum, post, comment, **kwarg):
         if not request.session.uid:
             return {'error': 'anonymous_user'}
-        return request.registry['forum.post'].unlink(request.cr, request.uid, post.id, comment.id, context=request.context)
+        return request.registry['forum.post'].unlink_comment(request.cr, request.uid, post.id, comment.id, context=request.context)
index 27d5247..1e85705 100644 (file)
@@ -90,6 +90,10 @@ a.no-decoration {
   padding: 4px;
 }
 
+.close.comment_delete {
+  font-size: 16px;
+}
+
 .country_flag {
   max-height: 16px;
   display: inline-block;
index 1d8df0a..983b018 100644 (file)
@@ -71,6 +71,8 @@ a.no-decoration
 .oe_comment_grey
   background-color: #f5f5f5
   padding: 4px
+.close.comment_delete
+  font-size: 16px
 
 .country_flag
   max-height: 16px
index 5fa5c65..7b74293 100644 (file)
         <div class="col-sm-10 col-sm-offset-2">
             <div t-foreach="reversed(object.website_message_ids)" t-as="message" class="comment oe_comment_grey">
                 <small class="text-muted">
-                    <button type="button" t-if="user.partner_id.id == message.author_id.id and user.karma&gt;=750"
-                        t-attf-data-href="/forum/#{slug(forum)}/post/#{slug(object)}/comment/#{slug(message)}/delete"
-                        class="close comment_delete">&amp;times;</button>
+                    <t t-set="required_karma" t-value="message.author_id.id == user.partner_id.id and object.forum_id.karma_comment_unlink_own or object.forum_id.karma_comment_unlink_all"/>
+                    <t t-call="website_forum.link_button">
+                        <t t-set="url" t-value="'/forum/' + slug(forum) + '/post/' + slug(object) + '/comment/' + slug(message) + '/delete'"/>
+                        <t t-set="label" t-value="' '"/>
+                        <t t-set="karma" t-value="user.karma&lt;required_karma and required_karma or 0"/>
+                        <t t-set="classes" t-value="'close comment_delete fa-times'"/>
+                    </t>
+
                     <span t-field="message.body"/>
                     <t t-set="required_karma" t-value="message.author_id.id == user.partner_id.id and object.forum_id.karma_comment_convert_own or object.forum_id.karma_comment_convert_all"/>
                     <t t-call="website_forum.link_button">