[IMP] Better Blog Design
bzr revid: fp@openerp.com-20130929123926-o790lnajkawona5l
This commit is contained in:
@@ -75,6 +75,7 @@ class website_mail(http.Controller):
|
||||
blog_post_obj = request.registry['blog.post']
|
||||
tag_obj = request.registry['blog.tag']
|
||||
category_obj = request.registry['blog.category']
|
||||
user_obj = request.registry['res.users']
|
||||
|
||||
tag = None
|
||||
category = None
|
||||
@@ -142,6 +143,7 @@ class website_mail(http.Controller):
|
||||
'blog_posts': blog_posts,
|
||||
'pager': pager,
|
||||
'nav_list': nav,
|
||||
'uid': request.uid,
|
||||
'unable_editor': post.get('unable_editor')
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
a.oe_mail_expand
|
||||
font-weight: bold
|
||||
display: block
|
||||
margin-top: 10px
|
||||
|
||||
p.post-meta
|
||||
position: relative
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
</template>
|
||||
|
||||
<!-- Blog Post Summary -->
|
||||
<template id="view_blog_post_short" name="Blog Post Short">
|
||||
<template id="view_blog_post_short" name="Blog Post Summary">
|
||||
<div>
|
||||
<h2 class="text-center">
|
||||
<a t-attf-href="/blog/#{blog_post.category_id.id}/#{blog_post.id}#comment" t-field="blog_post.name"></a>
|
||||
</h2>
|
||||
<p class="post-meta text-muted text-center">
|
||||
<span class="icon-calendar"> <span t-field="blog_post.create_date"/></span> &nbsp;
|
||||
<span class="icon-user"> By <span t-field="blog_post.create_uid"/></span> &nbsp;
|
||||
<span class="icon-user"> By <span t-field="blog_post.create_uid"/> &nbsp;</span>
|
||||
<span t-if="len(blog_post.message_ids) > 0" class="icon-comment"> With
|
||||
<a t-if="len(blog_post.message_ids) <= 1" t-attf-href="/blog/#{blog_post.category_id.id}/#{blog_post.id}#comments"><t t-esc="len(blog_post.message_ids)"/> comment</a>
|
||||
<a t-if="len(blog_post.message_ids) > 1" t-attf-href="/blog/#{blog_post.category_id.id}/#{blog_post.id}#comments"><t t-esc="len(blog_post.message_ids)"/> comments</a>
|
||||
@@ -32,17 +32,22 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template id="view_blog_post_short_author" inherit_option_id="website_blog.view_blog_post_short" name="Hide Authors">
|
||||
<xpath expr="//span[@class='icon-user']" position="attributes">
|
||||
<attribute name="class">hidden</attribute>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<!-- Blog Post Complete -->
|
||||
<template id="view_blog_post" name="Blog Post">
|
||||
<div>
|
||||
<t t-call="website_mail.follow"><t t-set="object" t-value="blog_post"/></t>
|
||||
<t t-call="website.publish_management"><t t-set="object" t-value="blog_post"/></t>
|
||||
</div><div class="clearfix"/>
|
||||
|
||||
<h2 class="text-center" t-field="blog_post.name"/>
|
||||
<p class="post-meta text-muted text-center">
|
||||
<span class="icon-calendar"> <span t-field="blog_post.create_date"/></span> &nbsp;
|
||||
<span class="icon-user"> By <span t-field="blog_post.create_uid"/></span> &nbsp;
|
||||
<span class="icon-user"> By <span t-field="blog_post.create_uid"/> &nbsp;</span>
|
||||
<span t-if="len(blog_post.message_ids) > 0" class="icon-comment"> With
|
||||
<a t-if="len(blog_post.message_ids) <= 1" t-attf-href="#comments"><t t-esc="len(blog_post.message_ids)"/> comment</a>
|
||||
<a t-if="len(blog_post.message_ids) > 1" t-attf-href="#comments"><t t-esc="len(blog_post.message_ids)"/> comments</a>
|
||||
@@ -56,40 +61,52 @@
|
||||
</p>
|
||||
|
||||
<div t-field="blog_post.content" class="mt32"/>
|
||||
<hr class="mb32"/>
|
||||
|
||||
<hr/>
|
||||
<div class="clearfix">
|
||||
<div class="pull-right text-right">
|
||||
<t t-call="website.pager" class="pull-right"/>
|
||||
</div>
|
||||
<a id="comments"/>
|
||||
<h4 t-if="len(blog_post.website_message_ids)" class="mb16">
|
||||
<t t-if="len(blog_post.website_message_ids) <= 1">
|
||||
<t t-esc="len(blog_post.website_message_ids)"/> Comment
|
||||
1 Comment
|
||||
</t>
|
||||
<t t-if="len(blog_post.website_message_ids) > 1">
|
||||
<t t-esc="len(blog_post.website_message_ids)"/> Comments
|
||||
</t>
|
||||
</div>
|
||||
<form id="comment" t-attf-action="/blog/#{blog_post.category_id.id}/#{blog_post.id}/post#post"
|
||||
method="POST" class="form-horizontal text-center"
|
||||
groups="group_website_blog_reply">
|
||||
<div>
|
||||
<textarea rows="4" placeholder="Your comment" class="form-control"></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default">Post your comment</button>
|
||||
</form>
|
||||
<ul class="media-list" id="comments">
|
||||
</h4>
|
||||
<ul class="media-list">
|
||||
<li t-foreach="blog_post.website_message_ids" t-as="message" class="media">
|
||||
<div class="media-body well well-sm">
|
||||
<t t-call="website.publish_management"><t t-set="object" t-value="message"/></t>
|
||||
<t t-raw="message.body"/>
|
||||
<small class="pull-left text-muted text-left">
|
||||
<span t-field="message.author_id"/> on <span t-field="message.date"/>
|
||||
</small>
|
||||
<div class="media-body">
|
||||
<img class="media-object pull-left" t-att-src="'/website/image?model=res.users&field=image_small&id='+str(message.author_id.id)" style="width: 50px; margin-right: 10px;"/>
|
||||
<div class="media-body">
|
||||
<t t-call="website.publish_management"><t t-set="object" t-value="message"/></t>
|
||||
<h5 class="media-heading">
|
||||
<span t-field="message.author_id"/> <small>on <span t-field="message.date"/></small>
|
||||
</h5>
|
||||
<div t-field="message.body"/>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<section groups="group_website_blog_reply" class="mb32">
|
||||
<t t-call="website_mail.follow"><t t-set="object" t-value="blog_post"/></t>
|
||||
<h4>Leave a Comment</h4>
|
||||
<form id="comment" t-attf-action="/blog/#{blog_post.category_id.id}/#{blog_post.id}/post#post"
|
||||
method="POST">
|
||||
<img class="img pull-left img-rounded" t-att-src="'/website/image?model=res.users&field=image_small&id='+str(uid)" style="width: 50px; margin-right: 10px;"/>
|
||||
<div class="pull-left" style="width: 75%%">
|
||||
<textarea rows="3" class="form-control" placeholder="Write a comment..."></textarea>
|
||||
<button type="submit" class="btn btn-danger mt8">Post</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<template id="view_blog_post_author" inherit_option_id="website_blog.view_blog_post" name="Hide Authors">
|
||||
<xpath expr="//span[@class='icon-user']" position="attributes">
|
||||
<attribute name="class">hidden</attribute>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
||||
<!-- Page -->
|
||||
<template id="index" name="Blogs" page="True">
|
||||
<t t-call="website.layout">
|
||||
@@ -105,27 +122,32 @@
|
||||
<t t-foreach="blog_posts" t-as="blog_post" data-publish="">
|
||||
<t t-call="website_blog.view_blog_post_short"/>
|
||||
</t>
|
||||
<div class="text-center" t-call="website.pager"/>
|
||||
<div class="pull-right" t-call="website.pager"/>
|
||||
</div>
|
||||
<div class="col-md-9 col-lg-8" t-if="blog_post">
|
||||
<t t-call="website_blog.view_blog_post">
|
||||
<t t-set="blog_post" t-value="blog_post"/>
|
||||
</t>
|
||||
</div>
|
||||
<div class="col-sm-3 hidden-xs col-lg-offset-1 mb32" id="right_column">
|
||||
<t t-if="category and editable">
|
||||
<a t-attf-href="/blog/#{category.id}/new" class="btn btn-primary pull-right">New Blog Post</a>
|
||||
</t>
|
||||
<div class="clearfix mb48"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
<template id="blog_right_column" inherit_id="website_blog.index" inherit_option_id="website_blog.index" name="Right Column">
|
||||
<xpath expr="//div[@class='row']" position="inside">
|
||||
<div class="col-sm-3 hidden-xs col-lg-offset-1 mb32" id="right_column">
|
||||
<t t-if="category and editable">
|
||||
<a t-attf-href="/blog/#{category.id}/new" class="btn btn-primary pull-right">New Blog Post</a>
|
||||
</t>
|
||||
<div class="clearfix mb48"/>
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<!-- Option: archives -->
|
||||
<template id="blog_history" inherit_id="website_blog.index" inherit_option_id="website_blog.index" name="Archives">
|
||||
<template id="blog_history" inherit_id="website_blog.blog_right_column" inherit_option_id="website_blog.blog_right_column" name="Archives">
|
||||
<xpath expr="//div[@id='right_column']" position="inside">
|
||||
<section>
|
||||
<h4>Archives</h4>
|
||||
@@ -146,7 +168,7 @@
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<template id="blog_aboutus" inherit_option_id="website_blog.index" name="About" priority="4">
|
||||
<template id="blog_aboutus" inherit_option_id="website_blog.blog_right_column" inherit_id="website_blog.blog_right_column" name="About" priority="4">
|
||||
<xpath expr="//div[@id='right_column']" position="inside">
|
||||
<section class="mb16">
|
||||
<h4>About us</h4>
|
||||
@@ -161,7 +183,7 @@
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<template id="blog_followus" inherit_option_id="website_blog.index" name="Follow us" priority="2">
|
||||
<template id="blog_followus" inherit_option_id="website_blog.blog_right_column" inherit_id="website_blog.blog_right_column" name="Follow us" priority="2">
|
||||
<xpath expr="//div[@id='right_column']" position="inside">
|
||||
<section class="mb16">
|
||||
<h4>Follow us</h4>
|
||||
@@ -181,7 +203,7 @@
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<template id="blog_categories" inherit_option_id="website_blog.index" name="Other Blogs" priority="6">
|
||||
<template id="blog_categories" inherit_option_id="website_blog.blog_right_column" name="Other Blogs" priority="6">
|
||||
<xpath expr="//div[@id='right_column']" position="inside">
|
||||
<section class="mb16">
|
||||
<h4>Other Blogs</h4>
|
||||
|
||||
Reference in New Issue
Block a user