Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace "elephant_ui_plane.svg" asset with Custom mascot #8766

Merged
merged 1 commit into from Oct 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/controllers/admin/settings_controller.rb
Expand Up @@ -19,6 +19,7 @@ class SettingsController < BaseController
theme
thumbnail
hero
mascot
min_invite_role
activity_api_enabled
peers_api_enabled
Expand All @@ -41,6 +42,7 @@ class SettingsController < BaseController
UPLOAD_SETTINGS = %w(
thumbnail
hero
mascot
).freeze

def edit
Expand Down
4 changes: 4 additions & 0 deletions app/presenters/instance_presenter.rb
Expand Up @@ -44,4 +44,8 @@ def thumbnail
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
2 changes: 1 addition & 1 deletion app/views/about/more.html.haml
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/views/about/show.html.haml
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions app/views/admin/settings/edit.html.haml
Expand Up @@ -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/

Expand Down
3 changes: 3 additions & 0 deletions config/locales/en.yml
Expand Up @@ -368,6 +368,9 @@ en:
hero:
desc_html: Displayed on the frontpage. At least 600x100px recommended. When not set, falls back to instance thumbnail
title: Hero image
mascot:
desc_html: Displayed on multiple pages. At least 293px × 205px recommended. When not set, falls back to instance thumbnail
title: Mascot image
peers_api_enabled:
desc_html: Domain names this instance has encountered in the fediverse
title: Publish list of discovered instances
Expand Down
1 change: 1 addition & 0 deletions spec/views/about/show.html.haml_spec.rb
Expand Up @@ -18,6 +18,7 @@
open_registrations: false,
thumbnail: nil,
hero: nil,
mascot: nil,
user_count: 0,
status_count: 0,
contact_account: nil,
Expand Down