Mercurial > libervia-web
changeset 578:668bb04e9708
browser_side: set the roster contact's contextual menu on the avatar (no extra button)
author | souliane <souliane@mailoo.org> |
---|---|
date | Sat, 18 Oct 2014 23:42:13 +0200 |
parents | e1a773a64fb6 |
children | 4a0f2f294ea2 |
files | src/browser/public/libervia.css src/browser/sat_browser/contact.py |
diffstat | 2 files changed, 22 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/browser/public/libervia.css Sat Oct 18 14:47:47 2014 +0200 +++ b/src/browser/public/libervia.css Sat Oct 18 23:42:13 2014 +0200 @@ -502,15 +502,25 @@ margin: 5px 5px 0px 10px; } +.contactBox .widgetHeader_buttonGroup { + float: left; +} + .contactBox .widgetHeader_buttonGroup img { + width: 32px; + height: 32px; border-radius: 5px; - border-left: 0px; + border: 1px solid #ededed; padding: 0px 0px 0px 0px; background: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#aaa)); background: -webkit-linear-gradient(top, #eee, #aaa); background: linear-gradient(to bottom, #eee, #aaa); } +.contactBox .widgetHeader_buttonGroup img:hover { + border: 1px solid #cf2828; +} + .contactBox table { width: 100%; }
--- a/src/browser/sat_browser/contact.py Sat Oct 18 14:47:47 2014 +0200 +++ b/src/browser/sat_browser/contact.py Sat Oct 18 23:42:13 2014 +0200 @@ -111,6 +111,14 @@ base_widget.WidgetMenuBar.onBrowserEvent(self, event) event.stopPropagation() # prevent opening the chat dialog + @classmethod + def getCategoryHTML(cls, menu_name_i18n, type_): + return '<img src="%s"/>' % C.DEFAULT_AVATAR + + def setUrl(self, url): + """Set the URL of the contact avatar.""" + self.items[0].setHTML('<img src="%s" />' % url) + class ContactBox(VerticalPanel, ClickHandler, base_widget.DragLabel): @@ -120,20 +128,15 @@ self.host = host self.jid = jid self.label = ContactLabel(jid, name) - self.avatar = Image() + self.avatar = ContactMenuBar(self, host) if handle_menu else Image() self.updateAvatar(host.getAvatar(jid)) - extra = HorizontalPanel() - extra.add(self.avatar) - self.add(extra) + self.add(self.avatar) self.add(self.label) if click_listener: ClickHandler.__init__(self) self.addClickListener(self) self.click_listener = click_listener - if handle_menu: - extra.add(ContactMenuBar(self, host)) - def addMenus(self, menu_bar): menu_bar.addCachedMenus(C.MENU_ROSTER_JID_CONTEXT, {'jid': self.jid}) menu_bar.addCachedMenus(C.MENU_JID_CONTEXT, {'jid': self.jid}) @@ -145,11 +148,10 @@ self.label.setMessageWaiting(waiting) def updateAvatar(self, url): - """Update the avatar + """Update the avatar. @param url (str): image url """ - self.avatar.setVisible(url != C.DEFAULT_AVATAR) self.avatar.setUrl(url) def onClick(self, sender):