149 lines
9.0 KiB
XML
149 lines
9.0 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 -->
|
|
|
|
<record id="header_website_mail" model="ir.ui.view">
|
|
<field name="name">header_website_mail</field>
|
|
<field name="inherit_id" ref="website.header"/>
|
|
<field name="arch" type="xml">
|
|
<data>
|
|
<xpath expr="//li[last()]" position="after">
|
|
<li class="pull-right"><a href="/blog/%(website_mail.website_mail_blog)d/">News</a></li>
|
|
</xpath>
|
|
</data>
|
|
</field>
|
|
</record>
|
|
<record id="footer_website_mail" model="ir.ui.view">
|
|
<field name="name">footer_website_mail</field>
|
|
<field name="inherit_id" ref="website.footer"/>
|
|
<field name="arch" type="xml">
|
|
<data>
|
|
<xpath expr="//a[@href='/page/website.news']" position="replace">
|
|
<a href="/blog/%(website_mail.website_mail_blog)d/">News</a>
|
|
</xpath>
|
|
</data>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- Page -->
|
|
|
|
<template id="index">
|
|
<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"/>
|
|
</t>
|
|
<t t-set="title">Blog</t>
|
|
<div class="container mt48 js_website_mail">
|
|
<div class="row">
|
|
<div class="span4">
|
|
<ul class="nav nav-list">
|
|
<a t-if="mail_group_id and editable" t-att-href="'/blog/%%s/new' %% mail_group_id" class="btn">Add a new Blog</a>
|
|
<li class="nav-header"><a t-att-href="'/blog/%%s/' %% 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 nav-list css_nav_month">
|
|
<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 nav-list"/>
|
|
</li>
|
|
</t>
|
|
</ul>
|
|
</li>
|
|
<form action="./subscribe" method="POST" class="form-inline" t-if="not subscribe">
|
|
<input placeholder="Email Address" type="email" name="email" class="input-medium" t-if="request.uid == request.public_uid"/>
|
|
<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"/>
|
|
<button type="submit" class="btn" name="unsubscribe">Unsubscribe</button>
|
|
</form>
|
|
</ul>
|
|
</div>
|
|
<div class="span8" t-if="blog_id">
|
|
<div class="media">
|
|
<div class="media-body well">
|
|
<a href="#" t-att-data-id="blog_id.id" class="pull-right" t-if="editable">
|
|
<span t-att-class="'label label-success js_unpublish %%s' %% (not blog_id.website_published and 'hidden' or '')">Click to Unpublish</span>
|
|
<span t-att-class="'label label-important js_publish %%s' %% (blog_id.website_published and 'hidden' or '')">Click to Publish</span>
|
|
</a>
|
|
<h3 t-field="blog_id.subject"/>
|
|
<div t-field="blog_id.body"/>
|
|
<small class="pull-right muted text-right">
|
|
<div t-field="blog_id.author_id"/>
|
|
<div t-field="blog_id.date"/>
|
|
</small>
|
|
</div>
|
|
<ul class="media-list" id="comment">
|
|
<li t-foreach="blog_id.child_ids" t-as="comment" class="media">
|
|
<div class="media-body">
|
|
<a href="#" t-att-data-id="blog_id.id" class="pull-right" t-if="editable">
|
|
<span t-att-class="'label label-success js_unpublish %%s' %% (not comment.website_published and 'hidden' or '')">Click to Unpublish</span>
|
|
<span t-att-class="'label label-important js_publish %%s' %% (comment.website_published and 'hidden' or '')">Click to Publish</span>
|
|
</a>
|
|
<t t-raw="comment.body"/>
|
|
<small class="pull-right muted text-right">
|
|
<div t-esc="comment.author_id"/>
|
|
<div t-esc="comment.date"/>
|
|
</small>
|
|
</div>
|
|
</li>
|
|
<form id="post" t-att-action="'/blog/%%s/%%s/post#post' %% (blog_id.res_id, blog_id.id)" method="POST" class="form-horizontal text-center" groups="group_website_mail_reply">
|
|
<textarea rows="4" placeholder="Your message" class="span7"> </textarea>
|
|
<button type="submit" class="btn">Post your message</button>
|
|
</form>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="span8" t-if="not blog_id and blog_ids">
|
|
<ul class="media-list">
|
|
<li t-foreach="blog_ids" t-as="blog" class="media well">
|
|
<div t-att-class="'media-body %%s' %% (blog.website_published and 'css_published' or '')">
|
|
<a href="#" t-att-data-id="blog.id" class="pull-right" t-if="editable">
|
|
<span t-att-class="'label label-success js_unpublish %%s' %% (not blog.website_published and 'hidden' or '')">Click to Unpublish</span>
|
|
<span t-att-class="'label label-important js_publish %%s' %% (blog.website_published and 'hidden' or '')">Click to Publish</span>
|
|
</a>
|
|
<h4 class="media-heading" ><a t-att-href="'/blog/%%s/%%s#comment' %% (blog.res_id, blog.id)" 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) <= 1" t-att-href="'/blog/%%s/%%s#comment' %% (blog.res_id, blog.id)"><t t-esc="len(blog.child_ids)"/> Message</a>
|
|
<a t-if="len(blog.child_ids) > 1" t-att-href="'/blog/%%s/%%s#comment' %% (blog.res_id, blog.id)"><t t-esc="len(blog.child_ids)"/> Messages</a>
|
|
</small>
|
|
<small class="pull-right muted text-right">
|
|
<div t-field="blog.author_id"/>
|
|
<div t-field="blog.date"/>
|
|
</small>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<ul class="pager">
|
|
<li t-if="next_date" class="previous">
|
|
<a t-att-href="'?date=%%s' %% (next_date)">&larr; Older</a>
|
|
</li>
|
|
<li t-if="prev_date" class="next">
|
|
<a t-att-href="'?date=%%s' %% (prev_date)">Newer &rarr;</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</t>
|
|
</template>
|
|
</data>
|
|
</openerp>
|