##// END OF EJS Templates
gravatar: use background-image style instead of img element for gravatar...
domruf -
r6848:d2f20f3d default
parent child Browse files
Show More
@@ -878,8 +878,9 b" def gravatar(email_address, cls='', size"
878 if src:
878 if src:
879 # here it makes sense to use style="width: ..." (instead of, say, a
879 # here it makes sense to use style="width: ..." (instead of, say, a
880 # stylesheet) because we using this to generate a high-res (retina) size
880 # stylesheet) because we using this to generate a high-res (retina) size
881 html = ('<img alt="" class="{cls}" style="width: {size}px; height: {size}px" src="{src}"/>'
881 html = ('<i class="icon-empty {cls}"'
882 .format(cls=cls, size=size, src=src))
882 ' style="font-size: {size}px;background-size: {size}px;background-image: url(\'{src}\')"'
883 '></i>').format(cls=cls, size=size, src=src)
883
884
884 else:
885 else:
885 # if src is empty then there was no gravatar, so we use a font icon
886 # if src is empty then there was no gravatar, so we use a font icon
@@ -11,6 +11,7 b" i[class^='icon-'] {"
11 margin: -2px 0 -4px 0;
11 margin: -2px 0 -4px 0;
12 /* background-color: red; /* for debugging */
12 /* background-color: red; /* for debugging */
13 }
13 }
14 /* Note: class 'icon-empty' can be used to get this styling without an actual glyph */
14
15
15 /* css classes for diff file status ... it'd be nice if css had a way to
16 /* css classes for diff file status ... it'd be nice if css had a way to
16 inherit from another class but alas, we must make sure this content is the
17 inherit from another class but alas, we must make sure this content is the
@@ -1083,7 +1083,9 b' var gravatar = function(gravatar_lnk, si'
1083 if (gravatar_lnk == 'default') {
1083 if (gravatar_lnk == 'default') {
1084 return '<i class="icon-user {1}" style="font-size: {0}px;"></i>'.format(size, cssclass);
1084 return '<i class="icon-user {1}" style="font-size: {0}px;"></i>'.format(size, cssclass);
1085 }
1085 }
1086 return '<img alt="" class="{2}" style="width: {0}px; height: {0}px" src="{1}"/>'.format(size, gravatar_lnk, cssclass);
1086 return ('<i class="icon-empty {2}"' +
1087 ' style="font-size: {0}px;background-image: url(\'{1}\'); background-size: {0}px"' +
1088 '></i>').format(size, gravatar_lnk, cssclass);
1087 }
1089 }
1088
1090
1089 var autocompleteGravatar = function(res, gravatar_lnk, size, group) {
1091 var autocompleteGravatar = function(res, gravatar_lnk, size, group) {
General Comments 0
You need to be logged in to leave comments. Login now