launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #05436
[Merge] lp:~huwshimi/launchpad/avatars-everywhere-712894 into lp:launchpad
Huw Wilkins has proposed merging lp:~huwshimi/launchpad/avatars-everywhere-712894 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #712894 in Launchpad itself: "Display avatars next to usernames instead of icons"
https://bugs.launchpad.net/launchpad/+bug/712894
For more details, see:
https://code.launchpad.net/~huwshimi/launchpad/avatars-everywhere-712894/+merge/81430
This branch swaps out the icon checking code for avatar checking code. The tail then returns the username with the avatar instead of the generic user icon.
--
https://code.launchpad.net/~huwshimi/launchpad/avatars-everywhere-712894/+merge/81430
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~huwshimi/launchpad/avatars-everywhere-712894 into lp:launchpad.
=== modified file 'lib/canonical/launchpad/icing/style.css'
--- lib/canonical/launchpad/icing/style.css 2011-11-02 21:19:13 +0000
+++ lib/canonical/launchpad/icing/style.css 2011-11-07 05:27:26 +0000
@@ -203,6 +203,15 @@
padding-bottom: 0.5em;
padding-left: 18px;
}
+a.bg-image.has-avatar {
+ padding-left: 0;
+ }
+.avatar {
+ width: 18px;
+ height: 18px;
+ margin-right: 5px;
+ vertical-align: top;
+ }
/* == Application-specific styles == */
=== modified file 'lib/lp/app/browser/tales.py'
--- lib/lp/app/browser/tales.py 2011-10-28 15:23:20 +0000
+++ lib/lp/app/browser/tales.py 2011-11-07 05:27:26 +0000
@@ -831,6 +831,25 @@
#XXX: this should go away as soon as all image:icon where replaced
return None
+ def custom_logo_url(self):
+ """Return the URL for this object's logo."""
+ context = self._context
+ if not IHasLogo.providedBy(context):
+ context = nearest(context, IHasLogo)
+ if context is None:
+ # we use the Launchpad logo for anything which is in no way
+ # related to a Pillar (for example, a buildfarm)
+ url = '/@@/launchpad-logo'
+ elif context.logo is not None:
+ url = context.logo.getURL()
+ else:
+ url = self.default_logo_resource(context)
+ if url is None:
+ # We want to indicate that there is no logo for this
+ # object.
+ return None
+ return url
+
def logo(self):
"""Return the appropriate <img> tag for this object's logo.
@@ -1201,15 +1220,16 @@
def _makeLink(self, view_name, rootsite, text):
person = self._context
url = self.url(view_name, rootsite)
- custom_icon = ObjectImageDisplayAPI(person).custom_icon_url()
+ custom_icon = ObjectImageDisplayAPI(person).custom_logo_url()
if custom_icon is None:
css_class = ObjectImageDisplayAPI(person).sprite_css()
return (u'<a href="%s" class="%s">%s</a>') % (
url, css_class, cgi.escape(text))
else:
- return (u'<a href="%s" class="bg-image" '
- 'style="background-image: url(%s)">%s</a>') % (
- url, custom_icon, cgi.escape(text))
+ return (u'<a href="%s" class="bg-image has-avatar">'
+ '<img src="%s" alt="%s\'s avatar" class="avatar" />'
+ '%s</a>') % (
+ url, custom_icon, cgi.escape(text), cgi.escape(text))
def link(self, view_name, rootsite='mainsite'):
"""See `ObjectFormatterAPI`.