diff options
| author | mo k <mo@mokhan.ca> | 2012-08-09 06:32:59 -0600 |
|---|---|---|
| committer | mo k <mo@mokhan.ca> | 2012-08-09 06:32:59 -0600 |
| commit | fc12a08e4c356199f5aa91c2be4fad64647d7998 (patch) | |
| tree | 7414957cdcdac59470fa3220c7986f9eb29d60b3 | |
| parent | b9a78dd1dc48307444ef9600a222ccf33a077578 (diff) | |
update avatar links.
| -rw-r--r-- | app/helpers/application_helper.rb | 12 | ||||
| -rw-r--r-- | app/views/profiles/mine.html.erb | 2 | ||||
| -rw-r--r-- | app/views/profiles/show.html.erb | 2 | ||||
| -rw-r--r-- | app/views/registrations/edit.html.erb | 4 |
4 files changed, 12 insertions, 8 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e6a4be87..52fcac62 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,8 +1,12 @@ module ApplicationHelper - def avatar_url(user) - default_url = "#{root_url}assets/chefhat_profile.PNG" - gravatar_id = Digest::MD5.hexdigest(user.email.downcase) - "http://gravatar.com/avatar/#{gravatar_id}.png?&d=#{CGI.escape(default_url)}" + def avatar_url(user, options = {size: 260}) + if user.avatar == nil + default_url = "#{root_url}assets/chefhat_profile.PNG" + gravatar_id = Digest::MD5.hexdigest(user.email.downcase) + "http://gravatar.com/avatar/#{gravatar_id}.png?&d=#{CGI.escape(default_url)}&s={options[:size]}" + else + user.avatar.avatar.thumb.url + end end def gravatar_for(user, options = { size: 50 }) gravatar_id = Digest::MD5::hexdigest(user.email.downcase) diff --git a/app/views/profiles/mine.html.erb b/app/views/profiles/mine.html.erb index 4c9d954b..7a670143 100644 --- a/app/views/profiles/mine.html.erb +++ b/app/views/profiles/mine.html.erb @@ -2,7 +2,7 @@ <div class="row"> <div class="span3"> <div class="thumbnail"> - <img src="<%= avatar_url current_user %>&s=260" alt="<%= current_user.name %>" /> + <img src="<%= avatar_url current_user %>" alt="<%= current_user.name %>" /> <div class="caption"> <h5><%= current_user.name %></h5> <p> <%= link_to "My Public Profile", profile_path(current_user) %></p> diff --git a/app/views/profiles/show.html.erb b/app/views/profiles/show.html.erb index 51d890dc..05207410 100644 --- a/app/views/profiles/show.html.erb +++ b/app/views/profiles/show.html.erb @@ -10,7 +10,7 @@ <div class="row"> <div class="span3"> <div class="thumbnail"> - <img src="<%= avatar_url @profile %>&s=260" alt="<%= @profile.name %>" /> + <img src="<%= avatar_url @profile %>" alt="<%= @profile.name %>" /> <div class="caption"> <h5><%= @profile.name %></h5> <p>member since: <%= @profile.created_at.to_s :foomat %></p> diff --git a/app/views/registrations/edit.html.erb b/app/views/registrations/edit.html.erb index 599ede2f..61d73e36 100644 --- a/app/views/registrations/edit.html.erb +++ b/app/views/registrations/edit.html.erb @@ -7,7 +7,7 @@ <div class="row"> <div class="span3"> <div class="thumbnail"> - <img src="<%= avatar_url current_user %>&s=260" alt="<%= current_user.name %>" /> + <img src="<%= avatar_url current_user %>" alt="<%= current_user.name %>" /> <div class="caption"> <h5><%= current_user.name %></h5> <p>member since: <%= current_user.created_at.to_s :foomat %></p> @@ -95,7 +95,7 @@ <%= form_tag(avatars_path(current_user), :method => "post", :multipart => true) do |f| %> <%= fields_for Avatar.new do |f| %> <%= f.file_field :avatar, :rel => avatars_path(current_user) %> - <input type="submit" class="btn primary" value="Add avatar" /> + <input type="submit" class="btn primary" value="Change My Picture" /> <% end %> <% end %> </div> |
