Set @body_classes to admin layout (#9081)

pull/794/head
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 AccountableConcern
before_action :require_staff!
layout 'admin'
before_action :require_staff!
before_action :set_body_classes
private
def set_body_classes
@body_classes = 'admin'
end
end
end

View File

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

View File

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

View File

@ -6,6 +6,7 @@ class Settings::ApplicationsController < ApplicationController
before_action :authenticate_user!
before_action :set_application, only: [:show, :update, :destroy, :regenerate]
before_action :prepare_scopes, only: [:create, :update]
before_action :set_body_classes
def index
@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)
params[:doorkeeper_application][:scopes] = scopes.join(' ') if scopes.is_a? Array
end
def set_body_classes
@body_classes = 'admin'
end
end

View File

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

View File

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

View File

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

View File

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

View File

@ -4,6 +4,7 @@ class Settings::MigrationsController < ApplicationController
layout 'admin'
before_action :authenticate_user!
before_action :set_body_classes
def show
@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.id != @migration.account&.id
end
def set_body_classes
@body_classes = 'admin'
end
end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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