1 <?xml version="1.0" encoding="utf-8"?>
5 <!-- Mail group for the company's news -->
7 <record id="website_mail_blog" model="mail.group">
8 <field name="name">News</field>
9 <field name="public">public</field>
10 <field name="description">News displayed on your website</field>
13 <!-- Layout add nav and footer -->
15 <record id="header_website_mail" model="ir.ui.view">
16 <field name="name">header_website_mail</field>
17 <field name="inherit_id" ref="website.header"/>
18 <field name="arch" type="xml">
20 <xpath expr="//li[last()]" position="after">
21 <li class="pull-right"><a href="/blog/%(website_mail.website_mail_blog)d/">News</a></li>
26 <record id="footer_website_mail" model="ir.ui.view">
27 <field name="name">footer_website_mail</field>
28 <field name="inherit_id" ref="website.footer"/>
29 <field name="arch" type="xml">
31 <xpath expr="//a[@href='/page/website.news']" position="replace">
32 <a href="/blog/%(website_mail.website_mail_blog)d/">News</a>
41 <t t-call="website.layout">
43 <script type="text/javascript" src="/website_mail/static/src/js/blog.js"></script>
44 <link rel='stylesheet' href='/website_mail/static/src/css/blog.css'/>
47 <t t-set="title">Blog</t>
48 <div class="container mt48 js_website_mail">
51 <ul class="nav nav-list">
52 <a t-if="mail_group_id and editable" t-att-href="'/blog/%%s/new' %% mail_group_id" class="btn">Add a new Blog</a>
53 <li class="nav-header"><a t-att-href="'/blog/%%s/' %% mail_group_id">BLOG ARCHIVE</a></li>
54 <!-- TODO: check qweb iteration -->
55 <li t-foreach="nav_list" t-as="year" class="js_nav_year">
56 <t t-set="year" t-value="nav_list[year]"/>
57 <a href="#"><t t-esc="year['name']"/> <small>(<t t-esc="year['date_count']"/>)</small></a>
58 <ul class="nav nav-list css_nav_month">
59 <t t-foreach="year['months']">
60 <li class="js_nav_month"><a href="#" t-att-data-domain="__domain"><t t-esc="date"/> <small>(<t t-esc="date_count"/>)</small></a>
61 <ul class="nav nav-list"/>
66 <form action="./subscribe" method="POST" class="form-inline" t-if="not subscribe">
67 <input placeholder="Email Address" type="email" name="email" class="input-medium" t-if="request.uid == request.public_uid"/>
68 <button type="submit" class="btn btn-primary" name="subscribe">Subscribe</button>
70 <form action="./unsubscribe" method="POST" class="form-inline" t-if="subscribe">
71 <input type="hidden" name="email" t-att-value="subscribe"/>
72 <button type="submit" class="btn" name="unsubscribe">Unsubscribe</button>
76 <div class="span8" t-if="blog_id">
78 <div class="media-body well">
79 <a href="#" t-att-data-id="blog_id.id" class="pull-right" t-if="editable">
80 <span t-att-class="'label label-success js_unpublish %%s' %% (not blog_id.website_published and 'hidden' or '')">Click to Unpublish</span>
81 <span t-att-class="'label label-important js_publish %%s' %% (blog_id.website_published and 'hidden' or '')">Click to Publish</span>
83 <h3 t-field="blog_id.subject"/>
84 <div t-field="blog_id.body"/>
85 <small class="pull-right muted text-right">
86 <div t-field="blog_id.author_id"/>
87 <div t-field="blog_id.date"/>
90 <ul class="media-list" id="comment">
91 <li t-foreach="blog_id.child_ids" t-as="comment" class="media">
92 <div class="media-body">
93 <a href="#" t-att-data-id="blog_id.id" class="pull-right" t-if="editable">
94 <span t-att-class="'label label-success js_unpublish %%s' %% (not comment.website_published and 'hidden' or '')">Click to Unpublish</span>
95 <span t-att-class="'label label-important js_publish %%s' %% (comment.website_published and 'hidden' or '')">Click to Publish</span>
97 <t t-raw="comment.body"/>
98 <small class="pull-right muted text-right">
99 <div t-esc="comment.author_id"/>
100 <div t-esc="comment.date"/>
104 <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">
105 <textarea rows="4" placeholder="Your message" class="span7"> </textarea>
106 <button type="submit" class="btn">Post your message</button>
111 <div class="span8" t-if="not blog_id and blog_ids">
112 <ul class="media-list">
113 <li t-foreach="blog_ids" t-as="blog" class="media well">
114 <div t-att-class="'media-body %%s' %% (blog.website_published and 'css_published' or '')">
115 <a href="#" t-att-data-id="blog.id" class="pull-right" t-if="editable">
116 <span t-att-class="'label label-success js_unpublish %%s' %% (not blog.website_published and 'hidden' or '')">Click to Unpublish</span>
117 <span t-att-class="'label label-important js_publish %%s' %% (blog.website_published and 'hidden' or '')">Click to Publish</span>
119 <h4 class="media-heading" ><a t-att-href="'/blog/%%s/%%s#comment' %% (blog.res_id, blog.id)" t-field="blog.subject"></a></h4>
121 <div t-field="blog.body"/>
122 <small class="pull-left muted text-right" t-if="len(blog.child_ids)">
123 <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>
124 <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>
126 <small class="pull-right muted text-right">
127 <div t-field="blog.author_id"/>
128 <div t-field="blog.author_id"/>
135 <li t-if="next_date" class="previous">
136 <a t-att-href="'?date=%%s' %% (next_date)">&larr; Older</a>
138 <li t-if="prev_date" class="next">
139 <a t-att-href="'?date=%%s' %% (prev_date)">Newer &rarr;</a>