[IMP]inline discussion and content share added to customize option

bzr revid: mba@tinyerp.com-20140224110352-rjr4c9f77uorkhyw
This commit is contained in:
Mahendra Barad (OpenERP) 2014-02-24 16:33:52 +05:30
parent 9d0e551091
commit e468f7f159
3 changed files with 45 additions and 5 deletions

View 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

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

View File

@ -276,6 +276,17 @@
</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">