comparison src/browser/sat_browser/blog.py @ 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
comparison
equal deleted inserted replaced
771:102050e489fa 772:2970b8af3cd7
197 self.updateSyntaxSwitchButton() 197 self.updateSyntaxSwitchButton()
198 198
199 def updateSyntaxSwitchButton(self): 199 def updateSyntaxSwitchButton(self):
200 """Set the visibility of the button to switch between blog and microblog.""" 200 """Set the visibility of the button to switch between blog and microblog."""
201 try: 201 try:
202 self.toggle_syntax_button.removeFromParent() 202 self.bubble_commands.removeFromParent()
203 except (AttributeError, TypeError): 203 except (AttributeError, TypeError):
204 pass 204 pass
205 if self.editable: 205 if self.editable:
206 if self.mode == C.ENTRY_MODE_TEXT: 206 if self.mode == C.ENTRY_MODE_TEXT:
207 html = _(u'<a style="color: blue;">switch to blog</a>') 207 html = _(u'<a style="color: blue;">switch to blog</a>')
208 title = _(u'compose a rich text message with a title - suitable for writing articles') 208 title = _(u'compose a rich text message with a title - suitable for writing articles')
209 else: 209 else:
210 html = _(u'<a style="color: blue;">switch to microblog</a>') 210 html = _(u'<a style="color: blue;">switch to microblog</a>')
211 title = _(u'compose a short message without title - suitable for sharing news') 211 title = _(u'compose a short message without title - suitable for sharing news')
212 self.toggle_syntax_button = HTML(html, Title=title) 212 toggle_syntax_button = HTML(html, Title=title)
213 self.toggle_syntax_button.addClickListener(self.toggleContentSyntax) 213 toggle_syntax_button.addClickListener(self.toggleContentSyntax)
214 self.toggle_syntax_button.addStyleName('mb_entry_toggle_syntax') 214 toggle_syntax_button.addStyleName('mb_entry_toggle_syntax')
215 self.entry_dialog.add(self.toggle_syntax_button) 215 toggle_syntax_button.setStyleAttribute('top', '-20px') # XXX: need to force CSS
216 self.toggle_syntax_button.setStyleAttribute('top', '-20px') # XXX: need to force CSS 216 toggle_syntax_button.setStyleAttribute('left', '-20px')
217 self.toggle_syntax_button.setStyleAttribute('left', '-20px') 217
218 self.bubble_commands = HorizontalPanel(Width="100%")
219
220 if self.mode == C.ENTRY_MODE_TEXT:
221 publish_button = HTML(_(u'<a style="color: blue;">shift + enter to publish</a>'), Title=_(u"... or click here"))
222 publish_button.addStyleName('mb_entry_publish_button')
223 publish_button.addClickListener(lambda dummy: self.bubble.edit(False))
224 publish_button.setStyleAttribute('top', '-20px') # XXX: need to force CSS
225 publish_button.setStyleAttribute('left', '20px')
226 self.bubble_commands.add(publish_button)
227
228 self.bubble_commands.add(toggle_syntax_button)
229 self.entry_dialog.add(self.bubble_commands)
230
218 231
219 def onClick(self, sender): 232 def onClick(self, sender):
220 if sender == self: 233 if sender == self:
221 self.blog.setSelectedEntry(self) 234 self.blog.setSelectedEntry(self)
222 elif sender == self.delete_label: 235 elif sender == self.delete_label: