[IMP] website_blog: rename "Category" to "Blogs"
bzr revid: chs@openerp.com-20140124162251-3kkn3n17uqum1scu
This commit is contained in:
parent
33d349f33b
commit
16db944365
|
@ -33,7 +33,7 @@ MONTHS = [None, _('January'), _('February'), _('March'), _('April'),
|
|||
|
||||
|
||||
class WebsiteBlog(http.Controller):
|
||||
_category_post_per_page = 6
|
||||
_blog_post_per_page = 6
|
||||
_post_comment_per_page = 6
|
||||
|
||||
def nav_list(self):
|
||||
|
@ -67,31 +67,31 @@ class WebsiteBlog(http.Controller):
|
|||
})
|
||||
|
||||
@http.route([
|
||||
'/blog/<model("blog.category"):category>/',
|
||||
'/blog/<model("blog.category"):category>/page/<int:page>/',
|
||||
'/blog/<model("blog.category"):category>/tag/<model("blog.tag"):tag>/',
|
||||
'/blog/<model("blog.category"):category>/tag/<model("blog.tag"):tag>/page/<int:page>/',
|
||||
'/blog/<model("blog.category"):category>/date/<string(length=21):date>/',
|
||||
'/blog/<model("blog.category"):category>/date/<string(length=21):date>/page/<int:page>/',
|
||||
'/blog/<model("blog.category"):category>/tag/<model("blog.tag"):tag>/date/<string(length=21):date>/',
|
||||
'/blog/<model("blog.category"):category>/tag/<model("blog.tag"):tag>/date/<string(length=21):date>/page/<int:page>/',
|
||||
'/blog/<model("blog.blog"):blog>/',
|
||||
'/blog/<model("blog.blog"):blog>/page/<int:page>/',
|
||||
'/blog/<model("blog.blog"):blog>/tag/<model("blog.tag"):tag>/',
|
||||
'/blog/<model("blog.blog"):blog>/tag/<model("blog.tag"):tag>/page/<int:page>/',
|
||||
'/blog/<model("blog.blog"):blog>/date/<string(length=21):date>/',
|
||||
'/blog/<model("blog.blog"):blog>/date/<string(length=21):date>/page/<int:page>/',
|
||||
'/blog/<model("blog.blog"):blog>/tag/<model("blog.tag"):tag>/date/<string(length=21):date>/',
|
||||
'/blog/<model("blog.blog"):blog>/tag/<model("blog.tag"):tag>/date/<string(length=21):date>/page/<int:page>/',
|
||||
], type='http', auth="public", website=True, multilang=True)
|
||||
def blog(self, category=None, tag=None, date=None, page=1, **opt):
|
||||
def blog(self, blog=None, tag=None, date=None, page=1, **opt):
|
||||
""" Prepare all values to display the blog.
|
||||
|
||||
:param category: category currently browsed.
|
||||
:param blog: blog currently browsed.
|
||||
:param tag: tag that is currently used to filter blog posts
|
||||
:param integer page: current page of the pager. Can be the category or
|
||||
:param integer page: current page of the pager. Can be the blog or
|
||||
post pager.
|
||||
:param date: date currently used to filter blog posts (dateBegin_dateEnd)
|
||||
|
||||
:return dict values: values for the templates, containing
|
||||
|
||||
- 'blog_posts': list of browse records that are the posts to display
|
||||
in a given category, if not blog_post_id
|
||||
- 'category': browse of the current category, if category_id
|
||||
- 'categories': list of browse records of categories
|
||||
- 'pager': the pager to display posts pager in a category
|
||||
in a given blog, if not blog_post_id
|
||||
- 'blog': browse of the current blog, if blog_id
|
||||
- 'blogs': list of browse records of blogs
|
||||
- 'pager': the pager to display posts pager in a blog
|
||||
- 'tag': current tag, if tag_id
|
||||
- 'nav_list': a dict [year][month] for archives navigation
|
||||
"""
|
||||
|
@ -102,19 +102,19 @@ class WebsiteBlog(http.Controller):
|
|||
|
||||
blog_posts = None
|
||||
|
||||
category_obj = request.registry['blog.category']
|
||||
category_ids = category_obj.search(cr, uid, [], context=context)
|
||||
categories = category_obj.browse(cr, uid, category_ids, context=context)
|
||||
blog_obj = request.registry['blog.blog']
|
||||
blog_ids = blog_obj.search(cr, uid, [], context=context)
|
||||
blogs = blog_obj.browse(cr, uid, blog_ids, context=context)
|
||||
|
||||
path_filter = ""
|
||||
domain = []
|
||||
|
||||
if category:
|
||||
path_filter += "%s/" % category.id
|
||||
domain += [("id", "in", [blog.id for blog in category.blog_post_ids])]
|
||||
if blog:
|
||||
path_filter += "%s/" % blog.id
|
||||
domain += [("id", "in", [post.id for post in blog.blog_post_ids])]
|
||||
if tag:
|
||||
path_filter += 'tag/%s/' % tag.id
|
||||
domain += [("id", "in", [blog.id for blog in tag.blog_post_ids])]
|
||||
domain += [("id", "in", [post.id for post in tag.blog_post_ids])]
|
||||
if date:
|
||||
path_filter += "date/%s/" % date
|
||||
domain += [("create_date", ">=", date.split("_")[0]), ("create_date", "<=", date.split("_")[1])]
|
||||
|
@ -126,11 +126,11 @@ class WebsiteBlog(http.Controller):
|
|||
url="/blog/%s" % path_filter,
|
||||
total=len(blog_posts),
|
||||
page=page,
|
||||
step=self._category_post_per_page,
|
||||
step=self._blog_post_per_page,
|
||||
scope=BYPAGE
|
||||
)
|
||||
pager_begin = (page - 1) * self._category_post_per_page
|
||||
pager_end = page * self._category_post_per_page
|
||||
pager_begin = (page - 1) * self._blog_post_per_page
|
||||
pager_end = page * self._blog_post_per_page
|
||||
blog_posts = blog_posts[pager_begin:pager_end]
|
||||
|
||||
tag_obj = request.registry['blog.tag']
|
||||
|
@ -138,8 +138,8 @@ class WebsiteBlog(http.Controller):
|
|||
tags = tag_obj.browse(cr, uid, tag_ids, context=context)
|
||||
|
||||
values = {
|
||||
'category': category,
|
||||
'categories': categories,
|
||||
'blog': blog,
|
||||
'blogs': blogs,
|
||||
'tags': tags,
|
||||
'tag': tag,
|
||||
'blog_posts': blog_posts,
|
||||
|
@ -157,12 +157,12 @@ class WebsiteBlog(http.Controller):
|
|||
""" Prepare all values to display the blog.
|
||||
|
||||
:param blog_post: blog post currently browsed. If not set, the user is
|
||||
browsing the category and a post pager is calculated.
|
||||
browsing the blog and a post pager is calculated.
|
||||
If set the user is reading the blog post and a
|
||||
comments pager is calculated.
|
||||
:param category: category currently browsed.
|
||||
:param blog: blog currently browsed.
|
||||
:param tag: tag that is currently used to filter blog posts
|
||||
:param integer page: current page of the pager. Can be the category or
|
||||
:param integer page: current page of the pager. Can be the blog or
|
||||
post pager.
|
||||
:param date: date currently used to filter blog posts (dateBegin_dateEnd)
|
||||
|
||||
|
@ -171,8 +171,8 @@ class WebsiteBlog(http.Controller):
|
|||
:return dict values: values for the templates, containing
|
||||
|
||||
- 'blog_post': browse of the current post, if blog_post_id
|
||||
- 'category': browse of the current category, if category_id
|
||||
- 'categories': list of browse records of categories
|
||||
- 'blog': browse of the current blog, if blog_id
|
||||
- 'blogs': list of browse records of blogs
|
||||
- 'pager': the pager to display comments pager in a blog post
|
||||
- 'tag': current tag, if tag_id
|
||||
- 'nav_list': a dict [year][month] for archives navigation
|
||||
|
@ -192,17 +192,17 @@ class WebsiteBlog(http.Controller):
|
|||
blog_post.website_message_ids = blog_post.website_message_ids[pager_begin:pager_end]
|
||||
|
||||
cr, uid, context = request.cr, request.uid, request.context
|
||||
category_obj = request.registry['blog.category']
|
||||
category_ids = category_obj.search(cr, uid, [], context=context)
|
||||
categories = category_obj.browse(cr, uid, category_ids, context=context)
|
||||
blog_obj = request.registry['blog.blog']
|
||||
blog_ids = blog_obj.search(cr, uid, [], context=context)
|
||||
blogs = blog_obj.browse(cr, uid, blog_ids, context=context)
|
||||
|
||||
tag_obj = request.registry['blog.tag']
|
||||
tag_ids = tag_obj.search(cr, uid, [], context=context)
|
||||
tags = tag_obj.browse(cr, uid, tag_ids, context=context)
|
||||
|
||||
values = {
|
||||
'category': blog_post.category_id,
|
||||
'categories': categories,
|
||||
'blog': blog_post.blog_id,
|
||||
'blogs': blogs,
|
||||
'tags': tags,
|
||||
'tag': tag and request.registry['blog.tag'].browse(cr, uid, int(tag), context=context) or None,
|
||||
'blog_post': blog_post,
|
||||
|
@ -235,12 +235,12 @@ class WebsiteBlog(http.Controller):
|
|||
return werkzeug.utils.redirect(request.httprequest.referrer + "#comments")
|
||||
|
||||
@http.route('/blogpost/new', type='http', auth="public", website=True, multilang=True)
|
||||
def blog_post_create(self, category_id, **post):
|
||||
def blog_post_create(self, blog_id, **post):
|
||||
cr, uid, context = request.cr, request.uid, request.context
|
||||
create_context = dict(context, mail_create_nosubscribe=True)
|
||||
new_blog_post_id = request.registry['blog.post'].create(
|
||||
request.cr, request.uid, {
|
||||
'category_id': category_id,
|
||||
'blog_id': blog_id,
|
||||
'name': _("Blog Post Title"),
|
||||
'content': '',
|
||||
'website_published': False,
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
<!-- CATEGORIES -->
|
||||
<record id="blog_category_1" model="blog.category">
|
||||
<record id="blog_blog_1" model="blog.blog">
|
||||
<field name="name">News</field>
|
||||
<field name="description">Presentation of new OpenERP features</field>
|
||||
</record>
|
||||
|
||||
<record id="menu_blog" model="website.menu">
|
||||
<field name="name">News</field>
|
||||
<field name="url" eval="'/blog/'+str(ref('website_blog.blog_category_1'))"/>
|
||||
<field name="url" eval="'/blog/'+str(ref('website_blog.blog_blog_1'))"/>
|
||||
<field name="parent_id" ref="website.main_menu"/>
|
||||
<field name="sequence" type="int">40</field>
|
||||
</record>
|
||||
|
@ -21,7 +20,7 @@
|
|||
<record id="action_open_website" model="ir.actions.act_url">
|
||||
<field name="name">Website Blogs</field>
|
||||
<field name="target">self</field>
|
||||
<field name="url" eval="'/blog/'+str(ref('website_blog.blog_category_1'))+'/?tutorial.blog=true'"/>
|
||||
<field name="url" eval="'/blog/'+str(ref('website_blog.blog_blog_1'))+'/?tutorial.blog=true'"/>
|
||||
</record>
|
||||
<record id="base.open_menu" model="ir.actions.todo">
|
||||
<field name="action_id" ref="action_open_website"/>
|
||||
|
@ -43,12 +42,12 @@
|
|||
</record>
|
||||
|
||||
<!-- Project-related subtypes for messaging / Chatter -->
|
||||
<record id="mt_blog_category_post_new" model="mail.message.subtype">
|
||||
<record id="mt_blog_blog_post_new" model="mail.message.subtype">
|
||||
<field name="name">New Post</field>
|
||||
<field name="res_model">blog.category</field>
|
||||
<field name="res_model">blog.blog</field>
|
||||
<field name="default" eval="True"/>
|
||||
<field name="parent_id" eval="ref('mt_blog_post_new')"/>
|
||||
<field name="relation_field">category_id</field>
|
||||
<field name="relation_field">blog_id</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<!-- POSTS -->
|
||||
<record id="blog_post_1" model="blog.post">
|
||||
<field name="name">OpenERP v8 New Features</field>
|
||||
<field name="category_id" ref="blog_category_1"/>
|
||||
<field name="blog_id" ref="blog_blog_1"/>
|
||||
<field name="tag_ids" eval="[(6, 0, [ref('blog_tag_1')])]"/>
|
||||
<field name="website_published" eval="True"/>
|
||||
<field name="website_meta_keywords">OpenERP, Point of Sale, Hardware, Interface, Payment Terminal, Store</field>
|
||||
|
@ -106,7 +106,7 @@
|
|||
|
||||
<record id="blog_post_2" model="blog.post">
|
||||
<field name="name">New Hardware Integration</field>
|
||||
<field name="category_id" ref="blog_category_1"/>
|
||||
<field name="blog_id" ref="blog_blog_1"/>
|
||||
<field name="tag_ids" eval="[(6, 0, [ref('blog_tag_1')])]"/>
|
||||
<field name="content">
|
||||
<![CDATA[<section class="mt16 mb16" data-snippet-id='big-picture'>
|
||||
|
@ -235,7 +235,7 @@
|
|||
|
||||
<record id="blog_post_3" model="blog.post">
|
||||
<field name="name">Touchscreen Point of Sale for 6.1</field>
|
||||
<field name="category_id" ref="blog_category_1"/>
|
||||
<field name="blog_id" ref="blog_blog_1"/>
|
||||
<field name="tag_ids" eval="[(6, 0, [ref('blog_tag_1'), ref('blog_tag_2')])]"/>
|
||||
<field name="website_meta_keywords">Point of Sale, Hardware, Interface, Payment Terminal, Store</field>
|
||||
<field name="website_meta_description">Point of Sale with no installation required that runs online and offline.</field>
|
||||
|
@ -273,7 +273,7 @@ Think of it as an out-of-the-box solution to boost your business' productivity.
|
|||
|
||||
<record id="blog_post_4" model="blog.post">
|
||||
<field name="name">Announcing a New Partnership</field>
|
||||
<field name="category_id" ref="blog_category_1"/>
|
||||
<field name="blog_id" ref="blog_blog_1"/>
|
||||
<field name="tag_ids" eval="[(6, 0, [ref('blog_tag_1')])]"/>
|
||||
<field name="website_published" eval="True"/>
|
||||
<field name="website_meta_keywords">OpenERP, Partnership, News, Accounting</field>
|
||||
|
|
|
@ -28,9 +28,9 @@ from openerp.tools.translate import _
|
|||
import difflib
|
||||
|
||||
|
||||
class BlogCategory(osv.Model):
|
||||
_name = 'blog.category'
|
||||
_description = 'Blog Category'
|
||||
class Blog(osv.Model):
|
||||
_name = 'blog.blog'
|
||||
_description = 'Blogs'
|
||||
_inherit = ['mail.thread', 'website.seo.metadata']
|
||||
_order = 'name'
|
||||
|
||||
|
@ -38,7 +38,7 @@ class BlogCategory(osv.Model):
|
|||
'name': fields.char('Name', required=True),
|
||||
'description': fields.text('Description'),
|
||||
'blog_post_ids': fields.one2many(
|
||||
'blog.post', 'category_id',
|
||||
'blog.post', 'blog_id',
|
||||
'Blogs',
|
||||
),
|
||||
}
|
||||
|
@ -92,8 +92,8 @@ class BlogPost(osv.Model):
|
|||
|
||||
_columns = {
|
||||
'name': fields.char('Title', required=True),
|
||||
'category_id': fields.many2one(
|
||||
'blog.category', 'Category',
|
||||
'blog_id': fields.many2one(
|
||||
'blog.blog', 'Blog',
|
||||
required=True, ondelete='cascade',
|
||||
),
|
||||
'tag_ids': fields.many2many(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
blog_category_all,blog.category,model_blog_category,,1,0,0,0
|
||||
blog_blog_all,blog.blog,model_blog_blog,,1,0,0,0
|
||||
blog_post_all,blog.post,model_blog_post,,1,0,0,0
|
||||
blog_post,blog.post,model_blog_post,base.group_document_user,1,1,1,1
|
||||
blog_post_history,blog.post.history,model_blog_post_history,base.group_document_user,1,0,1,0
|
||||
|
|
|
|
@ -47,17 +47,17 @@
|
|||
},
|
||||
},
|
||||
{
|
||||
stepId: 'choose-category',
|
||||
stepId: 'choose-blog',
|
||||
element: '.modal select',
|
||||
placement: 'right',
|
||||
title: "Which Blog?",
|
||||
content: "Blog posts are organized in multiple categories (news, job offers, events, etc). Select <em>News</em> and click <em>Continue</em>.",
|
||||
content: "Blog posts are organized in multiple blogs (news, job offers, events, etc). Select <em>News</em> and click <em>Continue</em>.",
|
||||
trigger: {
|
||||
id: 'change',
|
||||
},
|
||||
},
|
||||
{
|
||||
stepId: 'continue-category',
|
||||
stepId: 'continue-blog',
|
||||
element: '.modal button.btn-primary',
|
||||
placement: 'right',
|
||||
title: "Create Blog Post",
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
window_title: "New Blog Post",
|
||||
select: "Select Blog",
|
||||
init: function (field) {
|
||||
return website.session.model('blog.category')
|
||||
return website.session.model('blog.blog')
|
||||
.call('name_search', [], { context: website.get_context() });
|
||||
},
|
||||
}).then(function (cat_id) {
|
||||
document.location = '/blogpost/new?category_id=' + cat_id;
|
||||
document.location = '/blogpost/new?blog_id=' + cat_id;
|
||||
});
|
||||
}
|
||||
}),
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
-
|
||||
In order to test the document_page in OpenERP, I create a new page to category blog_category_1
|
||||
In order to test the document_page in OpenERP, I create a new page to blog blog_blog_1
|
||||
-
|
||||
!record {model: blog.post, id: test_page0}:
|
||||
name: Test Page0
|
||||
category_id: blog_category_1
|
||||
blog_id: blog_blog_1
|
||||
content: 'Test content
|
||||
|
||||
The Open ERP wiki allows you to manage your enterprise contents using wiki
|
||||
|
@ -13,10 +13,10 @@
|
|||
FAQs, quality manuals, technical references, etc.'
|
||||
|
||||
# -
|
||||
# I check the category index contains my page.
|
||||
# I check the blog index contains my page.
|
||||
# -
|
||||
# !python {model: blog.post}: |
|
||||
# res = self.read(cr, uid, [ref('blog_category_1')], ['display_content'])
|
||||
# res = self.read(cr, uid, [ref('blog_blog_1')], ['display_content'])
|
||||
# assert res[0]['display_content'].find('Test Page') > 1
|
||||
-
|
||||
!record {model: blog.post, id: test_page0}:
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<!-- Layout add nav and footer -->
|
||||
<template id="header_footer_custom" inherit_id="website.layout" name="Footer News Blog Link">
|
||||
<xpath expr="//footer//div[@name='info']/ul" position="inside">
|
||||
<li><a t-href="/blog/%(website_blog.blog_category_1)d/">News</a></li>
|
||||
<li><a t-href="/blog/%(website_blog.blog_blog_1)d/">News</a></li>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
@ -62,8 +62,8 @@
|
|||
<div class="text-muted">
|
||||
<span class="fa fa-calendar"> <span t-field="blog.create_date"/> &nbsp;</span>
|
||||
<span class="fa fa-folder-open"> In
|
||||
<a t-href="/blog/#{ slug(blog.category_id) }">
|
||||
<span t-field="blog.category_id"/>
|
||||
<a t-href="/blog/#{ slug(blog.blog_id) }">
|
||||
<span t-field="blog.blog_id"/>
|
||||
</a> &nbsp;
|
||||
</span>
|
||||
</div>
|
||||
|
@ -147,7 +147,7 @@
|
|||
<p class="post-meta text-muted text-center" t-if="len(blog_post.tag_ids)">
|
||||
<span class="fa fa-tags"/>
|
||||
<t t-foreach="blog_post.tag_ids" t-as="tag">
|
||||
<a t-href="/blog/#{ slug(category) }/tag/#{ slug(tag) }" t-esc="tag.name"/> &nbsp;
|
||||
<a t-href="/blog/#{ slug(blog) }/tag/#{ slug(tag) }" t-esc="tag.name"/> &nbsp;
|
||||
</t>
|
||||
</p>
|
||||
</xpath>
|
||||
|
@ -160,10 +160,10 @@
|
|||
<div class="row">
|
||||
<div class="col-sm-9">
|
||||
<ol class="breadcrumb">
|
||||
<li><a t-href="/blog/#{ slug(category) }"><span t-field="category.name"/></a></li>
|
||||
<li t-if="tag"><a t-href="/blog/#{ slug(category) }/tag/#{ slug(tag) }"><span t-field="tag.name"/></a></li>
|
||||
<li t-if="tag and date"><a t-href="/blog/#{ slug(category) }/tag/#{ slug(tag) }/date/#{ date }" t-esc="date_name"/></li>
|
||||
<li t-if="not tag and date"><a t-href="/blog/#{ slug(category) }/date/#{ date }" t-esc="date_name"/></li>
|
||||
<li><a t-href="/blog/#{ slug(blog) }"><span t-field="blog.name"/></a></li>
|
||||
<li t-if="tag"><a t-href="/blog/#{ slug(blog) }/tag/#{ slug(tag) }"><span t-field="tag.name"/></a></li>
|
||||
<li t-if="tag and date"><a t-href="/blog/#{ slug(blog) }/tag/#{ slug(tag) }/date/#{ date }" t-esc="date_name"/></li>
|
||||
<li t-if="not tag and date"><a t-href="/blog/#{ slug(blog) }/date/#{ date }" t-esc="date_name"/></li>
|
||||
<li class="active"><span t-field="blog_post.name"/></li>
|
||||
</ol>
|
||||
</div><div class="col-sm-3">
|
||||
|
@ -243,11 +243,11 @@
|
|||
</xpath>
|
||||
</template>
|
||||
|
||||
<!-- Options: Blog Post: show category -->
|
||||
<template id="opt_blog_post_complete_category" name="Blog Category"
|
||||
<!-- Options: Blog Post: show blog -->
|
||||
<template id="opt_blog_post_complete_blog" name="Blog"
|
||||
inherit_option_id="website_blog.blog_post_complete">
|
||||
<xpath expr="//span[@class='fa fa-calendar oe_date']" position="after">
|
||||
<span class="fa fa-folder-open"> In <span t-field="blog_post.category_id"/> &nbsp;</span>
|
||||
<span class="fa fa-folder-open"> In <span t-field="blog_post.blog_id"/> &nbsp;</span>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
@ -258,7 +258,7 @@
|
|||
<p class="post-meta text-muted text-center" t-if="len(blog_post.tag_ids)">
|
||||
<span class="fa fa-tags"/>
|
||||
<t t-foreach="blog_post.tag_ids" t-as="tag">
|
||||
<a t-href="/blog/#{ slug(category) }/tag/#{ slug(tag) }" t-esc="tag.name"/> &nbsp;
|
||||
<a t-href="/blog/#{ slug(blog) }/tag/#{ slug(tag) }" t-esc="tag.name"/> &nbsp;
|
||||
</t>
|
||||
</p>
|
||||
</xpath>
|
||||
|
@ -294,7 +294,7 @@
|
|||
<ul class="nav nav-pills nav-stacked">
|
||||
<t t-foreach="tags" t-as="tag_id">
|
||||
<li t-att-class="tag and tag_id.id == tag.id and 'active' or None" style="display: inline-block;">
|
||||
<a t-href="/blog/#{ slug(category) }/tag/#{ slug(tag_id) }"><span t-field="tag_id.name"/></a>
|
||||
<a t-href="/blog/#{ slug(blog) }/tag/#{ slug(tag_id) }"><span t-field="tag_id.name"/></a>
|
||||
</li>
|
||||
</t>
|
||||
</ul>
|
||||
|
@ -314,7 +314,7 @@
|
|||
<ul class="nav nav-pills nav-stacked">
|
||||
<t t-foreach="nav_list" t-as="months">
|
||||
<li t-att-class="months['date'] == date and 'active' or None">
|
||||
<a t-ignore="True" t-href="/blog/#{ slug(category) }/#{ tag and 'tag/%s/' % slug(tag) or '' }date/#{ months['date'] }"><t t-esc="months['create_date']"/><span class="pull-right badge" t-esc="months['create_date_count']"/></a>
|
||||
<a t-ignore="True" t-href="/blog/#{ slug(blog) }/#{ tag and 'tag/%s/' % slug(tag) or '' }date/#{ months['date'] }"><t t-esc="months['create_date']"/><span class="pull-right badge" t-esc="months['create_date_count']"/></a>
|
||||
</li>
|
||||
</t>
|
||||
</ul>
|
||||
|
@ -350,11 +350,11 @@
|
|||
</xpath>
|
||||
<xpath expr="//div[@id='blog_right_column']" position="inside">
|
||||
<section class="mt32">
|
||||
<h4>Follow us<small t-if="category">: <t t-esc="category.name"/></small></h4>
|
||||
<t t-if="category">
|
||||
<h4>Follow us<small t-if="blog">: <t t-esc="blog.name"/></small></h4>
|
||||
<t t-if="blog">
|
||||
<t t-call="website_mail.follow">
|
||||
<t t-set="email" t-value="user_id.email"/>
|
||||
<t t-set="object" t-value="category"/>
|
||||
<t t-set="object" t-value="blog"/>
|
||||
</t>
|
||||
</t>
|
||||
<p class="text-muted mb0 mt16">
|
||||
|
@ -372,8 +372,8 @@
|
|||
</xpath>
|
||||
</template>
|
||||
|
||||
<!-- Option: Right Column: categories -->
|
||||
<template id="opt_blog_rc_categories" name="Our Blogs" priority="6"
|
||||
<!-- Option: Right Column: blogs -->
|
||||
<template id="opt_blog_rc_blogs" name="Our Blogs" priority="6"
|
||||
inherit_option_id="website_blog.index">
|
||||
<xpath expr="//div[@id='blog_left_column']" position="attributes">
|
||||
<attribute name="class">col-lg-8 col-sm-8</attribute>
|
||||
|
@ -382,10 +382,10 @@
|
|||
<section class="mt32 mb32">
|
||||
<h4>Our Blogs</h4>
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
<t t-foreach="categories" t-as="nav_category">
|
||||
<li t-att-class="nav_category.id == category.id and 'active' or ''">
|
||||
<a t-href="/blog/#{ slug(nav_category) }">
|
||||
<span t-field="nav_category.name"/>
|
||||
<t t-foreach="blogs" t-as="nav_blog">
|
||||
<li t-att-class="nav_blog.id == blog.id and 'active' or ''">
|
||||
<a t-href="/blog/#{ slug(nav_blog) }">
|
||||
<span t-field="nav_blog.name"/>
|
||||
</a>
|
||||
</li>
|
||||
</t>
|
||||
|
|
|
@ -4,21 +4,21 @@
|
|||
<menuitem name="Knowledge" id="knowledge.menu_document"/>
|
||||
<menuitem name="Blog Posts" id="menu_wiki" parent="knowledge.menu_document" sequence="20" />
|
||||
|
||||
<!-- Category views -->
|
||||
<record model="ir.ui.view" id="view_blog_category_list">
|
||||
<field name="name">blog.category.list</field>
|
||||
<field name="model">blog.category</field>
|
||||
<!-- Blog views -->
|
||||
<record model="ir.ui.view" id="view_blog_blog_list">
|
||||
<field name="name">blog.blog.list</field>
|
||||
<field name="model">blog.blog</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Blog Categories">
|
||||
<tree string="Blogs">
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_blog_category_form">
|
||||
<field name="name">blog.category.form</field>
|
||||
<field name="model">blog.category</field>
|
||||
<record model="ir.ui.view" id="view_blog_blog_form">
|
||||
<field name="name">blog.blog.form</field>
|
||||
<field name="model">blog.blog</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Blog Category" version="7.0">
|
||||
<form string="Blog" version="7.0">
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
|
@ -40,7 +40,7 @@
|
|||
<field name="arch" type="xml">
|
||||
<tree string="Blog Posts">
|
||||
<field name="name"/>
|
||||
<field name="category_id"/>
|
||||
<field name="blog_id"/>
|
||||
<field name="create_uid" invisible="1"/>
|
||||
<field name="write_uid"/>
|
||||
<field name="write_date"/>
|
||||
|
@ -57,7 +57,7 @@
|
|||
<h1><field name="name" placeholder="Name"/></h1>
|
||||
<field name="tag_ids" widget="many2many_tags"/>
|
||||
<group>
|
||||
<field name="category_id" string="Category"/>
|
||||
<field name="blog_id"/>
|
||||
</group>
|
||||
<field name="content" placeholder="e.g. Once upon a time..." widget="html"/>
|
||||
<group string="Technical" groups="base.group_no_one">
|
||||
|
@ -81,9 +81,9 @@
|
|||
<search string="Blog Post">
|
||||
<field name="name" string="Content" filter_domain="['|', ('name','ilike',self), ('content','ilike',self)]"/>
|
||||
<field name="write_uid"/>
|
||||
<field name="category_id"/>
|
||||
<field name="blog_id"/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="Category" domain="[]" context="{'group_by': 'category_id'}"/>
|
||||
<filter string="Blog" domain="[]" context="{'group_by': 'blog_id'}"/>
|
||||
<filter string="Author" domain="[]" context="{'group_by': 'create_uid'}"/>
|
||||
<filter string="Last Contributor" domain="[]" context="{'group_by': 'write_uid'}"/>
|
||||
</group>
|
||||
|
@ -106,13 +106,13 @@
|
|||
</record>
|
||||
<menuitem id="menu_page" parent="menu_wiki" name="Blog Posts" action="action_blog_post" sequence="10"/>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_blog_category">
|
||||
<field name="name">Category</field>
|
||||
<field name="res_model">blog.category</field>
|
||||
<record model="ir.actions.act_window" id="action_blog_blog">
|
||||
<field name="name">Blogs</field>
|
||||
<field name="res_model">blog.blog</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
<menuitem id="menu_category" parent="menu_wiki" name="Categories" action="action_blog_category" sequence="20"/>
|
||||
<menuitem id="menu_blog" parent="menu_wiki" name="Blogs" action="action_blog_blog" sequence="20"/>
|
||||
|
||||
<!-- History Tree view -->
|
||||
<record model="ir.ui.view" id="view_blog_history_tree">
|
||||
|
|
Loading…
Reference in New Issue