# HG changeset patch # User souliane # Date 1413668533 -7200 # Node ID 668bb04e970885b6836202f649ee41db737f9331 # Parent e1a773a64fb6ac8a624ced1fff0fe8227d5d0e3d browser_side: set the roster contact's contextual menu on the avatar (no extra button) diff -r e1a773a64fb6 -r 668bb04e9708 src/browser/public/libervia.css --- 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%; } diff -r e1a773a64fb6 -r 668bb04e9708 src/browser/sat_browser/contact.py --- 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 '' % C.DEFAULT_AVATAR + + def setUrl(self, url): + """Set the URL of the contact avatar.""" + self.items[0].setHTML('' % 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):