]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/4671'
authorTom Hughes <tom@compton.nu>
Wed, 10 Apr 2024 17:03:31 +0000 (18:03 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 10 Apr 2024 17:03:31 +0000 (18:03 +0100)
app/assets/images/avatar.svg [new file with mode: 0644]
app/assets/images/avatars.svg [deleted file]
app/helpers/user_helper.rb
app/views/layouts/_header.html.erb
test/helpers/user_helper_test.rb

diff --git a/app/assets/images/avatar.svg b/app/assets/images/avatar.svg
new file mode 100644 (file)
index 0000000..46d761b
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
+  <path
+    d="m 50,11 c -8,0 -12,5 -14,9 -2,4 -2,13 -1,19 0.98639,5.918364 3.9723,8.164584 5,12 0,0 0,3 0,4 l -14,3 c -9.47814,2.03103 -13.23303,8.02944 -14,18 l -1,13 78,0 -1,-13 c -0.76697,-9.97056 -4.40411,-16.62916 -14,-18 L 60,55 l -0,-4 c 0,-4 4.01361,-6.081636 5,-12 1,-6 1,-15 -1,-19 -2.0728,-4.145608 -6,-9 -14,-9 z"
+    fill="#dadaff" />
+</svg>
diff --git a/app/assets/images/avatars.svg b/app/assets/images/avatars.svg
deleted file mode 100644 (file)
index 85288b2..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://creativecommons.org/ns#"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   id="svg54671"
-   version="1.1"
-   inkscape:version="0.48.2 r9819"
-   width="99.999969"
-   height="155"
-   sodipodi:docname="new-user-icon.svg">
-  <metadata
-     id="metadata54677">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-        <dc:title />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <defs
-     id="defs54675">
-    <clipPath
-       clipPathUnits="userSpaceOnUse"
-       id="clipPath55579">
-      <rect
-         y="701"
-         x="157"
-         height="23.000002"
-         width="49.999985"
-         id="rect55581"
-         style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
-    </clipPath>
-  </defs>
-  <sodipodi:namedview
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1"
-     objecttolerance="10"
-     gridtolerance="10"
-     guidetolerance="10"
-     inkscape:pageopacity="0"
-     inkscape:pageshadow="2"
-     inkscape:window-width="1280"
-     inkscape:window-height="756"
-     id="namedview54673"
-     showgrid="true"
-     inkscape:zoom="4.3320463"
-     inkscape:cx="28.49301"
-     inkscape:cy="111.46394"
-     inkscape:window-x="11"
-     inkscape:window-y="0"
-     inkscape:window-maximized="0"
-     inkscape:current-layer="svg54671"
-     inkscape:object-nodes="true"
-     inkscape:object-paths="true"
-     showguides="false"
-     inkscape:guide-bbox="true"
-     fit-margin-top="0"
-     fit-margin-left="0"
-     fit-margin-right="0"
-     fit-margin-bottom="0">
-    <inkscape:grid
-       type="xygrid"
-       id="grid54700"
-       empspacing="5"
-       visible="true"
-       enabled="true"
-       snapvisiblegridlinesonly="true" />
-    <sodipodi:guide
-       orientation="1,0"
-       position="1000,117.39694"
-       id="guide54708" />
-    <sodipodi:guide
-       orientation="1,0"
-       position="830,101"
-       id="guide55315" />
-    <sodipodi:guide
-       orientation="1,0"
-       position="815,99.000004"
-       id="guide55317" />
-    <sodipodi:guide
-       orientation="1,0"
-       position="845,99.000004"
-       id="guide55319" />
-    <sodipodi:guide
-       orientation="0,1"
-       position="832,88.000004"
-       id="guide55321" />
-    <sodipodi:guide
-       orientation="1,0"
-       position="805,67.000004"
-       id="guide55323" />
-    <sodipodi:guide
-       orientation="1,0"
-       position="855,73.000004"
-       id="guide55325" />
-    <sodipodi:guide
-       orientation="1,0"
-       position="990,95.000004"
-       id="guide55476" />
-    <sodipodi:guide
-       orientation="1,0"
-       position="1020,73.000004"
-       id="guide55478" />
-    <sodipodi:guide
-       orientation="1,0"
-       position="970,74.000004"
-       id="guide55480" />
-    <sodipodi:guide
-       orientation="1,0"
-       position="1030,76.000004"
-       id="guide55482" />
-    <sodipodi:guide
-       orientation="0,1"
-       position="978,45.000004"
-       id="guide55484" />
-    <sodipodi:guide
-       orientation="1,0"
-       position="960,64.000004"
-       id="guide55486" />
-    <sodipodi:guide
-       orientation="1,0"
-       position="1040,63.000004"
-       id="guide55488" />
-    <sodipodi:guide
-       orientation="1,0"
-       position="980,81.000004"
-       id="guide55490" />
-    <sodipodi:guide
-       orientation="1,0"
-       position="1010,92.518344"
-       id="guide55492" />
-  </sodipodi:namedview>
-  <g
-     id="g55329"
-     transform="translate(-785,-42)">
-    <rect
-       y="42"
-       x="785"
-       height="100.00001"
-       width="99.999969"
-       id="rect54702"
-       style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
-    <path
-       sodipodi:nodetypes="sssscssccsscssss"
-       inkscape:connector-curvature="0"
-       id="path54704"
-       d="m 834.99998,53.000004 c -8,0 -12,5 -14,9 -2,4 -2,13 -1,19 0.98639,5.918364 3.9723,8.164584 5,12 0,0 0,3 0,4 l -14,2.999996 c -9.47814,2.03103 -13.23303,8.02944 -14,18 l -1,13 78,0 -1,-13 c -0.76697,-9.97056 -4.40411,-16.62916 -14,-18 L 845,97 l -2e-5,-3.999996 c -2e-5,-4.000002 4.01361,-6.081636 5,-12 1,-6 1,-15 -1,-19 -2.0728,-4.145608 -6,-9 -14,-9 z"
-       style="color:#000000;fill:#dadaff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
-  </g>
-  <g
-     id="g3048"
-     transform="translate(-157,-258)">
-    <g
-       transform="matrix(0.5,0,0,0.5,-236.5,342)"
-       id="g55329-6">
-      <rect
-         style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
-         id="rect54702-3"
-         width="99.999969"
-         height="100.00001"
-         x="787"
-         y="42" />
-    </g>
-    <path
-       style="color:#000000;fill:#dadaff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
-       d="m 181.99999,368.5 c -4,0 -6.5,2.5 -7.5,4.5 -1,2 -1,7 -0.5,10 0.4932,2.95918 2,3.43845 2,5.5 0,0.5 0,1 0,1.5 0,0.4714 -1,1 -1,1 l -5,1.5 c -4.64225,1.39267 -6.58477,4.01726 -7,9 l -0.5,6 39,0 -0.5,-6 c -0.41523,-4.98274 -2.35775,-7.60733 -7,-9 l -5,-1.5 c 0,0 -1,-0.5286 -1,-1 0,-0.5 0,-1 0,-1.5 0,-2 1.5068,-2.54082 2,-5.5 0.5,-3 0.5,-8 -0.5,-10 -1.0364,-2.07281 -3.5,-4.5 -7.5,-4.5 z"
-       id="path54704-4"
-       inkscape:connector-curvature="0"
-       sodipodi:nodetypes="ssssscssccsscsssss" />
-  </g>
-</svg>
index cf2d40da565d68caec258ae063135500aa4ea58a..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
@@ -10,12 +10,12 @@ module UserHelper
     elsif user.avatar.attached?
       user_avatar_variant_tag(user, { :resize_to_limit => [100, 100] }, options)
     else
-      image_tag "avatar_large.png", options.merge(:width => 100, :height => 100)
+      image_tag "avatar.svg", options.merge(:width => 100, :height => 100)
     end
   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
@@ -23,12 +23,12 @@ module UserHelper
     elsif user.avatar.attached?
       user_avatar_variant_tag(user, { :resize_to_limit => [50, 50] }, options)
     else
-      image_tag "avatar_small.png", options.merge(:width => 50, :height => 50)
+      image_tag "avatar.svg", options.merge(:width => 50, :height => 50)
     end
   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
@@ -36,7 +36,7 @@ module UserHelper
     elsif user.avatar.attached?
       user_avatar_variant_tag(user, { :resize_to_limit => [50, 50] }, options)
     else
-      image_tag "avatar_small.png", options.merge(:width => 50, :height => 50)
+      image_tag "avatar.svg", options.merge(:width => 50, :height => 50)
     end
   end
 
@@ -46,7 +46,7 @@ module UserHelper
     elsif user.avatar.attached?
       polymorphic_url(user_avatar_variant(user, :resize_to_limit => [100, 100]), :host => Settings.server_url)
     else
-      image_url("avatar_large.png")
+      image_url("avatar.svg")
     end
   end
 
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 e728877989e92e7798690da5352e3cb8256c94b8..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_large.png" />$}, 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_large.png" />$}, image
+    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_small.png" />$}, 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_small.png" />$}, image
+    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_small.png" />$}, 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_small.png" />$}, image
+    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