odoo/addons/website_mail/views/website_mail.xml

140 lines
7.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Mail group for the company's news -->
<record id="website_mail_blog" model="mail.group">
<field name="name">News</field>
<field name="public">public</field>
<field name="description">News displayed on your website</field>
</record>
<!-- 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_mail.website_mail_blog)d/">News</a></li>
</xpath>
<xpath expr="//body/footer//div[@name='info']/ul" position="inside">
<li><a href="/blog/%(website_mail.website_mail_blog)d/">News</a></li>
</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_mail/static/src/js/blog.js"></script>
<link rel='stylesheet' href='/website_mail/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">
<a t-if="mail_group_id and editable" t-attf-href="/blog/#{ mail_group_id }/new" class="btn btn-default">New Blog Post</a>
<div>
<form action="./subscribe" method="POST" class="form-inline" t-if="not subscribe">
<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">Subscribe</button>
</form>
<form action="./unsubscribe" method="POST" class="form-inline" t-if="subscribe">
<input type="hidden" name="email" t-att-value="subscribe" style="display: none"/>
<button type="submit" class="btn btn-default" name="unsubscribe">Unsubscribe</button>
</form>
</div>
</div>
<div class="col-md-9" t-if="blog_id">
<div class="media">
<div class="media-body">
<t t-call="website.publish"><t t-set="object" t-value="blog_id"/></t>
<h3 t-field="blog_id.subject"/>
<div t-field="blog_id.body"/>
<small class="pull-right muted text-right">
<div t-field="blog_id.date"/>
</small>
</div>
<ul class="media-list" id="comment" t-if="not unable_editor">
<li t-foreach="blog_id.child_ids" t-as="comment" class="media">
<div class="media-body">
<t t-call="website.publish"><t t-set="object" t-value="comment"/></t>
<t t-raw="comment.body"/>
<small class="pull-right muted text-right">
<div t-field="comment.author_id"/>
<div t-field="comment.date"/>
</small>
</div>
</li>
</ul>
<form id="post" t-if="not unable_editor" t-attf-action="/blog/#{ blog_id.res_id }/#{ blog_id.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>
</div>
<div class="col-md-8" t-if="not blog_id and blog_ids">
<ul class="media-list">
<li t-foreach="blog_ids" t-as="blog" class="media well thumbnail" data-publish="">
<div class="media-body">
<t t-call="website.publish"><t t-set="object" t-value="blog"/></t>
<h4 class="media-heading" ><a t-attf-href="/blog/#{ blog.res_id }/#{ blog.id }#comment" t-field="blog.subject"></a></h4>
<div class="media">
<div t-field="blog.body"/>
<small class="pull-left muted text-right" t-if="len(blog.child_ids)">
<a t-if="len(blog.child_ids) &lt;= 1" t-attf-href="/blog/#{ blog.res_id }/#{ blog.id }#comment"><t t-esc="len(blog.child_ids)"/> Comment</a>
<a t-if="len(blog.child_ids) > 1" t-attf-href="/blog/#{ blog.res_id }/#{ blog.id }#comment"><t t-esc="len(blog.child_ids)"/> Comments</a>
</small>
<small class="pull-right muted text-right">
<div t-field="blog.date"/>
</small>
</div>
</div>
</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_mail.index" inherit_option_id="website_mail.index" name="Author">
<xpath expr="//div[@t-field='blog_id.date']" position="before">
<div t-field="blog_id.author_id"/>
</xpath>
<xpath expr="//div[@t-field='blog.date']" position="before">
<div t-field="blog.author_id"/>
</xpath>
</template>
<template id="blog_history" inherit_id="website_mail.index" inherit_option_id="website_mail.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/#{ mail_group_id }/">BLOG ARCHIVE</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['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="date"/> <small>(<t t-esc="date_count"/>)</small></a>
<ul class="nav list-group nav-stacked nav-hierarchy"/>
</li>
</t>
</ul>
</li>
</ul>
</xpath>
</template>
</data>
</openerp>