gearheads
/
mastodon
Archived
2
0
Fork 0

Set @body_classes to admin layout (#9081)

gh/stable
Yamagishi Kazutoshi 2018-10-25 07:10:01 +09:00 committed by Eugen Rochko
parent df3a7e724d
commit e8ffecbd36
17 changed files with 89 additions and 3 deletions

View File

@ -5,8 +5,15 @@ module Admin
include Authorization include Authorization
include AccountableConcern include AccountableConcern
before_action :require_staff!
layout 'admin' layout 'admin'
before_action :require_staff!
before_action :set_body_classes
private
def set_body_classes
@body_classes = 'admin'
end
end end
end end

View File

@ -7,6 +7,7 @@ class FiltersController < ApplicationController
before_action :set_filters, only: :index before_action :set_filters, only: :index
before_action :set_filter, only: [:edit, :update, :destroy] before_action :set_filter, only: [:edit, :update, :destroy]
before_action :set_body_classes
def index def index
@filters = current_account.custom_filters @filters = current_account.custom_filters
@ -54,4 +55,8 @@ class FiltersController < ApplicationController
def resource_params def resource_params
params.require(:custom_filter).permit(:phrase, :expires_in, :irreversible, :whole_word, context: []) params.require(:custom_filter).permit(:phrase, :expires_in, :irreversible, :whole_word, context: [])
end end
def set_body_classes
@body_classes = 'admin'
end
end end

View File

@ -6,6 +6,7 @@ class InvitesController < ApplicationController
layout 'admin' layout 'admin'
before_action :authenticate_user! before_action :authenticate_user!
before_action :set_body_classes
def index def index
authorize :invite, :create? authorize :invite, :create?
@ -44,4 +45,8 @@ class InvitesController < ApplicationController
def resource_params def resource_params
params.require(:invite).permit(:max_uses, :expires_in, :autofollow) params.require(:invite).permit(:max_uses, :expires_in, :autofollow)
end end
def set_body_classes
@body_classes = 'admin'
end
end end

View File

@ -6,6 +6,7 @@ class Settings::ApplicationsController < ApplicationController
before_action :authenticate_user! before_action :authenticate_user!
before_action :set_application, only: [:show, :update, :destroy, :regenerate] before_action :set_application, only: [:show, :update, :destroy, :regenerate]
before_action :prepare_scopes, only: [:create, :update] before_action :prepare_scopes, only: [:create, :update]
before_action :set_body_classes
def index def index
@applications = current_user.applications.order(id: :desc).page(params[:page]) @applications = current_user.applications.order(id: :desc).page(params[:page])
@ -69,4 +70,8 @@ class Settings::ApplicationsController < ApplicationController
scopes = params.fetch(:doorkeeper_application, {}).fetch(:scopes, nil) scopes = params.fetch(:doorkeeper_application, {}).fetch(:scopes, nil)
params[:doorkeeper_application][:scopes] = scopes.join(' ') if scopes.is_a? Array params[:doorkeeper_application][:scopes] = scopes.join(' ') if scopes.is_a? Array
end end
def set_body_classes
@body_classes = 'admin'
end
end end

View File

@ -5,6 +5,7 @@ class Settings::DeletesController < ApplicationController
before_action :check_enabled_deletion before_action :check_enabled_deletion
before_action :authenticate_user! before_action :authenticate_user!
before_action :set_body_classes
def show def show
@confirmation = Form::DeleteConfirmation.new @confirmation = Form::DeleteConfirmation.new
@ -29,4 +30,8 @@ class Settings::DeletesController < ApplicationController
def delete_params def delete_params
params.require(:form_delete_confirmation).permit(:password) params.require(:form_delete_confirmation).permit(:password)
end end
def set_body_classes
@body_classes = 'admin'
end
end end

View File

@ -6,6 +6,7 @@ class Settings::ExportsController < ApplicationController
layout 'admin' layout 'admin'
before_action :authenticate_user! before_action :authenticate_user!
before_action :set_body_classes
def show def show
@export = Export.new(current_account) @export = Export.new(current_account)
@ -20,4 +21,10 @@ class Settings::ExportsController < ApplicationController
redirect_to settings_export_path redirect_to settings_export_path
end end
private
def set_body_classes
@body_classes = 'admin'
end
end end

View File

@ -4,6 +4,7 @@ class Settings::FollowerDomainsController < ApplicationController
layout 'admin' layout 'admin'
before_action :authenticate_user! before_action :authenticate_user!
before_action :set_body_classes
def show def show
@account = current_account @account = current_account
@ -25,4 +26,8 @@ class Settings::FollowerDomainsController < ApplicationController
def bulk_params def bulk_params
params.permit(select: []) params.permit(select: [])
end end
def set_body_classes
@body_classes = 'admin'
end
end end

View File

@ -5,6 +5,7 @@ class Settings::ImportsController < ApplicationController
before_action :authenticate_user! before_action :authenticate_user!
before_action :set_account before_action :set_account
before_action :set_body_classes
def show def show
@import = Import.new @import = Import.new
@ -31,4 +32,8 @@ class Settings::ImportsController < ApplicationController
def import_params def import_params
params.require(:import).permit(:data, :type) params.require(:import).permit(:data, :type)
end end
def set_body_classes
@body_classes = 'admin'
end
end end

View File

@ -4,6 +4,7 @@ class Settings::MigrationsController < ApplicationController
layout 'admin' layout 'admin'
before_action :authenticate_user! before_action :authenticate_user!
before_action :set_body_classes
def show def show
@migration = Form::Migration.new(account: current_account.moved_to_account) @migration = Form::Migration.new(account: current_account.moved_to_account)
@ -31,4 +32,8 @@ class Settings::MigrationsController < ApplicationController
current_account.moved_to_account_id != @migration.account&.id && current_account.moved_to_account_id != @migration.account&.id &&
current_account.id != @migration.account&.id current_account.id != @migration.account&.id
end end
def set_body_classes
@body_classes = 'admin'
end
end end

View File

@ -4,6 +4,7 @@ class Settings::NotificationsController < ApplicationController
layout 'admin' layout 'admin'
before_action :authenticate_user! before_action :authenticate_user!
before_action :set_body_classes
def show; end def show; end
@ -29,4 +30,8 @@ class Settings::NotificationsController < ApplicationController
interactions: %i(must_be_follower must_be_following must_be_following_dm) interactions: %i(must_be_follower must_be_following must_be_following_dm)
) )
end end
def set_body_classes
@body_classes = 'admin'
end
end end

View File

@ -4,6 +4,7 @@ class Settings::PreferencesController < ApplicationController
layout 'admin' layout 'admin'
before_action :authenticate_user! before_action :authenticate_user!
before_action :set_body_classes
def show; end def show; end
@ -51,4 +52,8 @@ class Settings::PreferencesController < ApplicationController
interactions: %i(must_be_follower must_be_following) interactions: %i(must_be_follower must_be_following)
) )
end end
def set_body_classes
@body_classes = 'admin'
end
end end

View File

@ -7,6 +7,7 @@ class Settings::ProfilesController < ApplicationController
before_action :authenticate_user! before_action :authenticate_user!
before_action :set_account before_action :set_account
before_action :set_body_classes
obfuscate_filename [:account, :avatar] obfuscate_filename [:account, :avatar]
obfuscate_filename [:account, :header] obfuscate_filename [:account, :header]
@ -34,4 +35,8 @@ class Settings::ProfilesController < ApplicationController
def set_account def set_account
@account = current_user.account @account = current_user.account
end end
def set_body_classes
@body_classes = 'admin'
end
end end

View File

@ -2,6 +2,7 @@
class Settings::SessionsController < ApplicationController class Settings::SessionsController < ApplicationController
before_action :set_session, only: :destroy before_action :set_session, only: :destroy
before_action :set_body_classes
def destroy def destroy
@session.destroy! @session.destroy!
@ -14,4 +15,8 @@ class Settings::SessionsController < ApplicationController
def set_session def set_session
@session = current_user.session_activations.find(params[:id]) @session = current_user.session_activations.find(params[:id])
end end
def set_body_classes
@body_classes = 'admin'
end
end end

View File

@ -7,6 +7,7 @@ module Settings
before_action :authenticate_user! before_action :authenticate_user!
before_action :ensure_otp_secret before_action :ensure_otp_secret
before_action :set_body_classes
def new def new
prepare_two_factor_form prepare_two_factor_form
@ -43,6 +44,10 @@ module Settings
def ensure_otp_secret def ensure_otp_secret
redirect_to settings_two_factor_authentication_path unless current_user.otp_secret redirect_to settings_two_factor_authentication_path unless current_user.otp_secret
end end
def set_body_classes
@body_classes = 'admin'
end
end end
end end
end end

View File

@ -6,6 +6,7 @@ module Settings
layout 'admin' layout 'admin'
before_action :authenticate_user! before_action :authenticate_user!
before_action :set_body_classes
def create def create
@recovery_codes = current_user.generate_otp_backup_codes! @recovery_codes = current_user.generate_otp_backup_codes!
@ -13,6 +14,12 @@ module Settings
flash[:notice] = I18n.t('two_factor_authentication.recovery_codes_regenerated') flash[:notice] = I18n.t('two_factor_authentication.recovery_codes_regenerated')
render :index render :index
end end
private
def set_body_classes
@body_classes = 'admin'
end
end end
end end
end end

View File

@ -6,6 +6,7 @@ module Settings
before_action :authenticate_user! before_action :authenticate_user!
before_action :verify_otp_required, only: [:create] before_action :verify_otp_required, only: [:create]
before_action :set_body_classes
def show def show
@confirmation = Form::TwoFactorConfirmation.new @confirmation = Form::TwoFactorConfirmation.new
@ -43,5 +44,9 @@ module Settings
current_user.validate_and_consume_otp!(confirmation_params[:code]) || current_user.validate_and_consume_otp!(confirmation_params[:code]) ||
current_user.invalidate_otp_backup_code!(confirmation_params[:code]) current_user.invalidate_otp_backup_code!(confirmation_params[:code])
end end
def set_body_classes
@body_classes = 'admin'
end
end end
end end

View File

@ -17,4 +17,4 @@
= yield = yield
= render template: 'layouts/application', locals: { body_classes: 'admin' } = render template: 'layouts/application'