odoo/addons/website_blog/views/website_blog_templates.xml

147 lines
7.3 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 Short">
<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"> <t t-field="blog_post.create_date"/></span> &amp;nbsp;
<span class="icon-user"> By <t t-field="blog_post.create_uid"/></span> &amp;nbsp;
<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>
<!-- 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"><t t-set="object" t-value="blog_post"/></t>
<small class="text-muted">
<t t-field="blog_post.create_uid"/> on <t t-field="blog_post.create_date"/>
</small>
<h3 t-field="blog_post.name"/>
<t t-foreach="blog_post.tag_ids" t-as="tag">
<a class="label label-default" href="/blog/tag/#{tag.id}"><t t-esc="tag.name"/></a>
</t>
<div t-field="blog_post.content"/>
</div>
<hr />
<div class="clearfix">
<div class="pull-right text-right">
<t t-call="website.pager" class="pull-right"/>
</div>
<t t-if="len(blog_post.website_message_ids) &lt;= 1">
<t t-esc="len(blog_post.website_message_ids)"/> 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">
<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"><t t-set="object" t-value="message"/></t>
<t t-raw="message.body"/>
<small class="pull-left text-muted text-left">
<t t-field="message.author_id"/> on <t t-field="message.date"/>
</small>
</div>
</li>
</ul>
</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-raw="head or ''"/>
</t>
<t t-set="title">Blog</t>
<div id="wrap">
<div class="container mt48 js_website_blog">
<div class="row">
<div class="col-md-3" id="left_column">
<h4>Categories</h4>
<ul class="nav nav-pills nav-stacked">
<t t-foreach="categories" t-as="nav_category">
<li t-att-class="'active' if category and category.id == nav_category.id else ''">
<a t-attf-href="/blog/#{nav_category.id}">
<t t-field="nav_category.name"/>
</a>
</li>
</t>
</ul>
<t t-if="category">
<a t-if="editable" t-attf-href="/blog/#{category.id}/new" class="btn btn-default">New Blog Post</a>
<t t-call="website_mail.follow"><t t-set="object" t-value="category"/></t>
</t>
</div>
<div class="col-md-9" 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-md-9" t-if="not blog_post and blog_posts">
<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>
</div>
</div>
</div>
</t>
</template>
<!-- Option: archives -->
<template id="blog_history" inherit_id="website_blog.index" inherit_option_id="website_blog.index" name="Archives">
<xpath expr="//div[@id='left_column']" position="inside">
<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>
</xpath>
</template>
</data>
</openerp>