changeset 769:5b28bca05d23

browser_side (blog): fixes focusing new comment box + click listener
author souliane <souliane@mailoo.org>
date Wed, 25 Nov 2015 18:40:37 +0100
parents 6c89dfdba563
children e67d8c13ba22
files src/browser/sat_browser/blog.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/sat_browser/blog.py	Wed Nov 25 17:03:36 2015 +0100
+++ b/src/browser/sat_browser/blog.py	Wed Nov 25 18:40:37 2015 +0100
@@ -170,11 +170,15 @@
         if self.item.comments:
             self.comment_label = addIcon(u"↶", "Comment this message")
             self.comment_label.setStyleName('mb_entry_action_larger')
+        else:
+            self.comment_label = None
         is_publisher = self.item.author_jid == self.blog.host.whoami.bare
         if is_publisher:
             self.update_label = addIcon(u"✍", "Edit this message")
             # TODO: add delete button if we are the owner of the node
             self.delete_label = addIcon(u"✗", "Delete this message")
+        else:
+            self.update_label = self.delete_label = None
 
     def _createCommentsPanel(self):
         """Create the panel if it doesn't exists"""
@@ -323,7 +327,7 @@
         """Add an empty entry for a new comment"""
         if self._current_comment is None:
             if not self.item.comments_service or not self.item.comments_node:
-                log.warning("Invalid service and node for comments, can pcreate a comment")
+                log.warning("Invalid service and node for comments, can't create a comment")
             self._current_comment = self.addEntry(editable=True, service=self.item.comments_service, node=self.item.comments_node)
         self.blog.setSelectedEntry(self._current_comment, True)
 
@@ -497,7 +501,7 @@
                 log.warning("Can't find any parent ScrollPanel")
                 return
             elif isinstance(parent, ScrollPanel):
-                parent.ensureVisible(current)
+                parent.ensureVisible(entry)
                 return
             else:
                 current = parent