Commit d0779d61d34334d56b2e5131faca8758ee928a74

Authored by Dmitriy Zaporozhets
2 parents 579c0b97 d1da45e1

Merge pull request #4239 from karlhungus/feature-alt-text-for-gravatars

Gravatar image fixes when gravatar unavailable
app/assets/stylesheets/gitlab_bootstrap/avatar.scss
@@ -15,6 +15,7 @@ @@ -15,6 +15,7 @@
15 15
16 &.s16 { width: 16px; height: 16px; margin-right: 6px; } 16 &.s16 { width: 16px; height: 16px; margin-right: 6px; }
17 &.s24 { width: 24px; height: 24px; margin-right: 8px; } 17 &.s24 { width: 24px; height: 24px; margin-right: 8px; }
  18 + &.s26 { width: 26px; height: 26px; margin-right: 8px; }
18 &.s32 { width: 32px; height: 32px; margin-right: 10px; } 19 &.s32 { width: 32px; height: 32px; margin-right: 10px; }
19 &.s90 { width: 90px; height: 90px; margin-right: 15px; } 20 &.s90 { width: 90px; height: 90px; margin-right: 15px; }
20 } 21 }
app/helpers/projects_helper.rb
@@ -25,7 +25,7 @@ module ProjectsHelper @@ -25,7 +25,7 @@ module ProjectsHelper
25 author_html = "" 25 author_html = ""
26 26
27 # Build avatar image tag 27 # Build avatar image tag
28 - author_html << image_tag(gravatar_icon(author.try(:email), opts[:size]), width: opts[:size], class: "avatar avatar-inline #{"s#{opts[:size]}" if opts[:size]}") if opts[:avatar] 28 + author_html << image_tag(gravatar_icon(author.try(:email), opts[:size]), width: opts[:size], class: "avatar avatar-inline #{"s#{opts[:size]}" if opts[:size]}", alt:'') if opts[:avatar]
29 29
30 # Build name span tag 30 # Build name span tag
31 author_html << content_tag(:span, sanitize(author.name), class: 'author') if opts[:name] 31 author_html << content_tag(:span, sanitize(author.name), class: 'author') if opts[:name]
app/views/admin/users/show.html.haml
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 %h5.title 24 %h5.title
25 Account: 25 Account:
26 .pull-right 26 .pull-right
27 - = image_tag gravatar_icon(@admin_user.email, 32), class: "avatar s32" 27 + = image_tag gravatar_icon(@admin_user.email, 32), class:"avatar s32", alt:""
28 %ul.well-list 28 %ul.well-list
29 %li 29 %li
30 %span.light Name: 30 %span.light Name:
@@ -62,7 +62,6 @@ @@ -62,7 +62,6 @@
62 %span.light Created by: 62 %span.light Created by:
63 %strong 63 %strong
64 = link_to @admin_user.created_by.name, [:admin, @admin_user.created_by] 64 = link_to @admin_user.created_by.name, [:admin, @admin_user.created_by]
65 -  
66 %hr 65 %hr
67 %h5 66 %h5
68 Add User to Projects 67 Add User to Projects
app/views/events/_commit.html.haml
1 %li.commit 1 %li.commit
2 %p 2 %p
3 - = link_to commit[:id][0..8], project_commit_path(project, commit[:id]), class: "commit_short_id" 3 + = link_to commit[:id][0..8], project_commit_path(project, commit[:id]), class: "commit_short_id", alt: ''
4 %span= commit[:author][:name] 4 %span= commit[:author][:name]
5 &ndash; 5 &ndash;
6 = image_tag gravatar_icon(commit[:author][:email]), class: "avatar", width: 16 6 = image_tag gravatar_icon(commit[:author][:email]), class: "avatar", width: 16
app/views/events/_event.html.haml
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 #{time_ago_in_words(event.created_at)} ago. 4 #{time_ago_in_words(event.created_at)} ago.
5 5
6 = cache event do 6 = cache event do
7 - = image_tag gravatar_icon(event.author_email), class: "avatar s24" 7 + = image_tag gravatar_icon(event.author_email), class: "avatar s24", alt:''
8 8
9 - if event.push? 9 - if event.push?
10 = render "events/event/push", event: event 10 = render "events/event/push", event: event
app/views/groups/people.html.haml
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 %ul.well-list 12 %ul.well-list
13 - @users.each do |user| 13 - @users.each do |user|
14 %li 14 %li
15 - = image_tag gravatar_icon(user.email, 16), class: "avatar s16" 15 + = image_tag gravatar_icon(user.email, 16), class: "avatar s16" , alt: ''
16 %strong= user.name 16 %strong= user.name
17 %span.cgray= user.email 17 %span.cgray= user.email
18 - if @group.owner == user 18 - if @group.owner == user
app/views/issues/_issues.html.haml
@@ -53,7 +53,7 @@ @@ -53,7 +53,7 @@
53 - @project.users.sort_by(&:name).each do |user| 53 - @project.users.sort_by(&:name).each do |user|
54 %li 54 %li
55 = link_to project_issues_with_filter_path(@project, assignee_id: user.id) do 55 = link_to project_issues_with_filter_path(@project, assignee_id: user.id) do
56 - = image_tag gravatar_icon(user.email), class: "avatar s16" 56 + = image_tag gravatar_icon(user.email), class: "avatar s16", alt: ''
57 = user.name 57 = user.name
58 58
59 .dropdown.inline.prepend-left-10 59 .dropdown.inline.prepend-left-10
app/views/layouts/_head_panel.html.haml
@@ -37,5 +37,4 @@ @@ -37,5 +37,4 @@
37 %i.icon-signout 37 %i.icon-signout
38 %li 38 %li
39 = link_to current_user, class: "profile-pic" do 39 = link_to current_user, class: "profile-pic" do
40 - = image_tag gravatar_icon(current_user.email, 26)  
41 - 40 + = image_tag(gravatar_icon(current_user.email, 26),alt: '',class: "avatar s26")
app/views/notes/_discussion.html.haml
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 = link_to "javascript:;", class: "js-details-target turn-off js-toggler-target" do 8 = link_to "javascript:;", class: "js-details-target turn-off js-toggler-target" do
9 %i.icon-eye-open 9 %i.icon-eye-open
10 Show discussion 10 Show discussion
11 - = image_tag gravatar_icon(note.author.email), class: "avatar s32" 11 + = image_tag gravatar_icon(note.author.email), class: "avatar s32", alt: ''
12 %div 12 %div
13 = link_to_member(@project, note.author, avatar: false) 13 = link_to_member(@project, note.author, avatar: false)
14 - if note.for_merge_request? 14 - if note.for_merge_request?
app/views/notes/_note.html.haml
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 - if(note.author_id == current_user.id) || can?(current_user, :admin_note, @project) 8 - if(note.author_id == current_user.id) || can?(current_user, :admin_note, @project)
9 = link_to project_note_path(@project, note), title: "Remove comment", method: :delete, confirm: 'Are you sure you want to remove comment?', remote: true, class: "danger js-note-delete" do 9 = link_to project_note_path(@project, note), title: "Remove comment", method: :delete, confirm: 'Are you sure you want to remove comment?', remote: true, class: "danger js-note-delete" do
10 %i.icon-trash.cred 10 %i.icon-trash.cred
11 - = image_tag gravatar_icon(note.author.email), class: "avatar s32" 11 + = image_tag gravatar_icon(note.author.email), class: "avatar s32", alt: ''
12 = link_to_member(@project, note.author, avatar: false) 12 = link_to_member(@project, note.author, avatar: false)
13 %span.note-last-update 13 %span.note-last-update
14 = time_ago_in_words(note.updated_at) 14 = time_ago_in_words(note.updated_at)
app/views/profiles/show.html.haml
1 .profile_avatar_holder 1 .profile_avatar_holder
2 - = image_tag gravatar_icon(@user.email, 90) 2 + = image_tag gravatar_icon(@user.email, 90), alt: ''
3 %h3.page_title 3 %h3.page_title
4 = @user.name 4 = @user.name
5 %br 5 %br
app/views/repositories/_branch.html.haml
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 %td 12 %td
13 = link_to project_commit_path(@project, commit.id), class: 'commit_short_id' do 13 = link_to project_commit_path(@project, commit.id), class: 'commit_short_id' do
14 = commit.short_id 14 = commit.short_id
15 - = image_tag gravatar_icon(commit.author_email), class: "avatar s16" 15 + = image_tag gravatar_icon(commit.author_email), class: "avatar s16", alt: ''
16 %span.light 16 %span.light
17 = gfm escape_once(truncate(commit.title, length: 40)) 17 = gfm escape_once(truncate(commit.title, length: 40))
18 %span 18 %span
app/views/repositories/_feed.html.haml
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 %div 11 %div
12 = link_to project_commits_path(@project, commit.id) do 12 = link_to project_commits_path(@project, commit.id) do
13 %code= commit.short_id 13 %code= commit.short_id
14 - = image_tag gravatar_icon(commit.author_email), class: "", width: 16 14 + = image_tag gravatar_icon(commit.author_email), class: "", width: 16, alt: ''
15 = gfm escape_once(truncate(commit.title, length: 40)) 15 = gfm escape_once(truncate(commit.title, length: 40))
16 %td 16 %td
17 %span.pull-right.cgray 17 %span.pull-right.cgray
app/views/repositories/stats.html.haml
@@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
19 %ol.styled 19 %ol.styled
20 - @stats.authors[0...50].each do |author| 20 - @stats.authors[0...50].each do |author|
21 %li 21 %li
22 - = image_tag gravatar_icon(author.email, 16), class: 'avatar s16' 22 + = image_tag gravatar_icon(author.email, 16), class: 'avatar s16', alt: ''
23 = author.name 23 = author.name
24 %small.light= author.email 24 %small.light= author.email
25 .pull-right 25 .pull-right
app/views/snippets/_snippet.html.haml
@@ -25,6 +25,6 @@ @@ -25,6 +25,6 @@
25 = "##{snippet.id}" 25 = "##{snippet.id}"
26 %span.light 26 %span.light
27 by 27 by
28 - = image_tag gravatar_icon(snippet.author_email), class: "avatar avatar-inline s16" 28 + = image_tag gravatar_icon(snippet.author_email), class: "avatar avatar-inline s16", alt: ''
29 = snippet.author_name 29 = snippet.author_name
30 30
app/views/team_members/_team_member.html.haml
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 .row 4 .row
5 .span4 5 .span4
6 = link_to user, title: user.name, class: "dark" do 6 = link_to user, title: user.name, class: "dark" do
7 - = image_tag gravatar_icon(user.email, 32), class: "avatar s32" 7 + = image_tag gravatar_icon(user.email, 32), class: "avatar s32", alt: ''
8 %strong= truncate(user.name, lenght: 40) 8 %strong= truncate(user.name, lenght: 40)
9 %br 9 %br
10 %small.cgray= user.username 10 %small.cgray= user.username
app/views/teams/members/_member.html.haml
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 .row 4 .row
5 .span3 5 .span3
6 = link_to user_path(user.username), title: user.name, class: "dark" do 6 = link_to user_path(user.username), title: user.name, class: "dark" do
7 - = image_tag gravatar_icon(user.email, 40), class: "avatar s32" 7 + = image_tag gravatar_icon(user.email, 40), class: "avatar s32", alt: ''
8 = link_to user_path(user.username), title: user.name, class: "dark" do 8 = link_to user_path(user.username), title: user.name, class: "dark" do
9 %strong= truncate(user.name, lenght: 40) 9 %strong= truncate(user.name, lenght: 40)
10 %br 10 %br
app/views/users/show.html.haml
1 .row 1 .row
2 .span8 2 .span8
3 %h3.page_title 3 %h3.page_title
4 - = image_tag gravatar_icon(@user.email, 90), class: "avatar s90" 4 + = image_tag gravatar_icon(@user.email, 90), class: "avatar s90", alt: ''
5 = @user.name 5 = @user.name
6 - if @user == current_user 6 - if @user == current_user
7 .pull-right 7 .pull-right