style(ntfy): fix bracket-spacing lint offenses

This commit is contained in:
Min Zeya Phyo
2026-07-28 02:34:26 +08:00
parent 20927eea5f
commit ac2054e45c
13 changed files with 1502 additions and 70 deletions

View File

@@ -1,6 +1,7 @@
module Admin
class BaseController < ActionController::Base
include Pagy::Backend
include AdminAuthentication
# Enable session and flash for admin controllers
# (needed because the app is in API-only mode)
@@ -9,22 +10,12 @@ module Admin
layout "admin"
before_action :require_admin
helper_method :current_admin, :logged_in?
private
def current_admin
@current_admin ||= AdminUser.find_by(id: session[:admin_id]) if session[:admin_id]
end
helper_method :current_admin
def logged_in?
current_admin.present?
end
helper_method :logged_in?
def require_admin
unless logged_in?
redirect_to admin_login_path, alert: "Please log in to continue"
end
redirect_to admin_login_path, alert: "Please log in to continue" unless logged_in?
end
end
end

View File

@@ -1,11 +1,15 @@
module Admin
class SessionsController < ActionController::Base
include AdminAuthentication
layout "admin"
# CSRF protection is enabled by default in ActionController::Base
# We need it for the create action but not for the new (GET) action
protect_from_forgery with: :exception
helper_method :current_admin, :logged_in?
def new
redirect_to admin_dashboard_path if current_admin
end
@@ -27,12 +31,5 @@ module Admin
session.delete(:admin_id)
redirect_to admin_login_path, notice: "You have been logged out"
end
private
def current_admin
@current_admin ||= AdminUser.find_by(id: session[:admin_id]) if session[:admin_id]
end
helper_method :current_admin
end
end