From 9759dce127c9ac59053fa5cd86a4c8a560a38437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20B=C4=82LTEANU?= Date: Fri, 25 Apr 2025 01:04:04 +0300 Subject: [PATCH 2/2] WIP diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index d6288ad4f..eadf547ad 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -2007,7 +2007,7 @@ img.gravatar { border-radius: 20%; } -div.issue img.gravatar { +div.issue img.gravatar, div.issue .avatar { float: left; margin: 0 12px 6px 0; } @@ -2016,7 +2016,7 @@ div.gravatar-with-child { position: relative; } -div.gravatar-with-child > img.gravatar:nth-child(2) { +div.gravatar-with-child > img.gravatar:nth-child(2), div.gravatar-with-child > .avatar:nth-child(2) { position: absolute; top: 30px; left: 30px; @@ -2030,6 +2030,77 @@ td.username img.gravatar {margin: 0 0.5em 0 0; vertical-align: top;} #activity dt img.gravatar {margin: 0 1em 0 0;} /* Used on 12px Gravatar img tags without the icon background */ .icon-gravatar {float: left; margin-right: 4px;} +.avatar { + border-radius: 20%; + display: inline-flex; + flex-shrink: 0; + overflow: hidden; +} + +.avatar span[role="img"] { + align-items: center; + block-size: 100%; + border-radius: 20%; + display: flex; + font-size: calc(24px * .6); + color: #fff; + inline-size: 100%; + justify-content: center; + user-select: none; +} +.avatar.s16 { + block-size: 16px; + inline-size: 16px; +} +.avatar.s16 span[role="img"] { + font-size: calc(16px * .6); +} +.avatar.s22 { + block-size: 22px; + inline-size: 22px; +} +.avatar.s22 span[role="img"] { + font-size: calc(22px * .5); +} +.avatar.s24 { + block-size: 24px; + inline-size: 24px; +} +.avatar.s24 span[role="img"] { + font-size: calc(24px * .6); +} +.avatar.s50 { + block-size: 50px; + inline-size: 50px; +} +.avatar.s50 span[role="img"] { + font-size: calc(50px * .6); +} + +.avatar-color-0 { + background-color: #880000; +} +.avatar-color-1 { + background-color: #ff0000; +} +.avatar-color-2 { + background-color: #00ff00; +} +.avatar-color-3 { + background-color: #008800; +} +.avatar-color-4 { + background-color: #0000ff; +} +.avatar-color-5 { + background-color: #000088; +} +.avatar-color-6 { + background-color: #ff8800; +} +.avatar-color-7 { + background-color: #ff0088; +} #activity dt, .journal {clear: left;} diff --git a/app/helpers/avatars_helper.rb b/app/helpers/avatars_helper.rb index 88a571b62..52cd4e164 100644 --- a/app/helpers/avatars_helper.rb +++ b/app/helpers/avatars_helper.rb @@ -58,7 +58,13 @@ module AvatarsHelper nil end else + if user.respond_to?(:initials) + size = options.delete(:size) || GravatarHelper::DEFAULT_OPTIONS[:size] + span = content_tag('span', user.initials, role: 'img', class: "avatar-color-#{user.id % 8}") + content_tag('div', span, class: "avatar s#{size}") + else '' + end end end -- 2.39.5 (Apple Git-154)