odoo/addons/website_blog/views/website_templates.xml

170 lines
9.0 KiB
XML

<?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="//body/header//ul[@id='top_menu']/li[last()]" position="before">
<li><a href="/blog/%(website_blog.blog_category_1)d/">News</a></li>
</xpath>
<xpath expr="//body/footer//div[@name='info']/ul" position="inside">
<li><a href="/blog/%(website_blog.blog_category_1)d/">News</a></li>
</xpath>
</template>
<!-- Follow button -->
<template id="blog_post_unfollow" name="Follow">
<form t-attf-action="/blog/#{object.category_id.id}/#{object.id}/unsubscribe" method="POST" class="form-inline" t-if="object.message_is_follower">
<input type="hidden" name="email" t-att-value="subscribe" style="display: none"/>
<button type="submit" class="btn btn-sm btn-default pull-right" name="unsubscribe">Unfollow</button>
</form>
</template>
<template id="blog_post_follow" name="Follow">
<form t-attf-action="/blog/#{object.category_id.id}/#{object.id}/subscribe" method="POST" class="form-inline" t-if="not object.message_is_follower">
<div class="col-lg-7">
<input placeholder="Email Address" type="email" name="email" class="form-control" t-if="is_public_user"/>
</div>
<button type="submit" class="btn btn-sm btn-primary pull-right" name="subscribe">Follow</button>
</form>
</template>
<!-- Post -->
<template id="blog_post_short" name="Blog Post">
<div class="media-body">
<t t-call="website_blog.blog_post_follow"><t t-set="object" t-value="blog_post"/></t>
<t t-call="website_blog.blog_post_unfollow"><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>
<h4 class="media-heading" ><a t-attf-href="/blog_post/#{blog_post.category_id.id}/#{blog_post.id}#comment" t-field="blog_post.name"></a></h4>
<div class="media">
<div t-field="blog_post.shortened_content"/>
<small class="pull-left muted text-right">
<a t-if="len(blog_post.message_ids) &lt;= 1" t-attf-href="/blog/#{blog_post.category_id.id}/#{blog_post.id}#comment"><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}#comment"><t t-esc="len(blog_post.message_ids)"/> Comments</a>
</small>
</div>
</div>
</template>
<template id="blog_post" name="Blog Post">
<div class="media">
<div class="media-body">
<t t-call="website_blog.blog_post_follow"><t t-set="object" t-value="blog_post"/></t>
<t t-call="website_blog.blog_post_unfollow"><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"/>
<div t-field="blog_post.content"/>
</div>
<ul class="media-list" id="comment">
<li t-foreach="blog_post.website_message_ids" t-as="message" class="media">
<div class="media-body">
<t t-call="website.publish"><t t-set="object" t-value="message"/></t>
<t t-raw="message.body"/>
<small class="pull-right muted text-right">
<div t-field="message.author_id"/>
<div t-field="message.date"/>
</small>
</div>
</li>
</ul>
<form id="blog" t-attf-action="/blog/#{blog_post.category_id.id}/#{blog_post.id}/post#post"
method="POST" class="form-horizontal text-center"
groups="group_website_mail_reply">
<textarea rows="4" placeholder="Your comment" class="col-md-7 form-control"></textarea>
<button type="submit" class="btn btn-default">Post your comment</button>
</form>
</div>
</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/blog.js"></script>
<link rel='stylesheet' href='/website_blog/static/src/css/blog.css'/>
<t t-raw="head or ''"/>
</t>
<t t-set="title">Blog</t>
<div id="wrap">
<div class="container mt48 js_website_mail">
<div class="row">
<div class="col-md-3" id="left_column">
<t t-if="category">
Latests posts on <t t-field="category.name"/>
<a t-if="editable" t-attf-href="/blog/new" class="btn btn-default">New Blog Post</a>
<div>
<form t-attf-action="/blog/#{category.id}/subscribe"
method="POST" class="form-inline"
t-if="not category.message_is_follower">
<div class="col-lg-7">
<input placeholder="Email Address" type="email" name="email" class="form-control" t-if="is_public_user"/>
</div>
<button type="submit" class="btn btn-primary" name="subscribe">Follow</button>
</form>
<form t-attf-action="/blog/#{category.id}/unsubscribe"
method="POST" class="form-inline"
t-if="category.message_is_follower">
<input type="hidden" name="email" t-att-value="subscribe" style="display: none"/>
<button type="submit" class="btn btn-default" name="unsubscribe">Unfollow</button>
</form>
</div>
</t>
</div>
<div class="col-md-9" t-if="blog_post">
<t t-call="website_blog.blog_post"><t t-set="blog_post" t-value="blog_post"/></t>
</div>
<div class="col-md-8" t-if="not blog_post and blog_posts">
<ul class="media-list">
<li t-foreach="blog_posts" t-as="blog_post" data-publish="">
<t t-call="website_blog.blog_post_short"><t t-set="blog_post" t-value="blog_post"/></t>
</li>
</ul>
<div class="text-center">
<t t-call="website.pager"/>
</div>
</div>
</div>
</div>
</div>
</t>
</template>
<template id="blog_author" inherit_id="website_blog.index" inherit_option_id="website_blog.index" name="Author">
<!-- <xpath expr="//div[@t-field='document_page.create_date']" position="before">
<div t-field="document_page.author_id"/>
</xpath>
<xpath expr="//div[@t-field='blog.create_date']" position="before">
<div t-field="blog.author_id"/>
</xpath> -->
</template>
<template id="blog_history" inherit_id="website_blog.index" inherit_option_id="website_blog.index" name="History">
<xpath expr="//div[@id='left_column']" position="inside">
<ul class="nav nav-pills nav-stacked">
<li class="nav-header"><a t-attf-href="/blog/#{category_id}/">Archives</a></li>
<!-- TODO: check qweb iteration -->
<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>