[IMP] website_mail: author
authorChristophe Matthieu <chm@openerp.com>
Thu, 19 Sep 2013 14:19:58 +0000 (16:19 +0200)
committerChristophe Matthieu <chm@openerp.com>
Thu, 19 Sep 2013 14:19:58 +0000 (16:19 +0200)
bzr revid: chm@openerp.com-20130919141958-0qfx01nfidr4zq5i

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

index 30812e4..939493c 100644 (file)
@@ -27,6 +27,7 @@ class website_mail(http.Controller):
             'nav_list': dict(),
             'mail_group_id': mail_group_id,
             'subscribe': post.get('subscribe'),
+            'unable_editor': post.get('unable_editor')
         }
 
         if not request.context['is_public_user'] and mail_group_id:
@@ -92,7 +93,7 @@ class website_mail(http.Controller):
                 type='comment',
                 subtype='mt_comment',
                 context=dict(request.context, mail_create_nosubscribe=True))
-        return werkzeug.utils.redirect("/blog/%s/%s/" % (mail_group_id, blog_id))
+        return werkzeug.utils.redirect("/blog/%s/%s/?unable_editor=1" % (mail_group_id, blog_id))
 
     @website.route(['/blog/<int:mail_group_id>/subscribe', '/blog/<int:mail_group_id>/<int:blog_id>/subscribe'], type='http', auth="public")
     def subscribe(self, mail_group_id=None, blog_id=None, **post):
index 8f97368..05f0187 100644 (file)
                                 <h3 t-field="blog_id.subject"/>
                                 <div t-field="blog_id.body"/>
                                 <small class="pull-right muted text-right">
-                                    <div t-field="blog_id.author_id"/>
                                     <div t-field="blog_id.date"/>
                                 </small>
                             </div>
-                            <ul class="media-list" id="comment">
+                            <ul class="media-list" id="comment" t-if="not unable_editor">
                                 <li t-foreach="blog_id.child_ids" t-as="comment" class="media">
                                     <div class="media-body">
                                         <t t-call="website.publish"><t t-set="object" t-value="comment"/></t>
@@ -72,7 +71,7 @@
                                     </div>
                                 </li>
                             </ul>
-                            <form id="post" t-attf-action="/blog/#{ blog_id.res_id }/#{ blog_id.id }/post#post" method="POST" class="form-horizontal text-center" groups="group_website_mail_reply">
+                            <form id="post" t-if="not unable_editor" t-attf-action="/blog/#{ blog_id.res_id }/#{ blog_id.id }/post#post" method="POST" class="form-horizontal text-center" groups="group_website_mail_reply">
                                 <textarea rows="4" placeholder="Your comment" class="col-md-7 form-control"></textarea>
                                 <button type="submit" class="btn btn-default">Post your comment</button>
                             </form>
@@ -92,7 +91,6 @@
                                             <a t-if="len(blog.child_ids) > 1" t-attf-href="/blog/#{ blog.res_id }/#{ blog.id }#comment"><t t-esc="len(blog.child_ids)"/> Comments</a>
                                         </small>
                                         <small class="pull-right muted text-right">
-                                            <div t-field="blog.author_id"/>
                                             <div t-field="blog.date"/>
                                         </small>
                                     </div>
         </t>
     </template>
 
+    <template id="blog_author" inherit_id="website_mail.index" inherit_option_id="website_mail.index" name="Author">
+        <xpath expr="//div[@t-field='blog_id.date']" position="before">
+            <div t-field="blog_id.author_id"/>
+        </xpath>
+        <xpath expr="//div[@t-field='blog.date']" position="before">
+            <div t-field="blog.author_id"/>
+        </xpath>
+    </template>
+
     <template id="blog_history" inherit_id="website_mail.index" inherit_option_id="website_mail.index" name="History">
         <xpath expr="//div[@id='left_column']" position="inside">
             <ul class="nav nav-pills nav-stacked">