]> git.openstreetmap.org Git - rails.git/commitdiff
Force body background on avatars
authorAnton Khorev <tony29@yandex.ru>
Wed, 10 Apr 2024 01:33:22 +0000 (04:33 +0300)
committerAnton Khorev <tony29@yandex.ru>
Wed, 10 Apr 2024 01:36:16 +0000 (04:36 +0300)
app/helpers/user_helper.rb
app/views/layouts/_header.html.erb
test/helpers/user_helper_test.rb

index 6884fba4dce2b71207c31c85a674c7e92600ecde..19bb8e0d6fb2d9da218c3cd3e67d17cfcec3319d 100644 (file)
@@ -2,7 +2,7 @@ module UserHelper
   # User images
 
   def user_image(user, options = {})
-    options[:class] ||= "user_image border border-secondary-subtle"
+    options[:class] ||= "user_image border border-secondary-subtle bg-body"
     options[:alt] ||= ""
 
     if user.image_use_gravatar
@@ -15,7 +15,7 @@ module UserHelper
   end
 
   def user_thumbnail(user, options = {})
-    options[:class] ||= "user_thumbnail border border-secondary-subtle"
+    options[:class] ||= "user_thumbnail border border-secondary-subtle bg-body"
     options[:alt] ||= ""
 
     if user.image_use_gravatar
@@ -28,7 +28,7 @@ module UserHelper
   end
 
   def user_thumbnail_tiny(user, options = {})
-    options[:class] ||= "user_thumbnail_tiny border border-secondary-subtle"
+    options[:class] ||= "user_thumbnail_tiny border border-secondary-subtle bg-body"
     options[:alt] ||= ""
 
     if user.image_use_gravatar
index 6a926d69247317cbad1f556a21559c1b786cded5..13a4aa65e99ffa3eb1d2f8e88bdab3cc392750aa 100644 (file)
@@ -82,7 +82,7 @@
     <% if current_user && current_user.id %>
       <div class='d-inline-flex dropdown user-menu logged-in'>
         <button class='dropdown-toggle btn btn-outline-secondary border-secondary-subtle bg-white text-secondary px-2 py-1 flex-grow-1' type='button' data-bs-toggle='dropdown'>
-          <%= user_thumbnail_tiny(current_user, :width => 25, :height => 25, :class => "user_thumbnail_tiny rounded-1") %>
+          <%= user_thumbnail_tiny(current_user, :width => 25, :height => 25, :class => "user_thumbnail_tiny rounded-1 bg-body") %>
           <%= render :partial => "layouts/inbox" %>
           <span class="user-button">
             <span class='username'>
index 0729ac7f633be4b8cd41934e7f595896caa339e7..f7d2726dbf96667654b6eb89bbad377a8476b088 100644 (file)
@@ -8,12 +8,12 @@ class UserHelperTest < ActionView::TestCase
     gravatar_user = create(:user, :image_use_gravatar => true)
 
     image = user_image(user)
-    assert_match %r{^<img class="user_image border border-secondary-subtle" .* src="/images/avatar.svg" />$}, image
+    assert_match %r{^<img class="user_image border border-secondary-subtle bg-body" .* src="/images/avatar.svg" />$}, image
 
     image = user_image(user, :class => "foo")
     assert_match %r{^<img class="foo" .* src="/images/avatar.svg" />$}, image
     image = user_image(gravatar_user)
-    assert_match %r{^<img class="user_image border border-secondary-subtle" .* src="http://www.gravatar.com/avatar/.*" />$}, image
+    assert_match %r{^<img class="user_image border border-secondary-subtle bg-body" .* src="http://www.gravatar.com/avatar/.*" />$}, image
 
     image = user_image(gravatar_user, :class => "foo")
     assert_match %r{^<img class="foo" .* src="http://www.gravatar.com/avatar/.*" />$}, image
@@ -24,13 +24,13 @@ class UserHelperTest < ActionView::TestCase
     gravatar_user = create(:user, :image_use_gravatar => true)
 
     image = user_thumbnail(user)
-    assert_match %r{^<img class="user_thumbnail border border-secondary-subtle" .* src="/images/avatar.svg" />$}, image
+    assert_match %r{^<img class="user_thumbnail border border-secondary-subtle bg-body" .* src="/images/avatar.svg" />$}, image
 
     image = user_thumbnail(user, :class => "foo")
     assert_match %r{^<img class="foo" .* src="/images/avatar.svg" />$}, image
 
     image = user_thumbnail(gravatar_user)
-    assert_match %r{^<img class="user_thumbnail border border-secondary-subtle" .* src="http://www.gravatar.com/avatar/.*" />$}, image
+    assert_match %r{^<img class="user_thumbnail border border-secondary-subtle bg-body" .* src="http://www.gravatar.com/avatar/.*" />$}, image
 
     image = user_thumbnail(gravatar_user, :class => "foo")
     assert_match %r{^<img class="foo" .* src="http://www.gravatar.com/avatar/.*" />$}, image
@@ -41,13 +41,13 @@ class UserHelperTest < ActionView::TestCase
     gravatar_user = create(:user, :image_use_gravatar => true)
 
     image = user_thumbnail_tiny(user)
-    assert_match %r{^<img class="user_thumbnail_tiny border border-secondary-subtle" .* src="/images/avatar.svg" />$}, image
+    assert_match %r{^<img class="user_thumbnail_tiny border border-secondary-subtle bg-body" .* src="/images/avatar.svg" />$}, image
 
     image = user_thumbnail_tiny(user, :class => "foo")
     assert_match %r{^<img class="foo" .* src="/images/avatar.svg" />$}, image
 
     image = user_thumbnail_tiny(gravatar_user)
-    assert_match %r{^<img class="user_thumbnail_tiny border border-secondary-subtle" .* src="http://www.gravatar.com/avatar/.*" />$}, image
+    assert_match %r{^<img class="user_thumbnail_tiny border border-secondary-subtle bg-body" .* src="http://www.gravatar.com/avatar/.*" />$}, image
 
     image = user_thumbnail_tiny(gravatar_user, :class => "foo")
     assert_match %r{^<img class="foo" .* src="http://www.gravatar.com/avatar/.*" />$}, image