comparison browser_side/panels.py @ 114:c64b00f31461

browser side: microblog entries
author Adrien Vigneron <adrienvigneron@mailoo.org>
date Tue, 05 Jul 2011 02:34:57 +0200
parents 5c363b638127
children a8d11fdea090
comparison
equal deleted inserted replaced
113:a87cfe9e013e 114:c64b00f31461
477 def __init__(self, mblog_entry): 477 def __init__(self, mblog_entry):
478 SimplePanel.__init__(self) 478 SimplePanel.__init__(self)
479 479
480 _datetime = datetime.fromtimestamp(mblog_entry.timestamp) 480 _datetime = datetime.fromtimestamp(mblog_entry.timestamp)
481 481
482 panel = HTMLPanel("<div class='mb_entry_header'><span class='mb_entry_author'>%(author)s</span> on <span class='mb_entry_timestamp'>%(timestamp)s</span></div><div class='mb_entry_body'>%(body)s</div>" % 482 panel = HTMLPanel("""
483 {"author": html_sanitize(mblog_entry.author), 483 <div class="mb_entry_avatar"><img src="%(avatar)s" alt="%(author)s" /></div>
484 "timestamp": _datetime, 484 <div class="mb_entry_dialog">
485 "body": html_sanitize(mblog_entry.content)} 485 <p class="bubble">%(body)s</p>
486 ) 486 </div>
487 panel.setStyleName('microblogEntry') 487 <div class='mb_entry_timestamp'>%(timestamp)s</div>
488 """ % {"avatar": "/media/misc/empty_avatar",
489 "author": html_sanitize(mblog_entry.author),
490 "timestamp": _datetime,
491 "body": html_sanitize(mblog_entry.content)
492 })
493 panel.setStyleName('mb_entry')
488 self.add(panel) 494 self.add(panel)
489 495
490 class MicroblogPanel(LiberviaWidget): 496 class MicroblogPanel(LiberviaWidget):
491 497
492 def __init__(self, host, title='', accept_all=False): 498 def __init__(self, host, title='', accept_all=False):