Skip to content
Snippets Groups Projects
Commit 8d2de3fd5b2c authored by Sandrine Ribeau's avatar Sandrine Ribeau
Browse files

ticket #914505, blogentry title should be the same in primary view and blog view

parent 0ab3a2e44be3
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@
margin-bottom: 2em;
}
div.post h1 {
div.post h1, div.blogentry_title h1{
font-size: 1.7em;
position: relative;
border-bottom: none;
......@@ -56,5 +56,5 @@
float:right;
}
div.author_date span{
div.author_date div{
float:right;
......@@ -60,4 +60,6 @@
float:right;
padding-top: 3px;
color: #999999;
}
div.author_date {
......@@ -67,3 +69,14 @@
border-top-color: #CCC;
border-top-width: thin;
}
/*div.blogentry_title h1{
font-size: 1.7em;
position: relative;
border-bottom: none;
font-weight: normal;
}*/
div.blogentry_title {
padding: 0px 0px 15px 0px;
}
......@@ -44,6 +44,8 @@
self.w(strio.getvalue())
class SubscribeToBlogComponent(component.EntityVComponent):
__regid__ = 'blogsubscribe'
__select__ = component.EntityVComponent.__select__ & implements('Blog')
......@@ -56,6 +58,19 @@
self._cw.external_resource('RSS_LOGO_16'),
self._cw._(u'subscribe to this blog')))
def render_blogentry_title(req, w, entity):
w(u'<h1>%s</h1>' % entity.view('incontext'))
w(u'<div class="author_date"><div>%s' %
req.format_date(entity.creation_date))
creator = entity.creator
if creator:
vtitle = _('blog entries created by %s') % creator.name()
rql = 'Any X ORDERBY D DESC WHERE X is BlogEntry, X created_by Y, '\
'Y eid %s, X creation_date D' % creator.eid
url = req.build_url('view', rql=rql, vtitle=vtitle, page_size=10)
w(u' %s <a title="%s" href="%s">%s</a>' % (
_('by'), xml_escape(vtitle), xml_escape(url), creator.name()))
w(u'</div></div>')
class BlogEntryPrimaryView(primary.PrimaryView):
__select__ = implements('BlogEntry')
......@@ -67,6 +82,13 @@
self.w(self._cw._('blogged in '))
self.wview('csv', rset, 'null')
def render_entity_title(self, entity):
self._cw.add_css('cubes.blog.css')
w = self.w
w(u'<div class="blogentry_title">')
render_blogentry_title(self._cw, w, entity)
w(u'</div>')
w(u'<br class="clear"/>')
# don't show workflow history for blog entry
class BlogEntryWFHistoryVComponent(workflow.WFHistoryVComponent):
......
......@@ -16,6 +16,8 @@
from cubicweb.selectors import paginated_rset, sorted_rset, implements
from cubicweb.web.views import baseviews, calendar, navigation
from cubes.blog.views.primary import render_blogentry_title
class BlogEntryArchiveView(StartupView):
"""control the view of a blog archive"""
__regid__ = 'blog_archive'
......@@ -122,7 +124,6 @@
month=month, year=year)
return u'<a href="%s">%s</a>' % (xml_escape(url), atitle)
class BlogEntryBlogView(EntityView):
__regid__ = 'blog'
__select__ = implements('BlogEntry')
......@@ -132,18 +133,7 @@
w = self.w
_ = self._cw._
w(u'<div class="post">')
w(u'<h1>%s</h1>' % entity.view('incontext'))
w(u'<div class="author_date"><span>%s' %
self._cw.format_date(entity.creation_date))
creator = entity.creator
if creator:
vtitle = _('blog entries created by %s') % creator.name()
rql = 'Any X ORDERBY D DESC WHERE X is BlogEntry, X created_by Y, '\
'Y eid %s, X creation_date D' % creator.eid
url = self._cw.build_url('view', rql=rql, vtitle=vtitle, page_size=10)
w(u' %s <a title="%s" href="%s">%s</a>' % (
_('by'), xml_escape(vtitle), xml_escape(url), creator.name()))
w(u'</span></div>')
render_blogentry_title(self._cw, w, entity)
w(u'<div class="entry">')
body = entity.printable_value('content')
w(body)
......@@ -152,7 +142,6 @@
w(u'<div class="postmetadata">%s</div>' % entity.view('post-reldata'))
w(u'</div>')
class BlogEntryPostMetaData(EntityView):
__regid__ = 'post-reldata'
__select__ = implements('BlogEntry')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment