commit
af0031fe1b
@ -0,0 +1,35 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Settings::FlavoursController < Settings::BaseController
|
||||
|
||||
def index
|
||||
redirect_to action: 'show', flavour: current_flavour
|
||||
end
|
||||
|
||||
def show
|
||||
unless Themes.instance.flavours.include?(params[:flavour]) or params[:flavour] == current_flavour
|
||||
redirect_to action: 'show', flavour: current_flavour
|
||||
end
|
||||
|
||||
@listing = Themes.instance.flavours
|
||||
@selected = params[:flavour]
|
||||
end
|
||||
|
||||
def update
|
||||
user_settings.update(user_settings_params(params[:flavour]).to_h)
|
||||
redirect_to action: 'show', flavour: params[:flavour]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def user_settings
|
||||
UserSettingsDecorator.new(current_user)
|
||||
end
|
||||
|
||||
def user_settings_params(flavour)
|
||||
params.require(:user).merge({ setting_flavour: flavour }).permit(
|
||||
:setting_flavour,
|
||||
:setting_skin
|
||||
)
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 193 KiB |
@ -1,6 +1,8 @@
|
||||
en:
|
||||
flavours:
|
||||
glitch: Glitch Edition
|
||||
glitch:
|
||||
description: The default flavour for GlitchSoc instances.
|
||||
name: Glitch Edition
|
||||
skins:
|
||||
glitch:
|
||||
default: Default
|
||||
|
@ -1 +1,4 @@
|
||||
import 'flavours/glitch/styles/index.scss';
|
||||
|
||||
// This ensures that webpack compiles our images.
|
||||
require.context('../images', true);
|
||||
|
@ -1,6 +1,8 @@
|
||||
en:
|
||||
flavours:
|
||||
vanilla: Vanilla Mastodon
|
||||
vanilla:
|
||||
description: The theme used by vanilla Mastodon instances. This theme might not support all of the features of GlitchSoc.
|
||||
name: Vanilla Mastodon
|
||||
skins:
|
||||
vanilla:
|
||||
default: Default
|
||||
|
After Width: | Height: | Size: 234 KiB |
@ -0,0 +1,19 @@
|
||||
- content_for :page_title do
|
||||
= t "flavours.#{@selected}.name", default: @selected
|
||||
|
||||
= simple_form_for current_user, url: settings_flavour_path(@selected), html: { method: :put } do |f|
|
||||
= render 'shared/error_messages', object: current_user
|
||||
|
||||
- Themes.instance.flavour(@selected)['screenshot'].each do |screen|
|
||||
%img.flavour-screen{ src: asset_pack_path(screen) }
|
||||
|
||||
.flavour-description
|
||||
= t "flavours.#{@selected}.description", default: ''
|
||||
|
||||
%hr/
|
||||
|
||||
.fields-group
|
||||
= f.input :setting_skin, collection: Themes.instance.skins_for(@selected), label_method: lambda { |skin| I18n.t("skins.#{@selected}.#{skin}", default: skin) }, wrapper: :with_label, include_blank: false
|
||||
|
||||
.actions
|
||||
= f.button :button, t('generic.use_this'), type: :submit
|
Loading…
Reference in new issue