[ADD] : sub-title field in blog.post

[ADD] : customize option for list view of blogpost in blog

bzr revid: aja@tinyerp.com-20140207114028-4y47svx88xe5rrhy
This commit is contained in:
ajay javiya (OpenERP) 2014-02-07 17:10:28 +05:30
parent 484e04661f
commit 7d6389cc8e
4 changed files with 45 additions and 4 deletions

View File

@ -17,6 +17,9 @@
<!-- POSTS -->
<record id="blog_post_1" model="blog.post">
<field name="name">The Future of Emails</field>
<field name="sub_title">At OpenERP, we build tools to bring
productivity to enterprises.As emails and information flows are
one of the biggest wastes of time in companies.</field>
<field name="blog_id" ref="blog_blog_1"/>
<field name="tag_ids" eval="[(6, 0, [ref('blog_tag_1')])]"/>
<field name="website_published" eval="True"/>
@ -129,6 +132,8 @@
<record id="blog_post_2" model="blog.post">
<field name="name">OpenERP launches integrated CMS and E-Commerce</field>
<field name="sub_title">OpenERP's latest launch will allow a business
to go from zero to trading online quicker than ever before.</field>
<field name="blog_id" ref="blog_blog_1"/>
<field name="website_published" eval="True"/>
<field name="tag_ids" eval="[(6, 0, [ref('blog_tag_1')])]"/>
@ -282,6 +287,9 @@
</record>
<record id="blog_post_3" model="blog.post">
<field name="name">Sorry SAP Campaign - The Making Of</field>
<field name="sub_title">Fabian starts the article Sorry SAP Campaign
-The Making Of, with what his dream was what strategy he applied to
make his dream come true.</field>
<field name="blog_id" ref="blog_blog_1"/>
<field name="website_published" eval="True"/>
<field name="website_meta_keywords">OpenERP, News, Sorry SAP</field>

View File

@ -98,6 +98,7 @@ class BlogPost(osv.Model):
_columns = {
'name': fields.char('Title', required=True, translate=True),
'sub_title' : fields.char('Sub Title', translate=True),
'content_image': fields.binary('Background Image'),
'blog_id': fields.many2one(
'blog.blog', 'Blog',

View File

@ -113,7 +113,7 @@
</div>
</div>
<t t-foreach="blog_posts" t-as="blog_post">
<div t-att-data-publish="blog_post.website_published and 'on' or 'off'">
<div name="blog_post_summary" t-att-data-publish="blog_post.website_published and 'on' or 'off'">
<h2 class="text-center">
<a t-attf-href="/blogpost/#{ slug(blog_post) }/?#{ tag and 'tag=%s' % tag.id or '' }#{tag and date and '&amp;' or ''}#{ date and 'date=%s' % date or ''}" t-field="blog_post.name"></a>
</h2>
@ -135,6 +135,35 @@
</t>
</template>
<!-- Blog Post List -->
<template id="opt_blog_post_short_list" name="Blog Post List"
inherit_option_id="website_blog.blog_post_short">
<xpath expr="//div[@name='blog_post_summary']" position="replace">
<div class="container">
<div class="row">
<div name="blog_post_summary" class="col-md-8 col-md-offset-2 mt32" t-att-publish-data="blog_post.website_published and 'on' or 'off'">
<div class="media">
<a class="pull-right" href="#">
<img class="media-object" t-att-src="'/website/image?model=res.partner&amp;field=image_small&amp;id='+str(blog_post.create_uid.id)" style="width: 40px;"/>
</a>
<div class="media-body">
<h2 class="media-heading">
<a t-attf-href="/blogpost/#{ slug(blog_post) }/?#{ tag and 'tag=%s' % tag.id or '' }#{tag and date and '&amp;' or ''}#{ date and 'date=%s' % date or ''}" t-field="blog_post.name"></a>
</h2>
<h3><small class="text-left text-muted" t-field="blog_post.sub_title"/></h3>
<p class="text-justify text-muted"><strong><small t-field="blog_post.create_uid.name"></small></strong></p>
</div>
</div>
<p class="post-meta text-muted text-left hidden" name='blog_post_data'>
<span class="fa fa-calendar oe_date"> <span t-field="blog_post.create_date"/> &amp;nbsp;</span>
</p>
<hr/>
</div>
</div>
</div>
</xpath>
</template>
<!-- Options: Blog Post Summary: hide author -->
<template id="opt_blog_post_short_author" name="Author"
inherit_option_id="website_blog.blog_post_short">
@ -238,8 +267,9 @@
<attribute name="t-attf-style">background-image : url(data:image/jpg;base64,#{blog_post.content_image})</attribute>
</xpath>
<xpath expr="//div[@id='title']" position="inside">
<h2 class="text-center text-muted"><small t-field="blog_post.sub_title"></small></h2>
<div class="text-center blog_item">
<img class="img-circle" t-att-src="'/website/image?model=res.partner&amp;field=image_small&amp;id='+str(blog_post.create_uid.partner_id.id)" style="width: 30px; margin-right: 10px;"/>
<img class="img-circle" t-att-src="'/website/image?model=res.partner&amp;field=image_small&amp;id='+str(blog_post.create_uid.id)" style="width: 30px; margin-right: 10px;"/>
<small class="text-muted" id="blog_author" t-field="blog_post.create_uid.name"/>
</div>
<div class="text-center mt64">
@ -250,8 +280,9 @@
<div class="cover_footer" t-attf-style="background-image: url(data:image/jpg;base64,#{next_post.content_image})">
<a class="js_next " t-attf-href="/blogpost/#{ slug(next_post) }"><p class="text-center">Read Next</p></a>
<h1 class="text-center" t-field="next_post.name"/>
<h2 class="text-center text-muted"><small t-field="blog_post.sub_title"></small></h2>
<div class="text-center blog_item">
<img class="img-circle" t-att-src="'/website/image?model=res.partner&amp;field=image_small&amp;id='+str(next_post.create_uid.partner_id.id)" style="width: 30px; margin-right: 10px;"/>
<img class="img-circle" t-att-src="'/website/image?model=res.partner&amp;field=image_small&amp;id='+str(next_post.create_uid.id)" style="width: 30px; margin-right: 10px;"/>
<small class="text-muted" id="blog_author" t-field="next_post.create_uid.name"/>
</div>
</div>
@ -350,7 +381,6 @@
<t t-call="website.layout">
<t t-set="head">
<link rel='stylesheet' href='/website_blog/static/src/css/website_blog.css'/>
<link rel='stylesheet' href='/website_blog/static/lib/page-transitions/css/styles.css'/>
<link rel='stylesheet' href='/website_blog/static/lib/inlineDisqussions/inlineDisqussions.css'/>
</t>
<div id="wrap" class="js_blog">

View File

@ -56,7 +56,9 @@
<sheet>
<h1><field name="name" placeholder="Name"/></h1>
<field name="tag_ids" widget="many2many_tags"/>
<field name="sub_title"/>
<group>
<field name="content_image"/>
<field name="blog_id"/>
</group>
<field name="content" placeholder="e.g. Once upon a time..." widget="html"/>