odoo/addons/website_blog/views/website_blog_templates.xml

262 lines
13 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Layout add nav and footer -->
<template id="header_footer_custom" inherit_id="website.layout">
<xpath expr="//header//ul[@id='top_menu']/li[@name='contactus']" position="before">
<li><a href="/blog/%(website_blog.blog_category_1)d/">News</a></li>
</xpath>
<xpath expr="//footer//div[@name='info']/ul" position="inside">
<li><a href="/blog/%(website_blog.blog_category_1)d/">News</a></li>
</xpath>
</template>
<!-- Blog Post Summary -->
<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}" 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> &amp;nbsp;
<span class="icon-user"> By <span t-field="blog_post.create_uid"/> &amp;nbsp;</span>
<span t-if="len(blog_post.message_ids) &gt; 0" class="icon-comment"> With
<a t-if="len(blog_post.message_ids) &lt;= 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>
</span>
</p>
<div t-field="blog_post.shortened_content" class="blog_content"/>
<hr/>
</div>
</template>
<!-- Options: Blog Post Summary: hide author -->
<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>
<!-- Options: Blog Post Summary: show category -->
<template id="view_blog_post_short_category" inherit_option_id="website_blog.view_blog_post_short" name="Show Blog Name">
<xpath expr="//span[@class='icon-user']" position="after">
<span class="icon-folder-open"> In <span t-field="blog_post.category_id"/> &amp;nbsp;</span>
</xpath>
</template>
<!-- Blog Post Complete -->
<template id="view_blog_post" name="Blog Post">
<div>
<t t-call="website.publish_management">
<t t-set="object" t-value="blog_post"/>
<t t-set="publish_edit" t-value="True"/>
</t>
</div><div class="clearfix"/>
<h1 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> &amp;nbsp;
<span class="icon-user"> By <span t-field="blog_post.create_uid"/> &amp;nbsp;</span>
<span t-if="len(blog_post.message_ids) &gt; 0" class="icon-comment"> With
<a t-if="len(blog_post.message_ids) &lt;= 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>
</span>
</p>
<p class="post-meta text-muted text-center" t-if="len(blog_post.tag_ids)">
<span class="icon-tags"/>
<t t-foreach="blog_post.tag_ids" t-as="tag">
<a t-attf-href="/blog/tag/#{tag.id}" t-esc="tag.name"/> &amp;nbsp;
</t>
</p>
<div t-field="blog_post.content" class="mt16"/>
<hr class="mb32"/>
<a id="comments"/>
<h4 t-if="len(blog_post.website_message_ids)" class="mb16">
<t t-if="len(blog_post.website_message_ids) &lt;= 1">
1 Comment
</t>
<t t-if="len(blog_post.website_message_ids) > 1">
<t t-esc="len(blog_post.website_message_ids)"/> Comments
</t>
</h4>
<ul class="media-list">
<li t-foreach="blog_post.website_message_ids" t-as="message" class="media">
<div class="media-body">
<img class="media-object pull-left" t-att-src="'/website/image?model=res.partner&amp;field=image_small&amp;id='+str(message.author_id.id)" style="width: 50px; margin-right: 10px;"/>
<div class="media-body">
<t t-call="website.publish_short">
<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>
</template>
<!-- Options: Blog Post: user can reply -->
<template id="view_blog_post_author" inherit_option_id="website_blog.view_blog_post" name="Hide Authors">
<xpath expr="//ul[last()]" position="after">
<section groups="group_website_blog_reply" class="mb32">
<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.partner&amp;field=image_small&amp;id='+str(user_id.partner_id.id)" style="width: 50px; margin-right: 10px;"/>
<div class="pull-left mb32" 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>
</xpath>
</template>
<!-- Options: Blog Post: hide author -->
<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>
<!-- Options: Blog Post: show category -->
<template id="view_blog_post_show_category" inherit_option_id="website_blog.view_blog_post" name="Show Blog Name">
<xpath expr="//span[@class='icon-user']" position="after">
<span class="icon-folder-open"> In <span t-field="blog_post.category_id"/> &amp;nbsp;</span>
</xpath>
</template>
<!-- Page -->
<template id="index" name="Blogs" page="True">
<t t-call="website.layout">
<t t-set="head">
<script type="text/javascript" src="/website_blog/static/src/js/website_blog.js"></script>
<link rel='stylesheet' href='/website_blog/static/src/css/website_blog.css'/>
</t>
<t t-set="title">Blog</t>
<div id="wrap">
<div class="container mt16 js_website_blog">
<div class="row">
<div class="col-lg-8 col-sm-9" t-if="not blog_post">
<t t-foreach="blog_posts" t-as="blog_post" data-publish="">
<t t-call="website_blog.view_blog_post_short"/>
</t>
<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>
</div>
</div>
</t>
</template>
<!-- Option: right column -->
<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: Right Column: 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>
<ul class="nav nav-pills nav-stacked">
<li t-foreach="nav_list" t-as="year" class="js_nav_year">
<t t-set="year" t-value="nav_list[year]"/>
<a href="#"><t t-esc="year['name']"/> <small>(<t t-esc="year['create_date_count']"/>)</small></a>
<ul class="nav list-group css_nav_month nav-stacked nav-hierarchy">
<t t-foreach="year['months']">
<li class="js_nav_month"><a href="#" t-att-data-domain="__domain"><t t-esc="create_date"/> <small>(<t t-esc="create_date_count"/>)</small></a>
<ul class="nav list-group nav-stacked nav-hierarchy"/>
</li>
</t>
</ul>
</li>
</ul>
</section>
</xpath>
</template>
<!-- Option: Right Column: about us -->
<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>
<p>
Write here a small text for <b>new visitors</b> finding your website
through your <b>blog entries</b>, referenced in Google.
</p>
<div>
<button src="/contactus" class="btn btn-primary">Contact us</button>
</div>
</section>
</xpath>
</template>
<!-- Option: Right Column: follow us -->
<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>
<t t-if="category">
<p class="text-muted">
Be notified of new blog posts in <t t-esc="category.name"/>
</p>
<t t-call="website_mail.follow">
<t t-set="email" t-value="user_id.email"/>
<t t-set="object" t-value="category"/>
</t>
</t>
<p class="text-muted">
Participate on our social stream.
</p>
<h2>
<a t-att-href="website.social_facebook" t-if="website.social_facebook"><i class="icon-facebook-sign"/></a>
<a t-att-href="website.social_twitter" t-if="website.social_twitter"><i class="icon-twitter-sign"/></a>
<a t-att-href="website.social_linkedin" t-if="website.social_linkedin"><i class="icon-linkedin-sign"/></a>
<a t-att-href="website.social_youtube" t-if="website.social_youtube"><i class="icon-youtube-sign"/></a>
<a t-att-href="website.social_googleplus" t-if="website.social_googleplus"><i class="icon-google-plus-sign"/></a>
<a t-att-href="website.social_github" t-if="website.social_github"><i class="icon-github-sign"/></a>
</h2>
</section>
</xpath>
</template>
<!-- Option: Right Column: categories + category in blog post -->
<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>
<ul class="nav nav-pills nav-stacked">
<t t-foreach="categories" t-as="nav_category">
<li>
<a t-attf-href="/blog/#{nav_category.id}">
<span t-field="nav_category.name"/>
</a>
</li>
</t>
</ul>
</section>
</xpath>
</template>
</data>
</openerp>