]> cat aescling's git repositories - mastodon.git/commitdiff
Use custom mascot on static share page (#15687)
authorJeong Arm <kjwonmail@gmail.com>
Thu, 11 Feb 2021 01:18:56 +0000 (10:18 +0900)
committerGitHub <noreply@github.com>
Thu, 11 Feb 2021 01:18:56 +0000 (02:18 +0100)
* Use custom mascot on static share page

* Use full_asset_url

app/helpers/mascot_helper.rb [new file with mode: 0644]
app/javascript/styles/mastodon/modal.scss
app/views/layouts/modal.html.haml

diff --git a/app/helpers/mascot_helper.rb b/app/helpers/mascot_helper.rb
new file mode 100644 (file)
index 0000000..0124c74
--- /dev/null
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+module MascotHelper
+  def mascot_url
+    full_asset_url(instance_presenter.mascot&.file&.url || asset_pack_path('media/images/elephant_ui_plane.svg'))
+  end
+
+  private
+
+  def instance_presenter
+    @instance_presenter ||= InstancePresenter.new
+  end
+end
index 962ed1ef57b043aaad6742a27642182ad96ad0d6..6c6de4206c028645158aff3f1dbf948534ea2002 100644 (file)
   flex-direction: column;
   justify-content: flex-end;
 
-  > * {
+  > div {
     flex: 1;
     max-height: 235px;
-    background: url('../images/elephant_ui_plane.svg') no-repeat left bottom / contain;
+    position: relative;
+
+    img {
+      max-height: 100%;
+      max-width: 100%;
+      height: 100%;
+      position: absolute;
+      bottom: 0;
+      left: 0;
+    }
   }
 }
 
index e74e2c0e35644e7d7d38b66e55586819cc4b34bc..a2cd1193fb846e04042d59dfb7e9d2c90b28b5df 100644 (file)
@@ -14,5 +14,6 @@
   .container-alt= yield
   .modal-layout__mastodon
     %div
+      %img{alt:'', draggable:'false', src:"#{mascot_url}"}
 
 = render template: 'layouts/application'