diff options
author | Paul Slaughter <pslaughter@gitlab.com> | 2018-08-01 19:43:50 +0000 |
---|---|---|
committer | Clement Ho <clemmakesapps@gmail.com> | 2018-08-01 19:43:50 +0000 |
commit | fbfe04401deb7a08da03502282531364aa25d511 (patch) | |
tree | 1b8b25c8ca0f7e048aed07de9cdf24a44fc58c36 /app/helpers/avatars_helper.rb | |
parent | c1fc33d590b3f853ec820fa33ebc114b86af692d (diff) | |
download | gitlab-ce-fbfe04401deb7a08da03502282531364aa25d511.tar.gz |
Add vanilla JS avatar_helper and update existing avatar helpers
Diffstat (limited to 'app/helpers/avatars_helper.rb')
-rw-r--r-- | app/helpers/avatars_helper.rb | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/app/helpers/avatars_helper.rb b/app/helpers/avatars_helper.rb index 43d92bde064..d48dae8f06d 100644 --- a/app/helpers/avatars_helper.rb +++ b/app/helpers/avatars_helper.rb @@ -15,22 +15,12 @@ module AvatarsHelper end def project_identicon(project, options = {}) - allowed_colors = { - red: 'FFEBEE', - purple: 'F3E5F5', - indigo: 'E8EAF6', - blue: 'E3F2FD', - teal: 'E0F2F1', - orange: 'FBE9E7', - gray: 'EEEEEE' - } - + bg_key = (project.id % 7) + 1 options[:class] ||= '' options[:class] << ' identicon' - bg_key = project.id % 7 - style = "background-color: ##{allowed_colors.values[bg_key]}; color: #555" + options[:class] << " bg#{bg_key}" - content_tag(:div, class: options[:class], style: style) do + content_tag(:div, class: options[:class]) do project.name[0, 1].upcase end end |