[IMP] website_blog: review blog layouts

Review our blog layouts to follow the design we added for forum and
event (usings cards for records but not for menu + colored cards for
the right column). Also fixes some DOM/Bootstrap structures.

Part of https://github.com/odoo/odoo/pull/31749
task-1948882
This commit is contained in:
Andrea Ulliana
2019-03-29 16:37:37 +00:00
committed by qsm-odoo
parent ce1da231b9
commit 1967ea89e6
@@ -126,57 +126,62 @@
</div>
<div class="container">
<div class="row">
<div class="col-lg-8 offset-lg-2" t-ignore="True" id="main_column">
<div class="col-lg-8 offset-lg-2" t-ignore="True" id="main_column">
<div t-if="not blog_posts" class="container mb64">
<p class="css_editable_hidden">
<h1>No blog post yet.</h1>
</p>
<p groups="website.group_website_designer">
Click on "New Page" in the top-right corner to write your first blog post.
</p>
</div>
<div t-if="not blog_posts" class="card">
<div class="card-body">
<h1 class="css_editable_hidden">No blog post yet.</h1>
<p groups="website.group_website_designer" class="card-text">Click on "New Page" in the top-right corner to write your first blog post.</p>
</div>
</div>
<div t-foreach="blog_posts" t-as="blog_post" class="mb32" name="blog_post">
<a t-attf-href="/blog/#{ slug(blog_post.blog_id) }/post/#{ slug(blog_post) }">
<h2 t-field="blog_post.name" class="mb4 o_blog_post_title">Untitled Post</h2>
</a>
<div class="text-muted">
<div t-field="blog_post.teaser" class="mb12 mt12 o_blog_post_teaser"/>
<div name='blog_post_data' class='mb0'>
<span t-field="blog_post.author_id" style="display: inline-block;" t-options='{
"widget": "contact",
"fields": ["name"]
}'/>
&amp;mdash; <span t-field="blog_post.post_date" t-options='{"format": "MMMM yyyy"}'/>
<span t-if="len(blog_post.message_ids) &gt; 0">
&amp;mdash; <t t-esc="len(blog_post.message_ids)"/>
<t t-if="len(blog_post.message_ids) &lt;= 1" >comment</t>
<t t-if="len(blog_post.message_ids) &gt; 1">comments</t>
</span>
<span t-if="blog_post.visits &gt; 0">
&amp;mdash; <t t-esc="blog_post.visits"/>
<t t-if="blog_post.visits &lt;= 1" >view</t>
<t t-if="blog_post.visits &gt; 1">views</t>
</span>
<span t-if="not blog_post.website_published" class="badge badge-danger">unpublished</span>
<span class="fa fa-tags" role="img" aria-label="Tags" title="Tags"/>
<!-- To display tags //no options -->
<t t-foreach="blog_post.tag_ids" t-as="one_tag">
<a class="mr8" t-attf-href="#{blog_url(tag=one_tag.id, date_begin=False, date_end=False)}" t-esc="one_tag.name"/>
</t>
<div class="o_sharing_links">
<a class="fa fa-twitter-square o_twitter" aria-label="Twitter" title="Twitter"></a>
<a class="fa fa-facebook-square o_facebook" aria-label="Facebook" title="Facebook"></a>
<a class="fa fa-linkedin-square o_linkedin" aria-label="LinkedIn" title="LinkedIn"></a>
<a class="fa fa-google-plus-square o_google" aria-label="Google Plus" title="Google Plus"></a>
<div t-foreach="blog_posts" t-as="blog_post" name="blog_post">
<div class="card mb-3">
<div class="card-header text-center">
<a t-attf-href="/blog/#{ slug(blog_post.blog_id) }/post/#{ slug(blog_post) }">
<h2 t-field="blog_post.name" class="mb4 o_blog_post_title">Untitled Post</h2>
</a>
</div>
<div class="card-body">
<div class="text-muted">
<div t-field="blog_post.teaser" class="mb12 mt12 o_blog_post_teaser"/>
</div>
</div>
<div class="card-footer text-muted">
<div name='blog_post_data' class='mb0'>
<span t-field="blog_post.author_id" style="display: inline-block;" t-options='{
"widget": "contact",
"fields": ["name"]
}'/>
&amp;mdash; <span t-field="blog_post.post_date" t-options='{"format": "MMMM yyyy"}'/>
<span t-if="len(blog_post.message_ids) &gt; 0">
&amp;mdash; <t t-esc="len(blog_post.message_ids)"/>
<t t-if="len(blog_post.message_ids) &lt;= 1" >comment</t>
<t t-if="len(blog_post.message_ids) &gt; 1">comments</t>
</span>
<span t-if="blog_post.visits &gt; 0">
&amp;mdash; <t t-esc="blog_post.visits"/>
<t t-if="blog_post.visits &lt;= 1" >view</t>
<t t-if="blog_post.visits &gt; 1">views</t>
</span>
<span t-if="not blog_post.website_published" class="badge badge-danger">unpublished</span>
<span class="fa fa-tags" role="img" aria-label="Tags" title="Tags"/>
<!-- To display tags //no options -->
<t t-foreach="blog_post.tag_ids" t-as="one_tag">
<a class="badge badge-primary" t-attf-href="#{blog_url(tag=one_tag.id, date_begin=False, date_end=False)}" t-esc="one_tag.name"/>
</t>
<div class="o_sharing_links">
<a class="fa fa-twitter-square o_twitter" aria-label="Twitter" title="Twitter"></a>
<a class="fa fa-facebook-square o_facebook" aria-label="Facebook" title="Facebook"></a>
<a class="fa fa-linkedin-square o_linkedin" aria-label="LinkedIn" title="LinkedIn"></a>
<a class="fa fa-google-plus-square o_google" aria-label="Google Plus" title="Google Plus"></a>
</div>
</div>
</div>
<hr/>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -195,7 +200,7 @@
<!-- Option: Blog Post List: cover image -->
<template id="opt_blog_post_cover_image" name="Cover image"
customize_show="True" active="True" inherit_id="website_blog.blog_post_short">
<xpath expr="//h2[@t-field='blog_post.name']/.." position="before">
<xpath expr="//div[@t-field='blog_post.teaser']/.." position="before">
<t t-call="website_blog.blog_cover">
<t t-set="cover_properties" t-value="blog_posts_cover_properties[blog_post_index]"/>
<t t-set="additionnal_classes" t-value="'o_list_cover mt16 mb32'"/>
@@ -206,11 +211,15 @@
<!-- Option: Blog Post List: grid layout -->
<template id="opt_blog_post_grid_layout" name="Grid view"
customize_show="True" active="False" inherit_id="website_blog.blog_post_short">
<xpath expr="//div[@id='main_column']" position="attributes">
<attribute name="class" separator=" " add="d-flex flex-wrap" />
<xpath expr="//div[@name='blog_post']" position="replace">
<div class="container">
<div class="row">
<t>$0</t>
</div>
</div>
</xpath>
<xpath expr="//div[@name='blog_post']" position="attributes">
<attribute name="class" add="col-md-5 o_grid" separator=" "/>
<attribute name="class" add="col-lg-6 d-flex" separator=" "/>
</xpath>
</template>
@@ -380,20 +389,20 @@
<template id="index_right" name="Right Column"
inherit_id="website_blog.blog_post_short">
<xpath expr="//div[@id='main_column']" position="after">
<div class="col-xl-3 offset-xl-1 col-md-4" id="blog_right_column"/>
<div class="col-lg-3" id="blog_right_column"/>
</xpath>
</template>
<!-- Option:Right Column: tags -->
<template id="tag_category" name="Tags List">
<ul class="nav nav-pills ml16">
<ul class="nav nav-pills">
<t t-if="tags">
<div t-if='not hide_title' class='text-muted mt8'><i class='fa fa-tag' role="img" aria-label="Tag category" title="Tag category"/> <t t-esc='categ_title' /></div>
<t t-foreach="tags" t-as="tag">
<t t-if="tag.post_ids">
<li class="nav-item">
<a t-attf-href="#{blog_url(tag=tags_list(active_tag_ids, tag.id))}" t-attf-class="nav-link#{tag.id in active_tag_ids and ' active' or ''}">
<li class="nav-item mr-2">
<a t-attf-href="#{blog_url(tag=tags_list(active_tag_ids, tag.id))}" t-attf-class="badge nav-link#{tag.id in active_tag_ids and ' active' or ''}">
<span t-field="tag.name"/>
</a>
</li>
@@ -406,23 +415,25 @@
<template id="opt_blog_rc_tags" name="Tags"
inherit_id="website_blog.index_right" active="True" customize_show="True">
<xpath expr="//div[@id='main_column']" position="attributes">
<attribute name="class">col-md-8</attribute>
<attribute name="class">col</attribute>
</xpath>
<xpath expr="//div[@id='blog_right_column']" position="inside">
<section class="mt32 blog_tags">
<h4>Tags</h4>
<t t-foreach="tag_category" t-as="nav_tag_category">
<t t-call="website_blog.tag_category">
<t t-set='categ_title' t-value="nav_tag_category.name"/>
<t t-set='tags' t-value='nav_tag_category.tag_ids' />
<div class="card mb-3 bg-secondary">
<h6 class="card-header"><b>Tags</b></h6>
<div class="card-body">
<t t-foreach="tag_category" t-as="nav_tag_category">
<t t-call="website_blog.tag_category">
<t t-set='categ_title' t-value="nav_tag_category.name"/>
<t t-set='tags' t-value='nav_tag_category.tag_ids' />
</t>
</t>
</t>
<t t-call="website_blog.tag_category">
<t t-set='hide_title' t-value='not len(tag_category)' />
<t t-set='categ_title'>Others</t>
<t t-set='tags' t-value='other_tags' />
</t>
</section>
<t t-call="website_blog.tag_category">
<t t-set='hide_title' t-value='not len(tag_category)' />
<t t-set='categ_title'>Others</t>
<t t-set='tags' t-value='other_tags' />
</t>
</div>
</div>
</xpath>
</template>
@@ -430,29 +441,31 @@
<template id="opt_blog_rc_history" name="Archives"
inherit_id="website_blog.index_right" active="True" customize_show="True">
<xpath expr="//div[@id='main_column']" position="attributes">
<attribute name="class">col-md-8</attribute>
<attribute name="class">col</attribute>
</xpath>
<xpath expr="//div[@id='blog_right_column']" position="inside">
<section class="mt32">
<h4>Archives</h4>
<ul class="nav nav-pills flex-column">
<t t-foreach="nav_list" t-as="year">
<li data-toggle="collapse" t-att-data-target="'#' + year" aria-expanded="false" class="nav-item blog_post_year_collapse mt8">
<i t-attf-class="fa #{'fa-chevron-down' if not date and year_index == 0 else 'fa-chevron-right'} mr4" role="img" aria-label="Next year" title="Next year"/><span t-esc="year"/>
</li>
<ul t-attf-class="blog_post_year collapse nav nav-pills flex-column #{not date and year_index == 0 and 'in'}" t-att-id="year" role="menu">
<t t-foreach="nav_list[year]" t-as="months">
<li t-if="months['date_begin'] == date" class="nav-item">
<a role="menuitem" t-ignore="True" t-attf-href="#{blog_url(date_begin=False, date_end=False)}" class="nav-link active"><t t-esc="months['month']"/><span class="float-right badge badge-pill" t-esc="months['post_date_count']"/></a>
</li>
<li t-else="1" class="nav-item">
<a role="menuitem" t-ignore="True" t-attf-href="#{blog_url(date_begin=months['date_begin'], date_end=months['date_end'])}" class="nav-link"><t t-esc="months['month']"/><span class="float-right badge badge-pill" t-esc="months['post_date_count']"/></a>
<div class="card mb-3 bg-secondary">
<h6 class="card-header"><b>Archives</b></h6>
<div class="card-body">
<ul class="nav nav-pills flex-column">
<t t-foreach="nav_list" t-as="year">
<li data-toggle="collapse" t-att-data-target="'#' + year" aria-expanded="false" class="nav-item blog_post_year_collapse mt8">
<i t-attf-class="fa #{'fa-chevron-down' if not date and year_index == 0 else 'fa-chevron-right'} mr4" role="img" aria-label="Next year" title="Next year"/><span t-esc="year"/>
</li>
<ul t-attf-class="blog_post_year collapse nav nav-pills flex-column #{not date and year_index == 0 and 'in'}" t-att-id="year" role="menu">
<t t-foreach="nav_list[year]" t-as="months">
<li t-if="months['date_begin'] == date" class="nav-item">
<a role="menuitem" t-ignore="True" t-attf-href="#{blog_url(date_begin=False, date_end=False)}" class="nav-link active"><t t-esc="months['month']"/><span class="float-right badge badge-pill" t-esc="months['post_date_count']"/></a>
</li>
<li t-else="1" class="nav-item">
<a role="menuitem" t-ignore="True" t-attf-href="#{blog_url(date_begin=months['date_begin'], date_end=months['date_end'])}" class="nav-link"><t t-esc="months['month']"/><span class="float-right badge badge-pill" t-esc="months['post_date_count']"/></a>
</li>
</t>
</ul>
</t>
</ul>
</t>
</ul>
</section>
</div>
</div>
</xpath>
</template>
@@ -460,16 +473,18 @@
<template id="opt_blog_rc_about_us" name="About Us" priority="2"
inherit_id="website_blog.index_right" active="True" customize_show="True">
<xpath expr="//div[@id='main_column']" position="attributes">
<attribute name="class">col-md-8</attribute>
<attribute name="class">col</attribute>
</xpath>
<xpath expr="//div[@id='blog_right_column']" position="inside">
<section class="mt32">
<h4>About us</h4>
<p>
Write a small text here for when <b>new visitors</b> find your website
through your <b>blog entries</b>, referenced in Google.
</p>
</section>
<div class="card mb-3 bg-secondary" id="about_forum">
<h6 class="card-header"><b>About us</b></h6>
<div class="card-body">
<span>
Write a small text here for when <b>new visitors</b> find your website
through your <b>blog entries</b>, referenced in Google.
</span>
</div>
</div>
</xpath>
</template>
@@ -477,31 +492,33 @@
<template id="opt_blog_rc_follow_us" name="Subscription" priority="4"
inherit_id="website_blog.index_right" active="True" customize_show="True">
<xpath expr="//div[@id='main_column']" position="attributes">
<attribute name="class">col-md-8</attribute>
<attribute name="class">col</attribute>
</xpath>
<xpath expr="//div[@id='blog_right_column']" position="inside">
<section class="mt32">
<h4>Stay updated :</h4>
<t t-if="blog">
<t t-call="website_mail.follow">
<t t-set="email" t-value="user_id.email"/>
<t t-set="object" t-value="blog"/>
<div class="card mb-3 bg-secondary">
<h6 class="card-header"><b>Stay updated</b></h6>
<div class="card-body">
<span>Participate on our social stream.</span>
<h2 class="mt4">
<a t-att-href="website.social_facebook" t-if="website.social_facebook" aria-label="Facebook" title="Facebook"><i class="fa fa-facebook-square"/></a>
<a t-att-href="website.social_twitter" t-if="website.social_twitter" aria-label="Twitter" title="Twitter"><i class="fa fa-twitter"/></a>
<a t-att-href="website.social_linkedin" t-if="website.social_linkedin" aria-label="LinkedIn" title="LinkedIn"><i class="fa fa-linkedin"/></a>
<a t-att-href="website.social_youtube" t-if="website.social_youtube" aria-label="Youtube" title="Youtube"><i class="fa fa-youtube-play"/></a>
<a t-att-href="website.social_googleplus" t-if="website.social_googleplus" aria-label="Google Plus" title="Google Plus"><i class="fa fa-google-plus-square"/></a>
<a t-att-href="website.social_github" t-if="website.social_github" aria-label="Github" title="Github"><i class="fa fa-github"/></a>
<a t-att-href="website.social_instagram" t-if="website.social_instagram" aria-label="Instagram" title="Instagram"><i class="fa fa-instagram"/></a>
<a t-att-href="'/blog/%s/feed' % (blog.id)" aria-label="RSS" title="RSS"><i class="fa fa-rss-square"/></a>
</h2>
<hr/>
<t t-if="blog">
<t t-call="website_mail.follow">
<t t-set="email" t-value="user_id.email"/>
<t t-set="object" t-value="blog"/>
<t t-set="div_class" t-value="'mx-auto'"/>
</t>
</t>
</t>
<p class="text-muted mb0 mt16">
Participate on our social stream.
</p>
<h2 class="mt4">
<a t-att-href="website.social_facebook" t-if="website.social_facebook" aria-label="Facebook" title="Facebook"><i class="fa fa-facebook-square"/></a>
<a t-att-href="website.social_twitter" t-if="website.social_twitter" aria-label="Twitter" title="Twitter"><i class="fa fa-twitter"/></a>
<a t-att-href="website.social_linkedin" t-if="website.social_linkedin" aria-label="LinkedIn" title="LinkedIn"><i class="fa fa-linkedin"/></a>
<a t-att-href="website.social_youtube" t-if="website.social_youtube" aria-label="Youtube" title="Youtube"><i class="fa fa-youtube-play"/></a>
<a t-att-href="website.social_googleplus" t-if="website.social_googleplus" aria-label="Google Plus" title="Google Plus"><i class="fa fa-google-plus-square"/></a>
<a t-att-href="website.social_github" t-if="website.social_github" aria-label="Github" title="Github"><i class="fa fa-github"/></a>
<a t-att-href="website.social_instagram" t-if="website.social_instagram" aria-label="Instagram" title="Instagram"><i class="fa fa-instagram"/></a>
<a t-att-href="'/blog/%s/feed' % (blog.id)" aria-label="RSS" title="RSS"><i class="fa fa-rss-square"/></a>
</h2>
</section>
</div>
</div>
</xpath>
</template>
@@ -509,21 +526,23 @@
<template id="opt_blog_rc_status" name="Status" priority="5"
inherit_id="website_blog.index_right" active="True" customize_show="True">
<xpath expr="//div[@id='main_column']" position="attributes">
<attribute name="class">col-md-8</attribute>
<attribute name="class">col</attribute>
</xpath>
<xpath expr="//div[@id='blog_right_column']" position="inside">
<section class="mt32 mb32" groups="website.group_website_designer">
<h4>Status</h4>
<ul class="nav nav-pills flex-column">
<t t-set="state" t-value="state_info['state']"/>
<li class="nav-item">
<a t-attf-href="#{state == 'published' and blog_url(state='') or blog_url(state='published')}" t-attf-class="nav-link#{state == 'published' and ' active' or ''}">Published <span class="float-right badge badge-pill" t-esc="state_info['published']" /></a>
</li>
<li class="nav-item">
<a t-attf-href="#{state == 'unpublished' and blog_url(state='') or blog_url(state='unpublished')}" t-attf-class="nav-link#{state == 'unpublished' and ' active' or ''}">Unpublished <span class="float-right badge badge-pill" t-esc="state_info['unpublished']" /></a>
</li>
</ul>
</section>
<div class="card mb-3 bg-secondary">
<h6 class="card-header"><b>Status</b></h6>
<div class="card-body">
<ul class="list-group">
<t t-set="state" t-value="state_info['state']"/>
<li t-attf-class="list-group-item#{state == 'published' and ' active' or ''}">
<a t-attf-class="text-dark#{state == 'published' and ' text-white' or ''}" t-attf-href="#{state == 'published' and blog_url(state='') or blog_url(state='published')}"><i class="fa fa-eye mr-2"></i><strong><span t-esc="state_info['published']" /></strong> published</a>
</li>
<li t-attf-class="list-group-item#{state == 'unpublished' and ' active' or ''}">
<a t-attf-class="text-dark#{state == 'unpublished' and ' text-white' or ''}" t-attf-href="#{state == 'unpublished' and blog_url(state='') or blog_url(state='unpublished')}"><i class="fa fa-edit mr-2"></i><strong><span t-esc="state_info['unpublished']" /></strong> unpublished</a>
</li>
</ul>
</div>
</div>
</xpath>
</template>
@@ -531,21 +550,23 @@
<template id="opt_blog_rc_blogs" name="Our Blogs" priority="6"
inherit_id="website_blog.index_right" active="True" customize_show="True">
<xpath expr="//div[@id='main_column']" position="attributes">
<attribute name="class">col-md-8</attribute>
<attribute name="class">col</attribute>
</xpath>
<xpath expr="//div[@id='blog_right_column']" position="inside">
<section class="mt32 mb32">
<h4>Our Blogs</h4>
<ul class="nav nav-pills flex-column">
<t t-foreach="blogs" t-as="nav_blog">
<li class="nav-item">
<a t-attf-href="#{blog_url(blog=nav_blog, tag=False, date_begin=False, date_end=False)}" t-attf-class="nav-link#{nav_blog.id == blog.id and ' active' or ''}">
<span t-field="nav_blog.name"/>
</a>
</li>
</t>
</ul>
</section>
<div class="card mb-3 bg-secondary">
<h6 class="card-header"><b>Our Blogs</b></h6>
<div class="card-body">
<ul class="nav nav-pills flex-column">
<t t-foreach="blogs" t-as="nav_blog">
<li class="nav-item">
<a t-attf-href="#{blog_url(blog=nav_blog, tag=False, date_begin=False, date_end=False)}" t-attf-class="nav-link#{nav_blog.id == blog.id and ' active' or ''}">
<span t-field="nav_blog.name"/>
</a>
</li>
</t>
</ul>
</div>
</div>
</xpath>
</template>