[IMP] website_blog: change url paths
bzr revid: chm@openerp.com-20131129161434-rsnklmcz1g9b1cc0
This commit is contained in:
@@ -67,14 +67,14 @@ class WebsiteBlog(http.Controller):
|
||||
})
|
||||
|
||||
@website.route([
|
||||
'/blog/cat/<model("blog.category"):category>/',
|
||||
'/blog/cat/<model("blog.category"):category>/page/<int:page>/',
|
||||
'/blog/cat/<model("blog.category"):category>/tag/<model("blog.tag"):tag>/',
|
||||
'/blog/cat/<model("blog.category"):category>/tag/<model("blog.tag"):tag>/page/<int:page>/',
|
||||
'/blog/cat/<model("blog.category"):category>/date/<string(length=21):date>/',
|
||||
'/blog/cat/<model("blog.category"):category>/date/<string(length=21):date>/page/<int:page>/',
|
||||
'/blog/cat/<model("blog.category"):category>/tag/<model("blog.tag"):tag>/date/<string(length=21):date>/',
|
||||
'/blog/cat/<model("blog.category"):category>/tag/<model("blog.tag"):tag>/date/<string(length=21):date>/page/<int:page>/',
|
||||
'/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>/',
|
||||
], type='http', auth="public", multilang=True)
|
||||
def blog(self, category=None, tag=None, date=None, page=1, **opt):
|
||||
""" Prepare all values to display the blog.
|
||||
@@ -151,7 +151,7 @@ class WebsiteBlog(http.Controller):
|
||||
return request.website.render("website_blog.blog_post_short", values)
|
||||
|
||||
@website.route([
|
||||
'/blog/<model("blog.post"):blog_post>/',
|
||||
'/blogpost/<model("blog.post"):blog_post>/',
|
||||
], type='http', auth="public", multilang=True)
|
||||
def blog_post(self, blog_post=None, tag=None, date=None, page=1, enable_editor=None):
|
||||
""" Prepare all values to display the blog.
|
||||
@@ -214,7 +214,7 @@ class WebsiteBlog(http.Controller):
|
||||
}
|
||||
return request.website.render("website_blog.blog_post_complete", values)
|
||||
|
||||
@website.route(['/blog/<int:blog_post_id>/comment'], type='http', auth="public")
|
||||
@website.route(['/blogpost/<int:blog_post_id>/comment'], type='http', auth="public")
|
||||
def blog_post_comment(self, blog_post_id, **post):
|
||||
cr, uid, context = request.cr, request.uid, request.context
|
||||
if post.get('comment'):
|
||||
@@ -226,7 +226,7 @@ class WebsiteBlog(http.Controller):
|
||||
context=dict(context, mail_create_nosubcribe=True))
|
||||
return werkzeug.utils.redirect(request.httprequest.referrer + "#comments")
|
||||
|
||||
@website.route('/blog/new', type='http', auth="public", multilang=True)
|
||||
@website.route('/blogpost/new', type='http', auth="public", multilang=True)
|
||||
def blog_post_create(self, category_id, **post):
|
||||
cr, uid, context = request.cr, request.uid, request.context
|
||||
create_context = dict(context, mail_create_nosubscribe=True)
|
||||
@@ -237,9 +237,9 @@ class WebsiteBlog(http.Controller):
|
||||
'content': '',
|
||||
'website_published': False,
|
||||
}, context=create_context)
|
||||
return werkzeug.utils.redirect("/blog/%s/?enable_editor=1" % new_blog_post_id)
|
||||
return werkzeug.utils.redirect("/blogpost/%s/?enable_editor=1" % new_blog_post_id)
|
||||
|
||||
@website.route('/blog/duplicate', type='http', auth="public")
|
||||
@website.route('/blogpost/duplicate', type='http', auth="public")
|
||||
def blog_post_copy(self, blog_post_id, **post):
|
||||
""" Duplicate a blog.
|
||||
|
||||
@@ -250,4 +250,4 @@ class WebsiteBlog(http.Controller):
|
||||
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'].copy(cr, uid, blog_post_id, {}, context=create_context)
|
||||
return werkzeug.utils.redirect("/blog/%s/?enable_editor=1" % new_blog_post_id)
|
||||
return werkzeug.utils.redirect("/blogpost/%s/?enable_editor=1" % new_blog_post_id)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<record id="menu_blog" model="website.menu">
|
||||
<field name="name">News</field>
|
||||
<field name="url" eval="'/blog/cat/'+str(ref('website_blog.blog_category_1'))"/>
|
||||
<field name="url" eval="'/blog/'+str(ref('website_blog.blog_category_1'))"/>
|
||||
<field name="parent_id" ref="website.main_menu"/>
|
||||
<field name="sequence" type="int">50</field>
|
||||
</record>
|
||||
@@ -21,7 +21,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/cat/'+str(ref('website_blog.blog_category_1'))+'/?blog-tutorial=true'"/>
|
||||
<field name="url" eval="'/blog/'+str(ref('website_blog.blog_category_1'))+'/?blog-tutorial=true'"/>
|
||||
</record>
|
||||
<record id="base.open_menu" model="ir.actions.todo">
|
||||
<field name="action_id" ref="action_open_website"/>
|
||||
|
||||
@@ -182,7 +182,7 @@
|
||||
return (this.isCurrentStep('post-page') || this.isCurrentStep('save-changes')) && this._super();
|
||||
},
|
||||
trigger: function () {
|
||||
return (this.resume() && this.testUrl(/^\/blog\/[0-9]+\//)) || this._super();
|
||||
return (this.resume() && this.testUrl(/^\/blogpost\/[0-9]+\//)) || this._super();
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
.call('name_search', [], { context: website.get_context() });
|
||||
},
|
||||
}).then(function (cat_id) {
|
||||
document.location = '/blog/new?category_id=' + cat_id;
|
||||
document.location = '/blogpost/new?category_id=' + cat_id;
|
||||
});
|
||||
}
|
||||
}),
|
||||
|
||||
@@ -11,7 +11,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/cat/%(website_blog.blog_category_1)d/">News</a></li>
|
||||
<li><a t-href="/blog/%(website_blog.blog_category_1)d/">News</a></li>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<t t-foreach="blogs" t-as="blog">
|
||||
<div class="col-md-4">
|
||||
<h4>
|
||||
<a t-href="/blog/#{blog.id}?#{ tag and 'tag=%s' % tag.id or '' }#{tag and date and '&' or ''}#{ date and 'date=%s' % date or ''}" t-field="blog.name"></a>
|
||||
<a t-href="/blogpost/#{blog.id}?#{ tag and 'tag=%s' % tag.id or '' }#{tag and date and '&' or ''}#{ date and 'date=%s' % date or ''}" t-field="blog.name"></a>
|
||||
<span t-if="not blog.website_published" class="text-warning">
|
||||
&nbsp;
|
||||
<span class="icon-warning-sign" title="Not published"/>
|
||||
@@ -61,7 +61,7 @@
|
||||
<div class="text-muted">
|
||||
<span class="icon-calendar"> <span t-field="blog.create_date"/> &nbsp;</span>
|
||||
<span class="icon-folder-open"> In
|
||||
<a t-href="/blog/cat/#{blog.category_id.id}">
|
||||
<a t-href="/blog//#{blog.category_id.id}">
|
||||
<span t-field="blog.category_id"/>
|
||||
</a> &nbsp;
|
||||
</span>
|
||||
@@ -74,7 +74,7 @@
|
||||
</div>
|
||||
<div class="text-muted" t-if="len(blog.message_ids) > 0">
|
||||
<span class="icon-comment">
|
||||
<a t-href="/blog/#{blog.id}/?#{ tag and 'tag=%s' % tag.id or '' }#{tag and date and '&' or ''}#{ date and 'date=%s' % date or ''}#comment">
|
||||
<a t-href="/blogpost/#{blog.id}/?#{ tag and 'tag=%s' % tag.id or '' }#{tag and date and '&' or ''}#{ date and 'date=%s' % date or ''}#comment">
|
||||
<t t-if="len(blog.message_ids) <= 1" ><t t-esc="len(blog.message_ids)"/> comment</t>
|
||||
<t t-if="len(blog.message_ids) > 1"><t t-esc="len(blog.message_ids)"/> comments</t>
|
||||
</a>
|
||||
@@ -109,12 +109,12 @@
|
||||
<t t-foreach="blog_posts" t-as="blog_post">
|
||||
<div t-att-data-publish="blog_post.website_published and 'on' or 'off'">
|
||||
<h2 class="text-center">
|
||||
<a t-href="/blog/#{blog_post.id}/?#{ tag and 'tag=%s' % tag.id or '' }#{tag and date and '&' or ''}#{ date and 'date=%s' % date or ''}" t-field="blog_post.name"></a>
|
||||
<a t-href="/blogpost/#{blog_post.id}/?#{ tag and 'tag=%s' % tag.id or '' }#{tag and date and '&' or ''}#{ date and 'date=%s' % date or ''}" t-field="blog_post.name"></a>
|
||||
</h2>
|
||||
<p class="post-meta text-muted text-center" name='blog_post_data'>
|
||||
<span class="icon-calendar"> <span t-field="blog_post.create_date"/> &nbsp;</span>
|
||||
<span t-if="len(blog_post.message_ids) > 0" class="icon-comment">
|
||||
<a t-href="/blog/#{blog_post.id}/?#{ tag and 'tag=%s' % tag.id or '' }#{tag and date and '&' or ''}#{ date and 'date=%s' % date or ''}#comment">
|
||||
<a t-href="/blogpost/#{blog_post.id}/?#{ tag and 'tag=%s' % tag.id or '' }#{tag and date and '&' or ''}#{ date and 'date=%s' % date or ''}#comment">
|
||||
<t t-if="len(blog_post.message_ids) <= 1" ><t t-esc="len(blog_post.message_ids)"/> comment</t>
|
||||
<t t-if="len(blog_post.message_ids) > 1"><t t-esc="len(blog_post.message_ids)"/> comments</t>
|
||||
</a>
|
||||
@@ -144,7 +144,7 @@
|
||||
<p class="post-meta text-muted text-center" t-if="len(blog_post.tag_ids)">
|
||||
<span class="icon-tags"/>
|
||||
<t t-foreach="blog_post.tag_ids" t-as="tag">
|
||||
<a t-href="/blog/cat/#{ category.id }/tag/#{tag.id}" t-esc="tag.name"/> &nbsp;
|
||||
<a t-href="/blog/#{ category.id }/tag/#{tag.id}" t-esc="tag.name"/> &nbsp;
|
||||
</t>
|
||||
</p>
|
||||
</xpath>
|
||||
@@ -157,10 +157,10 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-9">
|
||||
<ol class="breadcrumb">
|
||||
<li><a t-href="/blog/cat/#{category.id}"><span t-field="category.name"/></a></li>
|
||||
<li t-if="tag"><a t-href="/blog/cat/#{ category.id }/tag/#{tag.id}"><span t-field="tag.name"/></a></li>
|
||||
<li t-if="tag and date"><a t-href="/blog/cat/#{ category.id }/tag/#{tag.id}/date/#{ date }" t-esc="date_name"/></li>
|
||||
<li t-if="not tag and date"><a t-href="/blog/cat/#{ category.id }/date/#{ date }" t-esc="date_name"/></li>
|
||||
<li><a t-href="/blog/#{category.id}"><span t-field="category.name"/></a></li>
|
||||
<li t-if="tag"><a t-href="/blog/#{ category.id }/tag/#{tag.id}"><span t-field="tag.name"/></a></li>
|
||||
<li t-if="tag and date"><a t-href="/blog/#{ category.id }/tag/#{tag.id}/date/#{ date }" t-esc="date_name"/></li>
|
||||
<li t-if="not tag and date"><a t-href="/blog/#{ category.id }/date/#{ date }" t-esc="date_name"/></li>
|
||||
<li class="active"><span t-field="blog_post.name"/></li>
|
||||
</ol>
|
||||
</div><div class="col-sm-3">
|
||||
@@ -168,7 +168,7 @@
|
||||
<t t-set="object" t-value="blog_post"/>
|
||||
<t t-set="publish_edit" t-value="True"/>
|
||||
<li t-ignore="True">
|
||||
<form class="duplicate hidden" action="/blog/duplicate">
|
||||
<form class="duplicate hidden" action="/blogpost/duplicate">
|
||||
<input name="blog_post_id" t-att-value="blog_post.id"/>
|
||||
</form>
|
||||
<a href="#" class="duplicate" onclick="$(this).prev('form').submit()">Duplicate</a>
|
||||
@@ -219,7 +219,7 @@
|
||||
<xpath expr="//ul[@id='comments-list']" position="after">
|
||||
<t t-if="not is_public_user">
|
||||
<section groups="group_website_blog_reply" class="mb32">
|
||||
<form id="comment" t-attf-action="/blog/#{blog_post.id}/#{ path_filter }/comment"
|
||||
<form id="comment" t-attf-action="/blogpost/#{blog_post.id}/#{ path_filter }/comment"
|
||||
method="POST">
|
||||
<img class="img pull-left img-rounded" t-att-src="'/website/image?model=res.partner&field=image_small&id='+str(user_id.partner_id.id)" style="width: 50px; margin-right: 10px;"/>
|
||||
<div class="pull-left mb32" style="width: 75%%">
|
||||
@@ -256,7 +256,7 @@
|
||||
<p class="post-meta text-muted text-center" t-if="len(blog_post.tag_ids)">
|
||||
<span class="icon-tags"/>
|
||||
<t t-foreach="blog_post.tag_ids" t-as="tag">
|
||||
<a t-href="/blog/cat/#{ category.id }/tag/#{tag.id}" t-esc="tag.name"/> &nbsp;
|
||||
<a t-href="/blog/#{ category.id }/tag/#{tag.id}" t-esc="tag.name"/> &nbsp;
|
||||
</t>
|
||||
</p>
|
||||
</xpath>
|
||||
@@ -292,7 +292,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/cat/#{ category.id }/tag/#{ tag_id.id }"><span t-field="tag_id.name"/></a>
|
||||
<a t-href="/blog/#{ category.id }/tag/#{ tag_id.id }"><span t-field="tag_id.name"/></a>
|
||||
</li>
|
||||
</t>
|
||||
</ul>
|
||||
@@ -312,7 +312,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/cat/#{ category.id }/#{ tag and 'tag/%s/' % tag.id 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/#{ category.id }/#{ tag and 'tag/%s/' % tag.id 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>
|
||||
@@ -382,7 +382,7 @@
|
||||
<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/cat/#{nav_category.id}">
|
||||
<a t-href="/blog/#{nav_category.id}">
|
||||
<span t-field="nav_category.name"/>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -134,7 +134,7 @@ class event_event(osv.osv):
|
||||
if event.show_tracks:
|
||||
result.append( (_('Agenda'), '/event/%s/track/' % event.id))
|
||||
if event.blog_id:
|
||||
result.append( (_('News'), '/blog/cat/'+str(event.blog_ig.id)))
|
||||
result.append( (_('News'), '/blogpost/'+str(event.blog_ig.id)))
|
||||
if event.show_track_proposal:
|
||||
result.append( (_('Talk Proposals'), '/event/%s/track_proposal/' % event.id))
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user