[FIX] website_forum: fixed comment unlink action :

- 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
This commit is contained in:
Thibault Delavallée 2014-08-27 10:57:29 +02:00
parent 5b4f8a6278
commit 1e402cb084
4 changed files with 15 additions and 4 deletions

View 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)

View File

@ -90,6 +90,10 @@ a.no-decoration {
padding: 4px;
}
.close.comment_delete {
font-size: 16px;
}
.country_flag {
max-height: 16px;
display: inline-block;

View 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

View File

@ -658,9 +658,14 @@
<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">