backport stable
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Sun, 09 May 2010 20:20:48 +0200
changeset 205 246ca4f3030e
parent 202 b201437d2c20 (current diff)
parent 204 8d2de3fd5b2c (diff)
child 207 cdce4addac55
backport stable
--- a/data/cubes.blog.css	Mon Apr 26 18:48:28 2010 +0200
+++ b/data/cubes.blog.css	Sun May 09 20:20:48 2010 +0200
@@ -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,14 +56,27 @@
  float:right;
 }
 
-span.author {
+div.author_date div{
  float:right;
- font-size: 1.2em;
+ padding-top: 3px;
+ color: #999999;
 }
 
-div.creation_date {
+div.author_date {
  font-size:1.2em;
- border-bottom-style: ridge;
- border-bottom-color: #CCC;
- border-bottom-width: thin;
+ font-style:italic;
+ border-top-style: ridge;
+ 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;
+}
--- a/views/primary.py	Mon Apr 26 18:48:28 2010 +0200
+++ b/views/primary.py	Sun May 09 20:20:48 2010 +0200
@@ -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):
--- a/views/secondary.py	Mon Apr 26 18:48:28 2010 +0200
+++ b/views/secondary.py	Sun May 09 20:20:48 2010 +0200
@@ -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,17 +133,7 @@
         w = self.w
         _ = self._cw._
         w(u'<div class="post">')
-        w(u'<h1>%s</h1>' % entity.view('incontext'))
-        w(u'<div class="creation_date">%s</div>' %
-          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'<span class="author">%s <a title="%s" href="%s">%s</a></span>' % (
-                _('by'), xml_escape(vtitle), xml_escape(url), creator.name()))
+        render_blogentry_title(self._cw, w, entity)
         w(u'<div class="entry">')
         body = entity.printable_value('content')
         w(body)
@@ -151,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')