From e645ae95610fcb69d15366bc32ab60014d2ebdcf Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 4 Oct 2018 16:05:38 +0200 Subject: Change admin accounts default sort to most recent (#8813) --- app/controllers/admin/accounts_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers/admin') diff --git a/app/controllers/admin/accounts_controller.rb b/app/controllers/admin/accounts_controller.rb index e7ca6b907..5d57fe361 100644 --- a/app/controllers/admin/accounts_controller.rb +++ b/app/controllers/admin/accounts_controller.rb @@ -95,7 +95,7 @@ module Admin :remote, :by_domain, :silenced, - :recent, + :alphabetic, :suspended, :username, :display_name, -- cgit From 2dba313100e2a5077df3ff4b00d12f9ed9f0bd72 Mon Sep 17 00:00:00 2001 From: ashleyhull-versent Date: Mon, 8 Oct 2018 09:20:45 +1100 Subject: Replace SVG asset with Custom mascot (#8766) --- app/controllers/admin/settings_controller.rb | 2 ++ app/presenters/instance_presenter.rb | 4 ++++ app/views/about/more.html.haml | 2 +- app/views/about/show.html.haml | 4 ++-- app/views/admin/settings/edit.html.haml | 2 ++ config/locales/en.yml | 3 +++ spec/views/about/show.html.haml_spec.rb | 1 + 7 files changed, 15 insertions(+), 3 deletions(-) (limited to 'app/controllers/admin') 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/ diff --git a/config/locales/en.yml b/config/locales/en.yml index 51be1ad4a..e771496a1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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 diff --git a/spec/views/about/show.html.haml_spec.rb b/spec/views/about/show.html.haml_spec.rb index 12efc06fd..eb81090b5 100644 --- a/spec/views/about/show.html.haml_spec.rb +++ b/spec/views/about/show.html.haml_spec.rb @@ -18,6 +18,7 @@ describe 'about/show.html.haml', without_verify_partial_doubles: true do open_registrations: false, thumbnail: nil, hero: nil, + mascot: nil, user_count: 0, status_count: 0, contact_account: nil, -- cgit From 3d5d899094ecf389ce6cf31a6f33dcf1894e662d Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Mon, 8 Oct 2018 15:00:27 +0200 Subject: Allow selecting both default flavour and theme Fixes #672 --- app/controllers/admin/settings_controller.rb | 9 ++++++++- app/lib/themes.rb | 6 ++++++ app/models/form/admin_settings.rb | 4 ++++ app/views/admin/settings/edit.html.haml | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) (limited to 'app/controllers/admin') diff --git a/app/controllers/admin/settings_controller.rb b/app/controllers/admin/settings_controller.rb index 46e9b2c07..fe2720c48 100644 --- a/app/controllers/admin/settings_controller.rb +++ b/app/controllers/admin/settings_controller.rb @@ -18,6 +18,7 @@ module Admin bootstrap_timeline_accounts flavour skin + flavour_and_skin thumbnail hero mascot @@ -54,7 +55,13 @@ module Admin def update authorize :settings, :update? - settings_params.each do |key, value| + settings = settings_params + flavours_and_skin = settings.delete('flavour_and_skin') + if flavours_and_skin + settings['flavour'], settings['skin'] = flavours_and_skin.split('/', 2) + end + + settings.each do |key, value| if UPLOAD_SETTINGS.include?(key) upload = SiteUpload.where(var: key).first_or_initialize(var: key) upload.update(file: value) diff --git a/app/lib/themes.rb b/app/lib/themes.rb index 55824a5c4..2147904e4 100644 --- a/app/lib/themes.rb +++ b/app/lib/themes.rb @@ -80,4 +80,10 @@ class Themes def skins_for(name) @conf[name]['skin'].keys end + + def flavours_and_skins + flavours.map do |flavour| + [flavour, skins_for(flavour).map{ |skin| [flavour, skin] }] + end + end end diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb index 9ea4ed322..8a39e09b7 100644 --- a/app/models/form/admin_settings.rb +++ b/app/models/form/admin_settings.rb @@ -48,4 +48,8 @@ class Form::AdminSettings :custom_css=, to: Setting ) + + def flavour_and_skin + "#{Setting.flavour}/#{Setting.skin}" + end end diff --git a/app/views/admin/settings/edit.html.haml b/app/views/admin/settings/edit.html.haml index 361e249e0..b82555534 100644 --- a/app/views/admin/settings/edit.html.haml +++ b/app/views/admin/settings/edit.html.haml @@ -7,7 +7,7 @@ = f.input :site_title, wrapper: :with_label, label: t('admin.settings.site_title') .fields-group - = f.input :flavour, collection: Themes.instance.flavours, label_method: lambda { |flavour| I18n.t("flavours.#{flavour}.name", default: flavour) }, wrapper: :with_label, include_blank: false + = f.input :flavour_and_skin, collection: Themes.instance.flavours_and_skins, group_label_method: lambda { |(flavour, _)| I18n.t("flavours.#{flavour}.name", default: flavour) }, wrapper: :with_label, include_blank: false, as: :grouped_select, label_method: :last, value_method: lambda { |value| value.join('/') }, group_method: :last .fields-row .fields-row__column.fields-row__column-6.fields-group -- cgit