Set @body_classes to admin layout (#9081)

master
Yamagishi Kazutoshi 6 years ago committed by Eugen Rochko
parent df3a7e724d
commit e8ffecbd36
  1. 9
      app/controllers/admin/base_controller.rb
  2. 5
      app/controllers/filters_controller.rb
  3. 5
      app/controllers/invites_controller.rb
  4. 5
      app/controllers/settings/applications_controller.rb
  5. 5
      app/controllers/settings/deletes_controller.rb
  6. 7
      app/controllers/settings/exports_controller.rb
  7. 5
      app/controllers/settings/follower_domains_controller.rb
  8. 5
      app/controllers/settings/imports_controller.rb
  9. 5
      app/controllers/settings/migrations_controller.rb
  10. 5
      app/controllers/settings/notifications_controller.rb
  11. 5
      app/controllers/settings/preferences_controller.rb
  12. 5
      app/controllers/settings/profiles_controller.rb
  13. 5
      app/controllers/settings/sessions_controller.rb
  14. 5
      app/controllers/settings/two_factor_authentication/confirmations_controller.rb
  15. 7
      app/controllers/settings/two_factor_authentication/recovery_codes_controller.rb
  16. 5
      app/controllers/settings/two_factor_authentications_controller.rb
  17. 2
      app/views/layouts/admin.html.haml

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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

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

Loading…
Cancel
Save