[IMP]inline discussion and content share added to customize option
authorMahendra Barad (OpenERP) <mba@tinyerp.com>
Mon, 24 Feb 2014 11:03:52 +0000 (16:33 +0530)
committerMahendra Barad (OpenERP) <mba@tinyerp.com>
Mon, 24 Feb 2014 11:03:52 +0000 (16:33 +0530)
bzr revid: mba@tinyerp.com-20140224110352-rjr4c9f77uorkhyw

addons/website_blog/controllers/main.py
addons/website_blog/static/src/js/website_blog.js
addons/website_blog/views/website_blog_templates.xml

index a2f9547..11e6c3f 100644 (file)
@@ -329,3 +329,11 @@ class WebsiteBlog(http.Controller):
         values = {'content_image' : image}
         ids = post_obj.write(request.cr, SUPERUSER_ID, [int(post_id)], values)
         return []
+
+    @http.route('/blogpsot/get_custom_options', type='json', auth="public", website=True)
+    def get_custom_options(self, post_id=0,image=None, **post):
+        values = {}
+        inherit_options = request.registry.get('ir.ui.view').search_read(request.cr, SUPERUSER_ID, [('name','in',['Inline Discussion','Select to Tweet'])], ['inherit_id','name'])
+        for options in inherit_options:
+            values[options.get('name')] = options.get('inherit_id')
+        return values
index 06aff01..04a8485 100644 (file)
@@ -1,10 +1,29 @@
 $(document).ready(function() {
+<<<<<<< TREE
+    var discussion = false;
+    var share = false;
+
+    var def = $.Deferred();
+    openerp.jsonRpc("/blogpsot/get_custom_options", 'call', {
+    }).then(function(res){
+        discussion = res['Inline Discussion']
+        share = res['Select to Tweet']
+        return def.resolve()
+    })
+    def.done( function(){
+        var content = $("#blog_content p");
+        if(content.length && discussion)
+            new openerp.website.blog_discussion({'document_user': $('#is_document_user').length, 'content' : content});
+        if (share) $("p").share();
+    })
+=======
     var content = $("#blog_content p");
     if(content.length)
         new openerp.website.blog_discussion({'content' : content});
+>>>>>>> MERGE-SOURCE
     $('.cover_footer').on('click',page_transist);
     $('a[href^="#blog_content"]').on('click', animate);
-    $("p").share();
+
     function page_transist(event) {
         event.preventDefault();
         var translationValue  = $('.cover_footer').get(0).getBoundingClientRect().top;
@@ -35,10 +54,12 @@ $(document).ready(function() {
                //bind again it takes control from now on, until page relaod.
                $(document).find('.cover_footer').on('click',page_transist);
                $(document).find('a[href^="#blog_content"]').on('click', animate);
-               var content = $(document).find("#blog_content p");
-               if (content)
-                   new openerp.website.blog_discussion({'content' : content});
-               $("p").share();
+               def.done( function(){
+                   var content = $(document).find("#blog_content p");
+                   if (content && discussion)
+                       new openerp.website.blog_discussion({'content' : content});
+                   if (share) $("p").share();
+               });
            });
             if (newLocation != window.location) {
                 history.pushState(null, null, newLocation);
index d6c0f9d..6ef4ca5 100644 (file)
     </xpath>
 </template>
 
+<!-- Options: Blog Post: user can select text for tweet -->
+<template id="opt_blog_post_select_to_tweet" name="Select to Tweet"
+        inherit_option_id="website_blog.blog_post_complete">
+</template>
+
+<!-- Options: Blog Post: user can add Inline Discussion -->
+<template id="opt_blog_post_inline_discussion" name="Inline Discussion"
+        inherit_option_id="website_blog.blog_post_complete"
+        groups="website_mail.group_comment">
+</template>
+
 <!-- Page -->
 <template id="index" name="Blog Navigation">
     <t t-call="website.layout">