# HG changeset patch # User souliane # Date 1448562680 -3600 # Node ID 2970b8af3cd7227df8f079746e7cc210ca939af7 # Parent 102050e489faf4005f4ec51b4e593fb20bc9b66c browser_side (blog): add publish hint and button for microblog diff -r 102050e489fa -r 2970b8af3cd7 src/browser/public/libervia.css --- 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%; diff -r 102050e489fa -r 2970b8af3cd7 src/browser/sat_browser/blog.py --- 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'switch to microblog') 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'shift + enter to publish'), 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: