[IMP] website_mail: button add a new blog; link on header and footer
bzr revid: chm@openerp.com-20130730085027-beo81wr0ru1m6q2d
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
<template id="footer">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="span4">
|
||||
<div class="span4" name="product">
|
||||
<h5>Product and services</h5>
|
||||
<ul>
|
||||
<li><a href="https://www.openerp.com/start?download">Download</a></li>
|
||||
@@ -28,7 +28,7 @@
|
||||
<li><a href="http://runbot.openerp.com">Automated Tests</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="span4">
|
||||
<div class="span4" name="social">
|
||||
<h5>Social</h5>
|
||||
<ul>
|
||||
<li><a href="http://twitter.com/openerp"><i class="icon-twitter-sign"></i>Twitter</a></li>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<t t-set="title">Thank You!</t>
|
||||
<div class="container">
|
||||
<div class="oe_row">
|
||||
<h2 class="oe_slogan">Thanks for your message.</h2>
|
||||
<h2 class="oe_slogan">Thanks for your message.</h2>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
@@ -96,19 +96,10 @@ class website_mail(website):
|
||||
return werkzeug.utils.redirect("/blog/%s/%s" % (mail_group_id, blog_id))
|
||||
|
||||
@website.route(['/blog/<int:mail_group_id>/new'], type='http', auth="admin")
|
||||
def new_blog(self, cr, uid, mail_group_id=None, **post):
|
||||
values = {
|
||||
'res_company': request.registry['res.company'].browse(cr, uid, 1),
|
||||
'mail_group_id': mail_group_id,
|
||||
}
|
||||
html = self.render(cr, uid, "website_mail.new_blog", values)
|
||||
return html
|
||||
|
||||
@website.route(['/blog/<int:mail_group_id>/new/post'], type='http', auth="admin")
|
||||
def new_blog_post(self, cr, uid, mail_group_id=None, **post):
|
||||
blog_id = request.registry['mail.group'].message_post(cr, uid, mail_group_id,
|
||||
body=post['body'],
|
||||
subject=post['subject'],
|
||||
body=_("Blog content.<br/>Please edit this content then you can publish this blog."),
|
||||
subject=_("Blog title"),
|
||||
website_published=False,
|
||||
type='comment',
|
||||
subtype='mt_comment',
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
<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">
|
||||
@@ -9,8 +17,19 @@
|
||||
<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">Blog</a></li>
|
||||
<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>
|
||||
@@ -30,7 +49,7 @@
|
||||
<div class="row">
|
||||
<div class="span4">
|
||||
<ul class="nav nav-list">
|
||||
<a t-if="mail_group_id" t-att-href="'/blog/%%s/new' %% mail_group_id" class="btn" groups="group_website_mail_manager">Post new Blog</a>
|
||||
<a t-if="mail_group_id" t-att-href="'/blog/%%s/new' %% mail_group_id" class="btn" groups="group_website_mail_manager">Add a new Blog</a>
|
||||
<li class="nav-header">BLOG ARCHIVE</li>
|
||||
<!-- TODO: check qweb iteration -->
|
||||
<t t-foreach="nav_list" t-as="year">
|
||||
@@ -116,24 +135,5 @@
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
<template id="new_blog">
|
||||
<t t-call="website.layout">
|
||||
<t t-set="title">Blog</t>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="span4"> </div>
|
||||
<div class="span8">
|
||||
<form id="post" t-att-action="'/blog/%%s/new/post' %% mail_group_id" method="POST" class="form-horizontal text-center">
|
||||
<h4>Create your new Blog post</h4>
|
||||
<input type="text" name="subject" placeholder="Title" class="span8"/>
|
||||
<textarea rows="14" name="body" placeholder="Content" class="span8"> </textarea>
|
||||
<button type="submit" class="btn">Post your Blog</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
Reference in New Issue
Block a user