[IMP] remove history + js fixes

bzr revid: fp@tinyerp.com-20140322185058-lm3r3ktlwkskc4q3
This commit is contained in:
Fabien Pinckaers 2014-03-22 19:50:58 +01:00
parent d03a8e8fcd
commit a9c62bfbb0
4 changed files with 28 additions and 81 deletions

View File

@ -331,10 +331,3 @@ class WebsiteBlog(http.Controller):
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, image=None, **post):
values = {}
inherit_options = request.registry.get('ir.ui.view').search_read(request.cr, SUPERUSER_ID, [('name','in',['Allow comment in text','Select to Tweet'])], ['inherit_id','name'])
for options in inherit_options:
values[options.get('name')] = options.get('inherit_id')
return values

View File

@ -1,11 +1,4 @@
$(document).ready(function() {
var discussion = false;
var share = false;
function updateMinHeight(event) {
var vHeight = $(window).height();
$(document).find('.cover_header').css('min-height', vHeight);
}
function page_transist(event) {
event.preventDefault();
@ -21,31 +14,25 @@ $(document).ready(function() {
});
}
function animate(event) {
event.stopImmediatePropagation();
var target = this.hash;
$target = $(target);
function animate() {
var target = $(this.hash);
$('html, body').stop().animate({
'scrollTop': $target.offset().top
'scrollTop': target.offset().top
}, 900, 'swing', function () {
window.location.hash = target;
});
return false;
}
$( window ).on('resize', function() {
updateMinHeight();
});
//check custome options inline discussion and select to tweet(share) are checked.
openerp.jsonRpc("/blogpsot/get_custom_options", 'call', {}).then(function(res){
discussion = res['Allow comment in text'];
share = res['Select to Tweet'];
var content = $("#blog_content p");
if(content.length && discussion){
$('#discussions_wrapper').empty();
new openerp.website.blog_discussion({'content' : content});
}
if (share) $("h1, h2, h3, h4, ul, p","#blog_content ,.blog_title").share({'author_name':$('#blog_author').text()});
});
var content = $(".js_discuss");
if(content){
$('#discussions_wrapper').empty();
new openerp.website.blog_discussion({'content' : content});
}
$('.cover_header').css('min-height', $(window).height());
$("js_tweet").find("h1, h2, h3, h4, li, p").share({'author_name':$('#blog_author').text()});
$('.cover_footer').on('click',page_transist);
$('a[href^="#blog_content"]').on('click', animate);
updateMinHeight();
});

View File

@ -163,7 +163,7 @@
<template id="blog_post_complete" name="Blog Post">
<t t-call="website_blog.index">
<div t-attf-class="cover cover_header text-center" id="title" t-attf-style="background-image : url(#{blog_post.content_image})" t-ignore="True">
<div class="cover cover_header text-center mb32" id="title" t-attf-style="background-image : url(#{blog_post.content_image})" t-ignore="True">
<div class="container">
<div class="container text-right mt16">
<div class="btn-group css_non_editable_mode_hidden">
@ -199,7 +199,9 @@
</div>
</div>
<div id="blog_content" t-field="blog_post.content" class="mt32"/>
<div id="blog_content_container" class="mt32">
<div id="blog_content" t-field="blog_post.content"/>
</div>
<!-- FP Note: should we remove this or put it in options? -->
<section id="comments" class="container">
@ -279,12 +281,20 @@
<!-- 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">
<xpath expr="//div[@id='blog_content']" position="attributes">
<attribute name="class">js_tweet</attribute>
</xpath>
<xpath expr="//div[@class='blog_title']" position="attributes">
<attribute name="class">blog_title js_tweet</attribute>
</xpath>
</template>
<!-- Options: Blog Post: user can add Inline Discussion -->
<template id="opt_blog_post_inline_discussion" name="Allow comment in text"
inherit_option_id="website_blog.blog_post_complete"
groups="website_mail.group_comment">
inherit_option_id="website_blog.blog_post_complete">
<xpath expr="//div[@id='blog_content_container']" position="attributes">
<attribute name="class">js_discuss</attribute>
</xpath>
</template>
<!-- Page -->

View File

@ -115,48 +115,5 @@
</record>
<menuitem id="menu_blog" parent="menu_wiki" name="Blogs" action="action_blog_blog" sequence="20"/>
<!-- History Tree view -->
<record model="ir.ui.view" id="view_blog_history_tree">
<field name="name">blog.post.history.tree</field>
<field name="model">blog.post.history</field>
<field name="arch" type="xml">
<tree string="Document History">
<field name="create_date"/>
<field name="create_uid"/>
<field name="post_id"/>
</tree>
</field>
</record>
<!-- History Form view -->
<record model="ir.ui.view" id="view_blog_history_form">
<field name="name">blog.post.history.form</field>
<field name="model">blog.post.history</field>
<field name="arch" type="xml">
<form string="Blog Post History" version="7.0">
<label for="post_id" class="oe_edit_only"/>
<h1><field name="post_id" select="1" /></h1>
<label for="create_date" class="oe_edit_only"/>
<field name="create_date" readonly="1"/>
<label for="content" class="oe_edit_only"/>
<field name="content" colspan="4"/>
</form>
</field>
</record>
<!-- History Action -->
<record model="ir.actions.act_window" id="action_history">
<field name="name">Page history</field>
<field name="res_model">blog.post.history</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem id="menu_page_history" parent="menu_wiki" name="Pages history" action="action_history" sequence="30" groups="base.group_no_one"/>
<act_window
id="action_related_page_history"
context="{'search_default_post_id': [active_id], 'default_post_id': active_id}"
domain="[('post_id','=',active_id)]"
name="Page History"
res_model="blog.post.history"
src_model="blog.post"/>
</data>
</openerp>