diff --git a/app/assets/images/user_default.jpg b/app/assets/images/user_default.jpg deleted file mode 100644 index c67f27f55..000000000 Binary files a/app/assets/images/user_default.jpg and /dev/null differ diff --git a/app/assets/images/user_default_2.jpg b/app/assets/images/user_default_2.jpg deleted file mode 100644 index ed164ab57..000000000 Binary files a/app/assets/images/user_default_2.jpg and /dev/null differ diff --git a/app/assets/images/user_default_big.jpg b/app/assets/images/user_default_big.jpg deleted file mode 100644 index d1c5bcea2..000000000 Binary files a/app/assets/images/user_default_big.jpg and /dev/null differ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index d6dedd05c..0f9e4b9b0 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -16,11 +16,13 @@ //= require turbolinks //= require ckeditor/init //= require social-share-button +//= require initial //= require app //= require_tree . var initialize_modules = function() { App.Comments.initialize(); + App.Users.initialize(); App.Votes.initialize(); }; diff --git a/app/assets/javascripts/users.js.coffee b/app/assets/javascripts/users.js.coffee new file mode 100644 index 000000000..839b87fce --- /dev/null +++ b/app/assets/javascripts/users.js.coffee @@ -0,0 +1,5 @@ +App.Users = + + initialize: -> + $('.avatar').initial(); + false diff --git a/app/assets/stylesheets/debates.scss b/app/assets/stylesheets/debates.scss index a97764583..3faf62632 100644 --- a/app/assets/stylesheets/debates.scss +++ b/app/assets/stylesheets/debates.scss @@ -524,16 +524,6 @@ } } - .user-photo { - border-radius: 2px; - display: inline-block; - height: 32px; - line-height: $line-height*2; - margin-right: rem-calc(6); - vertical-align: top; - width: 32px; - } - .comment-body { margin-left: $line-height*1.6; @@ -569,4 +559,4 @@ } } } -} \ No newline at end of file +} diff --git a/app/assets/stylesheets/participacion.scss b/app/assets/stylesheets/participacion.scss index 60ffc337d..cbd95ada8 100644 --- a/app/assets/stylesheets/participacion.scss +++ b/app/assets/stylesheets/participacion.scss @@ -522,4 +522,4 @@ form { } } } -} \ No newline at end of file +} diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb new file mode 100644 index 000000000..3fb4c0f67 --- /dev/null +++ b/app/helpers/users_helper.rb @@ -0,0 +1,24 @@ +module UsersHelper + def avatar_image(user, options = {}) + style = options.fetch(:style) { :small } + 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.merge!(name: user.name) + + content_tag :img, nil, class: "avatar #{klass}", data: data_attributes + end +end diff --git a/app/views/account/show.html.erb b/app/views/account/show.html.erb index ecfb17209..68274654d 100644 --- a/app/views/account/show.html.erb +++ b/app/views/account/show.html.erb @@ -36,13 +36,15 @@
<%= @debate.title %>