[IMP]page transition and remove shortened content

bzr revid: mba@tinyerp.com-20140217114302-1mwtelv6gh9pmfhe
This commit is contained in:
Mahendra Barad (OpenERP) 2014-02-17 17:13:02 +05:30
parent f11ebbc784
commit 3c0e384c9a
3 changed files with 5 additions and 33 deletions

View File

@ -71,30 +71,6 @@ class BlogPost(osv.Model):
# maximum number of characters to display in summary
_shorten_max_char = 250
def get_shortened_content(self, cr, uid, ids, name, arg, context=None):
res = {}
for page in self.browse(cr, uid, ids, context=context):
try:
body_short = tools.html_email_clean(
page.content,
remove=True,
shorten=True,
max_length=self._shorten_max_char,
expand_options={
'oe_expand_container_tag': 'div',
'oe_expand_container_class': 'oe_mail_expand text-center',
'oe_expand_container_content': '',
'oe_expand_a_href': '/blogpost/%d' % page.id,
'oe_expand_a_class': 'oe_mail_expand btn btn-info',
'oe_expand_separator_node': 'br',
},
protect_sections=True,
)
except Exception:
body_short = False
res[page.id] = body_short
return res
_columns = {
'name': fields.char('Title', required=True, translate=True),
'sub_title' : fields.char('Sub Title', translate=True),
@ -107,12 +83,6 @@ class BlogPost(osv.Model):
'blog.tag', string='Tags',
),
'content': fields.html('Content', translate=True),
'shortened_content': fields.function(
get_shortened_content,
type='html',
string='Shortened Content',
help="Shortened content of the page that serves as a summary"
),
# website control
'website_published': fields.boolean(
'Publish', help="Publish on the website"

View File

@ -9,7 +9,6 @@ $(document).ready(function() {
newLocation = $('.js_next')[0].href;
$('.cover_footer')
.fadeIn(900, newpage);
$("html, body").stop().animate({ scrollTop: $("#wrap").offset().top }, 'slow', 'swing');
}
function animate(event) {
@ -27,7 +26,11 @@ $(document).ready(function() {
$.ajax({
url: newLocation,
}).done(function(data) {
$('main').html($(data).find('main').html());
$('main').append($(data).find('main').html());
$("html").stop().animate({ scrollTop: $("#wrap:last-child").offset().top }, 1000,function(e){
$("#wrap:first").remove();
$(document).scrollTop($("#wrap:last-child").offset().top);
});
if (newLocation != window.location) {
history.pushState(null, null, newLocation);
}

View File

@ -122,7 +122,6 @@
</span>
<span t-if="not blog_post.website_published" class="label label-danger">not published</span>
</p>
<div t-raw="blog_post.shortened_content" t-ignore="true" class="blog_content"/>
<hr/>
</div>