Commit bf941ce9acc046af1717fe2b7d9464fa484e3a10

Authored by Dmitriy Zaporozhets
2 parents 1f5891e9 58750239

Merge pull request #7012 from MrMarvin/issue_229_no_avatar_png_path_in_coffee

fixes gitlab.com issue #229 - github.com issue #6976
app/assets/javascripts/project_users_select.js.coffee
... ... @@ -43,7 +43,7 @@
43 43 avatar = avatar.replace('%{hash}', md5(user.email))
44 44 avatar = avatar.replace('%{size}', '24')
45 45 else
46   - avatar = gon.relative_url_root + "/assets/no_avatar.png"
  46 + avatar = gon.relative_url_root + "#{image_path('no_avatar.png')}"
47 47  
48 48 if user.id == ''
49 49 avatarMarkup = ''
... ...
app/assets/javascripts/users_select.js.coffee
... ... @@ -7,7 +7,7 @@ $ ->
7 7 avatar = avatar.replace('%{hash}', md5(user.email))
8 8 avatar = avatar.replace('%{size}', '24')
9 9 else
10   - avatar = gon.relative_url_root + "/assets/no_avatar.png"
  10 + avatar = gon.relative_url_root + "#{image_path('no_avatar.png')}"
11 11  
12 12 "<div class='user-result'>
13 13 <div class='user-image'><img class='avatar s24' src='#{avatar}'></div>
... ...
app/helpers/application_helper.rb
... ... @@ -71,7 +71,7 @@ module ApplicationHelper
71 71 size = 40 if size.nil? || size <= 0
72 72  
73 73 if !Gitlab.config.gravatar.enabled || user_email.blank?
74   - '/assets/no_avatar.png'
  74 + image_path('no_avatar.png')
75 75 else
76 76 gravatar_url = request.ssl? || gitlab_config.https ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url
77 77 user_email.strip!
... ...
spec/helpers/application_helper_spec.rb
... ... @@ -79,11 +79,11 @@ describe ApplicationHelper do
79 79  
80 80 it "should return a generic avatar path when Gravatar is disabled" do
81 81 Gitlab.config.gravatar.stub(:enabled).and_return(false)
82   - gravatar_icon(user_email).should == '/assets/no_avatar.png'
  82 + gravatar_icon(user_email).should match('no_avatar.png')
83 83 end
84 84  
85 85 it "should return a generic avatar path when email is blank" do
86   - gravatar_icon('').should == '/assets/no_avatar.png'
  86 + gravatar_icon('').should match('no_avatar.png')
87 87 end
88 88  
89 89 it "should return default gravatar url" do
... ...