changeset 772:2970b8af3cd7

browser_side (blog): add publish hint and button for microblog
author souliane <souliane@mailoo.org>
date Thu, 26 Nov 2015 19:31:20 +0100
parents 102050e489fa
children 08aa9acc8367
files src/browser/public/libervia.css src/browser/sat_browser/blog.py
diffstat 2 files changed, 29 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/public/libervia.css	Thu Nov 26 18:31:01 2015 +0100
+++ b/src/browser/public/libervia.css	Thu Nov 26 19:31:20 2015 +0100
@@ -956,6 +956,15 @@
     left: -20px;
 }
 
+.mb_entry_publish_button {
+    cursor: pointer; 
+    float: left;
+    display: block;
+    position: relative;
+    top: -20px;
+    left: 20px;
+}
+
 /* START TAGS: styles are adapted from Dotclear */
 .mblog_tags {
     background: #fbfbfb none repeat scroll 0% 0%;
--- a/src/browser/sat_browser/blog.py	Thu Nov 26 18:31:01 2015 +0100
+++ b/src/browser/sat_browser/blog.py	Thu Nov 26 19:31:20 2015 +0100
@@ -199,7 +199,7 @@
     def updateSyntaxSwitchButton(self):
         """Set the visibility of the button to switch between blog and microblog."""
         try:
-            self.toggle_syntax_button.removeFromParent()
+            self.bubble_commands.removeFromParent()
         except (AttributeError, TypeError):
             pass
         if self.editable:
@@ -209,12 +209,25 @@
             else:
                 html = _(u'<a style="color: blue;">switch to microblog</a>')
                 title = _(u'compose a short message without title - suitable for sharing news')
-            self.toggle_syntax_button = HTML(html, Title=title)
-            self.toggle_syntax_button.addClickListener(self.toggleContentSyntax)
-            self.toggle_syntax_button.addStyleName('mb_entry_toggle_syntax')
-            self.entry_dialog.add(self.toggle_syntax_button)
-            self.toggle_syntax_button.setStyleAttribute('top', '-20px')  # XXX: need to force CSS
-            self.toggle_syntax_button.setStyleAttribute('left', '-20px')
+            toggle_syntax_button = HTML(html, Title=title)
+            toggle_syntax_button.addClickListener(self.toggleContentSyntax)
+            toggle_syntax_button.addStyleName('mb_entry_toggle_syntax')
+            toggle_syntax_button.setStyleAttribute('top', '-20px')  # XXX: need to force CSS
+            toggle_syntax_button.setStyleAttribute('left', '-20px')
+
+            self.bubble_commands = HorizontalPanel(Width="100%")
+
+            if self.mode == C.ENTRY_MODE_TEXT:
+                publish_button = HTML(_(u'<a style="color: blue;">shift + enter to publish</a>'), Title=_(u"... or click here"))
+                publish_button.addStyleName('mb_entry_publish_button')
+                publish_button.addClickListener(lambda dummy: self.bubble.edit(False))
+                publish_button.setStyleAttribute('top', '-20px')  # XXX: need to force CSS
+                publish_button.setStyleAttribute('left', '20px')
+                self.bubble_commands.add(publish_button)
+
+            self.bubble_commands.add(toggle_syntax_button)
+            self.entry_dialog.add(self.bubble_commands)
+
 
     def onClick(self, sender):
         if sender == self: