[IMP] redirect to the comment when any comment posted, same thing for comment to...
authorTurkesh Patel (Open ERP) <tpa@tinyerp.com>
Thu, 10 Apr 2014 12:49:50 +0000 (18:19 +0530)
committerTurkesh Patel (Open ERP) <tpa@tinyerp.com>
Thu, 10 Apr 2014 12:49:50 +0000 (18:19 +0530)
bzr revid: tpa@tinyerp.com-20140410124950-rnm040ag8ppop4kc

addons/website_forum/controllers/main.py
addons/website_forum/views/website_forum.xml

index 968b26f..589d3e4 100644 (file)
@@ -208,7 +208,7 @@ class website_forum(http.Controller):
 
         post = request.registry['website.forum.post'].browse(cr, uid, int(post_id), context=context)
         question_id = post.parent_id.id if post.parent_id else post.id
-        return werkzeug.utils.redirect("/forum/%s/question/%s" % (slug(forum),question_id))
+        return werkzeug.utils.redirect("/forum/%s/question/%s#comments-%s" % (slug(forum), question_id, post.id))
 
     @http.route(['/forum/<model("website.forum"):forum>/user/<model("res.users"):user>'], type='http', auth="public", website=True, multilang=True)
     def open_user(self, forum, user, **post):
@@ -339,7 +339,7 @@ class website_forum(http.Controller):
         request.registry['res.users'].write(cr, SUPERUSER_ID, uid, {'forum': True}, context=context)
 
         create_context = dict(context)
-        new_question_id = request.registry['website.forum.post'].create(
+        answer_id = request.registry['website.forum.post'].create(
             cr, uid, {
                 'forum_id': forum.id,
                 'user_id': uid,
@@ -348,7 +348,7 @@ class website_forum(http.Controller):
                 'state': 'active',
                 'active': True,
             }, context=create_context)
-        return werkzeug.utils.redirect("/forum/%s/question/%s" % (slug(forum),post_id))
+        return werkzeug.utils.redirect("/forum/%s/question/%s#answer-%s" % (slug(forum), post_id, answer_id))
 
     @http.route(['/forum/<model("website.forum"):forum>/question/<model("website.forum.post"):question>/editanswer']
                 , type='http', auth="user", website=True, multilang=True)
@@ -411,7 +411,7 @@ class website_forum(http.Controller):
         vals.update({'tags': [(6, 0, question_tags)], 'name': post.get('question_name')})
 
         post_id = post.get('answer_id') if post.get('answer_id') else post.get('question_id')
-        new_question_id = request.registry['website.forum.post'].write( cr, uid, [int(post_id)], vals, context=context)
+        request.registry['website.forum.post'].write( cr, uid, [int(post_id)], vals, context=context)
         return werkzeug.utils.redirect("/forum/%s/question/%s" % (slug(forum),post.get('question_id')))
 
     @http.route(['/forum/<model("website.forum"):forum>/tag'], type='http', auth="public", website=True, multilang=True)
index 6b01baa..bc7dffc 100644 (file)
 
         <template id="comments">
             <div class="row clearfix">
-                <div class="col-sm-10 col-sm-offset-2">
+                <div class="col-sm-10 col-sm-offset-2" t-attf-id="comments-#{object.id}">
                     <div t-foreach="reversed(object.website_message_ids)" t-as="message" id="comment" class="oe_comment_grey" style="padding: 4px;">
                         <small class="text-muted">
                             <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>