default is stable stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 28 Sep 2012 17:30:33 +0200
branchstable
changeset 293 8fd9cbdb6c30
parent 277 3e38abedf17d (current diff)
parent 292 50b870f78064 (diff)
child 295 15eea37638ea
default is stable
--- a/.hgtags	Fri Mar 02 14:59:28 2012 +0100
+++ b/.hgtags	Fri Sep 28 17:30:33 2012 +0200
@@ -26,3 +26,9 @@
 2197fbf08bf08cf4acf75f27ece9713f2f46edc6 cubicweb-blog-debian-version-1.9.2-1
 ef07b3e39a1f35854e7679a958798a97e21a2cf3 cubicweb-blog-version-1.9.3
 2cd1f06eaf2a2883d95868566aa6630357ca6144 cubicweb-blog-debian-version-1.9.3-1
+7d0fb95cf3b1c9af12a5c4ab844d535914ee9bcc cubicweb-blog-version-1.9.5
+761ed24bb9459cdad7d0304447b864a588a3bffb cubicweb-blog-debian-version-1.9.5-1
+dd5712e2ba6512ff34d0b3276788db3caa4b00a1 cubicweb-blog-version-1.9.4
+dd5712e2ba6512ff34d0b3276788db3caa4b00a1 cubicweb-blog-version-1.9.4-1
+9cf47f94c8e3e903279a9d4578c3b8cf8396f909 cubicweb-blog-version-1.9.6
+e9c88c575ec0f1426bf75744b0811d27ae19110b cubicweb-blog-debian-version-1.9.6-1
--- a/MANIFEST.in	Fri Mar 02 14:59:28 2012 +0100
+++ b/MANIFEST.in	Fri Sep 28 17:30:33 2012 +0200
@@ -1,5 +1,5 @@
 include *.py
 include */*.py
-recursive-include data *.gif *.jpg *.css external_resources
+recursive-include data *.gif *.jpg *.png *.css external_resources
 recursive-include i18n *.po
 
--- a/__pkginfo__.py	Fri Mar 02 14:59:28 2012 +0100
+++ b/__pkginfo__.py	Fri Sep 28 17:30:33 2012 +0200
@@ -4,7 +4,7 @@
 modname = 'blog'
 distname = "cubicweb-%s" % modname
 
-numversion = (1, 9, 3)
+numversion = (1, 9, 6)
 version = '.'.join(str(num) for num in numversion)
 
 license = 'LGPL'
Binary file data/arrowalt.png has changed
--- a/data/cubes.blog.css	Fri Mar 02 14:59:28 2012 +0100
+++ b/data/cubes.blog.css	Fri Sep 28 17:30:33 2012 +0200
@@ -10,7 +10,7 @@
   font-weight: normal;
 }
 
-div.entry h3, h3.title {
+h3.title {
   font-size: 1.0em;
 }
 div.post div.postmetadata {
@@ -27,7 +27,28 @@
   margin-top: 25px;
   padding-top: 5px;
 }
-
+div.blogentry_title, div.blogwrapper {
+  font-family: "Palatino Linotype", Calluna-Exljbris, Georgia, "Times New Roman", Times, serif;
+  max-width:56em;
+  font-size:120%;
+}
+div.blogwrapper ul li {
+    padding-left:24px;
+    background:url(arrowalt.png) no-repeat left 2px;
+}
+div.blogwrapper img {
+    margin: 20px;
+}
+div.blogwrapper p {
+    padding-top: 10px;
+}
+div.blogwrapper pre {
+  font-family: Consolas, Monaco, "Courier New", Courier, monospace;
+ }
+div.blogwrapper h3,
+div.entry h3 {
+    font-size:105%;
+}
 div.post div.entry p {
   margin-bottom:1.5em;
 }
--- a/debian/changelog	Fri Mar 02 14:59:28 2012 +0100
+++ b/debian/changelog	Fri Sep 28 17:30:33 2012 +0200
@@ -1,3 +1,21 @@
+cubicweb-blog (1.9.6-1) unstable; urgency=low
+
+  * new upstream release
+
+ -- Arthur Lutz <arthur.lutz@logilab.fr>  Thu, 14 Jun 2012 12:39:12 +0200
+
+cubicweb-blog (1.9.5-1) unstable; urgency=low
+
+  * new upstream release
+
+ -- Arthur Lutz <arthur.lutz@logilab.fr>  Mon, 11 Jun 2012 17:41:14 +0200
+
+cubicweb-blog (1.9.4-1) unstable; urgency=low
+
+  * new upstream release
+
+ -- Arthur Lutz <arthur.lutz@logilab.fr>  Thu, 07 Jun 2012 11:45:46 +0200
+
 cubicweb-blog (1.9.3-1) unstable; urgency=low
 
   * new upstream release
--- a/views/blog.py	Fri Mar 02 14:59:28 2012 +0100
+++ b/views/blog.py	Fri Sep 28 17:30:33 2012 +0200
@@ -30,6 +30,11 @@
 class BlogPrimaryView(primary.PrimaryView):
     __select__ = is_instance('Blog', 'MicroBlog')
 
+    def entity_call(self, entity):
+        self.w(u'<div class="blogwrapper">')
+        super(BlogPrimaryView, self).entity_call(entity)
+        self.w(u'</div>')
+
     def render_entity_relations(self, entity):
         super(BlogPrimaryView, self).render_entity_relations(entity)
         rset = entity.related('entry_of', 'object')
--- a/views/boxes.py	Fri Mar 02 14:59:28 2012 +0100
+++ b/views/boxes.py	Fri Sep 28 17:30:33 2012 +0200
@@ -15,10 +15,10 @@
 from cubicweb.web import component
 
 
-class BlogArchivesBox(component.EntityCtxComponent):
+class BlogArchivesBox(component.CtxComponent):
     """blog side box displaying a Blog Archive"""
     __regid__ = 'blog.archives_by_date'
-    __select__ = (component.EntityCtxComponent.__select__
+    __select__ = (component.CtxComponent.__select__
                   & is_instance('Blog', 'MicroBlog')
                   & has_related_entities('entry_of', 'object'))
     title = _('blog.archives_by_date')
@@ -26,28 +26,56 @@
     context = 'left'
 
     def render_body(self, w):
-        rset = self.entity.related('entry_of', 'object')
+        #FIXME doesn't handle (yet) multiple blogs
+        entity = self.cw_rset.get_entity(self.cw_row or 0, self.cw_col or 0)
+        rset = entity.related('entry_of', 'object')
         self._cw.view('cw.archive.by_date', rset, maxentries=6,
-                      basepath=self.entity.rest_path() + '/blogentries',
+                      basepath=entity.rest_path() + '/blogentries',
                       w=w)
 
 
-class BlogByAuthorBox(component.EntityCtxComponent):
+class BlogEntryArchivesBox(BlogArchivesBox):
+    __regid__ = 'blog.entry_archives_by_date'
+    __select__ = (component.CtxComponent.__select__
+                  & is_instance('BlogEntry', 'MicroBlogEntry')
+                  & has_related_entities('entry_of', 'subject'))
+
+    def render_body(self, w):
+        entity = self.cw_rset.get_entity(self.cw_row or 0, self.cw_col or 0)
+        box = self._cw.vreg['ctxcomponents'].select('blog.archives_by_date', self._cw, w=w,
+                                                    rset=entity.related('entry_of', 'subject'))
+        box.render_body(w)
+
+class BlogByAuthorBox(component.CtxComponent):
     __regid__ = 'blog.archives_by_author'
-    __select__ = (component.EntityCtxComponent.__select__
-                  & is_instance('Blog', 'MicroBlogEntry')
+    __select__ = (component.CtxComponent.__select__
+                  & is_instance('Blog', 'MicroBlog')
                   & has_related_entities('entry_of', 'object'))
     title = _('blog.archives_by_author')
     order = 36
     context = 'left'
 
     def render_body(self, w):
-        rset = self.entity.related('entry_of', 'object')
+        #FIXME doesn't handle (yet) multiple blogs
+        entity = self.cw_rset.get_entity(self.cw_row or 0, self.cw_col or 0)
+        rset = entity.related('entry_of', 'object')
         self._cw.view('cw.archive.by_author', rset,
-                      basepath=self.entity.rest_path() + '/blogentries',
+                      basepath=entity.rest_path() + '/blogentries',
                       w=w)
 
 
+class BlogEntryByAuthorBox(BlogByAuthorBox):
+    __regid__ = 'blog.entry_archives_by_author'
+    __select__ = (component.CtxComponent.__select__
+                  & is_instance('BlogEntry', 'MicroBlogEntry')
+                  & has_related_entities('entry_of', 'subject'))
+
+    def render_body(self, w):
+        entity = self.cw_rset.get_entity(self.cw_row or 0, self.cw_col or 0)
+        box = self._cw.vreg['ctxcomponents'].select('blog.archives_by_author', self._cw, w=w,
+                                                    rset=entity.related('entry_of', 'subject'))
+        box.render_body(w)
+
 class LatestBlogsBox(component.CtxComponent):
     """display a box with latest blogs and rss"""
     __regid__ = 'blog.latest_blogs'
@@ -83,7 +111,11 @@
         # FIXME - could use rss_url defined as a property if available
         rss_label = u'%s <img src="%s" alt="%s"/>' % (
             self._cw._(u'subscribe'), rss_icon, self._cw._('rss icon'))
-        rss_url = self._cw.build_url('view', vid='rss', rql=rql)
+        blogs = self._cw.execute('Any B,RSS WHERE B is Blog, B rss_url RSS')
+        if len(blogs) == 1:
+            rss_url = blogs[0][1]
+        else:
+            rss_url = self._cw.build_url('view', vid='rss', rql=rql)
         w(u'<li>%s</li>\n' %
           tags.a(rss_label, href=rss_url, escapecontent=False))
         w(u'</ul>\n')
@@ -103,3 +135,22 @@
             'Any X,T,CD ORDERBY CD DESC LIMIT 5 WHERE '
             'X title T, X creation_date CD, X entry_of B, B eid %(b)s',
             {'b': blog.eid})
+
+class LatestBlogsBlogEntryBox(LatestBlogsBox):
+    """display a box with latest blogs and rss, filtered for a particular blog
+    """
+    __select__ = (component.CtxComponent.__select__
+                  & is_instance('BlogEntry')
+                  & has_related_entities('entry_of', 'subject'))
+    display_see_more_link = False
+    contextual = True
+
+    def latest_blogs_rset(self):
+        blogentry = self.cw_rset.get_entity(self.cw_row or 0, self.cw_col or 0)
+        #FIXME doesn't handle (yet) multiple blogs
+        blog = blogentry.related('entry_of', 'subject').get_entity(0,0)
+        return self._cw.execute(
+            'Any X,T,CD ORDERBY CD DESC LIMIT 5 WHERE '
+            'X title T, X creation_date CD, X entry_of B, B eid %(b)s',
+            {'b': blog.eid})
+
--- a/views/entry.py	Fri Mar 02 14:59:28 2012 +0100
+++ b/views/entry.py	Fri Sep 28 17:30:33 2012 +0200
@@ -55,6 +55,11 @@
     __select__ = is_instance('BlogEntry')
     show_attr_label = False
 
+    def render_entity_attributes(self, entity):
+        self.w(u'<div class="blogwrapper">')
+        super(BlogEntryPrimaryView, self).render_entity_attributes(entity)
+        self.w(u'</div>')
+
     def render_entity_title(self, entity):
         self._cw.add_css('cubes.blog.css')
         w = self.w