diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 3fb4c0f67..7df527f89 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -1,22 +1,11 @@ module UsersHelper def avatar_image(user, options = {}) - style = options.fetch(:style) { :small } + size = options.fetch(:size) { 100 } klass = options.fetch(:class) { '' } round_corners = options.fetch(:round_corners) { true } - data_attributes = case style - when :profile - { height: 100, width: 100 } - when :small - { height: 32, width: 32, "font-size" => 20 } - else - {} - end - - if round_corners - radius = (data_attributes[:height].to_i * 0.13).round - data_attributes.merge!(radius: radius) - end + data_attributes = { height: size, width: size, "font-size" => (size * 0.6) } + data_attributes.merge!(radius: (size * 0.13).round) if round_corners data_attributes.merge!(name: user.name) content_tag :img, nil, class: "avatar #{klass}", data: data_attributes diff --git a/app/views/account/show.html.erb b/app/views/account/show.html.erb index 68274654d..2cb792dc7 100644 --- a/app/views/account/show.html.erb +++ b/app/views/account/show.html.erb @@ -36,7 +36,7 @@

<%= t("account.show.avatar")%>

- <%= avatar_image(@account, style: :profile) %> + <%= avatar_image(@account, size: 100) %>

<%= t("account.show.notifications")%>

diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 468681fec..af5a41897 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -1,7 +1,7 @@
- <%= avatar_image(comment.user, style: :small, class: 'left') %> + <%= avatar_image(comment.user, size: 32, class: 'left') %>
diff --git a/app/views/debates/show.html.erb b/app/views/debates/show.html.erb index 3c2a53674..57d8140da 100644 --- a/app/views/debates/show.html.erb +++ b/app/views/debates/show.html.erb @@ -14,7 +14,7 @@

<%= @debate.title %>

- <%= avatar_image(@debate.author, style: :small) %> + <%= avatar_image(@debate.author, size: 32) %> <%= @debate.author.name %>