about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorashleyhull-versent <ashley.hull@versent.com.au>2018-10-08 09:20:45 +1100
committerEugen Rochko <eugen@zeonfederated.com>2018-10-08 00:20:45 +0200
commit2dba313100e2a5077df3ff4b00d12f9ed9f0bd72 (patch)
tree9af855e8d94c405ef575d146b552b436da03f1e7 /app
parent774ac473736cbf348827cf6d861e7fbbb72d7623 (diff)
Replace SVG asset with Custom mascot (#8766)
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin/settings_controller.rb2
-rw-r--r--app/presenters/instance_presenter.rb4
-rw-r--r--app/views/about/more.html.haml2
-rw-r--r--app/views/about/show.html.haml4
-rw-r--r--app/views/admin/settings/edit.html.haml2
5 files changed, 11 insertions, 3 deletions
diff --git a/app/controllers/admin/settings_controller.rb b/app/controllers/admin/settings_controller.rb
index 7d38f76ae..d9f261489 100644
--- a/app/controllers/admin/settings_controller.rb
+++ b/app/controllers/admin/settings_controller.rb
@@ -19,6 +19,7 @@ module Admin
       theme
       thumbnail
       hero
+      mascot
       min_invite_role
       activity_api_enabled
       peers_api_enabled
@@ -41,6 +42,7 @@ module Admin
     UPLOAD_SETTINGS = %w(
       thumbnail
       hero
+      mascot
     ).freeze
 
     def edit
diff --git a/app/presenters/instance_presenter.rb b/app/presenters/instance_presenter.rb
index a4e4af889..9a9157f1b 100644
--- a/app/presenters/instance_presenter.rb
+++ b/app/presenters/instance_presenter.rb
@@ -44,4 +44,8 @@ class InstancePresenter
   def hero
     @hero ||= Rails.cache.fetch('site_uploads/hero') { SiteUpload.find_by(var: 'hero') }
   end
+
+  def mascot
+    @mascot ||= Rails.cache.fetch('site_uploads/mascot') { SiteUpload.find_by(var: 'mascot') }
+  end
 end
diff --git a/app/views/about/more.html.haml b/app/views/about/more.html.haml
index ac7010986..f94c7c06f 100644
--- a/app/views/about/more.html.haml
+++ b/app/views/about/more.html.haml
@@ -25,7 +25,7 @@
             %span= t 'about.status_count_after', count: @instance_presenter.status_count
         .row__mascot
           .landing-page__mascot
-            = image_tag asset_pack_path('elephant_ui_plane.svg'), alt: ''
+            = image_tag @instance_presenter.mascot&.file&.url || asset_pack_path('elephant_ui_plane.svg'), alt: ''
 
   .column-2
     .landing-page__information.contact-widget
diff --git a/app/views/about/show.html.haml b/app/views/about/show.html.haml
index 8c7baa054..f5a78665d 100644
--- a/app/views/about/show.html.haml
+++ b/app/views/about/show.html.haml
@@ -63,7 +63,7 @@
                   %span= t 'about.status_count_after', count: @instance_presenter.status_count
               .row__mascot
                 .landing-page__mascot
-                  = image_tag asset_pack_path('elephant_ui_plane.svg'), alt: ''
+                  = image_tag @instance_presenter.mascot&.file&.url || asset_pack_path('elephant_ui_plane.svg'), alt: ''
 
       - else
         .column-2.non-preview
@@ -95,7 +95,7 @@
                   %span= t 'about.status_count_after', count: @instance_presenter.status_count
               .row__mascot
                 .landing-page__mascot
-                  = image_tag asset_pack_path('elephant_ui_plane.svg'), alt: ''
+                  = image_tag @instance_presenter.mascot&.file&.url || asset_pack_path('elephant_ui_plane.svg'), alt: ''
 
       - if Setting.timeline_preview
         .column-3
diff --git a/app/views/admin/settings/edit.html.haml b/app/views/admin/settings/edit.html.haml
index c5a606693..f3f9bdaf0 100644
--- a/app/views/admin/settings/edit.html.haml
+++ b/app/views/admin/settings/edit.html.haml
@@ -26,6 +26,8 @@
       = f.input :thumbnail, as: :file, wrapper: :with_block_label, label: t('admin.settings.thumbnail.title'), hint: t('admin.settings.thumbnail.desc_html')
     .fields-row__column.fields-row__column-6.fields-group
       = f.input :hero, as: :file, wrapper: :with_block_label, label: t('admin.settings.hero.title'), hint: t('admin.settings.hero.desc_html')
+    .fields-row__column.fields-row__column-6.fields-group
+      = f.input :mascot, as: :file, wrapper: :with_block_label, label: t('admin.settings.mascot.title'), hint: t('admin.settings.mascot.desc_html')
 
   %hr.spacer/