chore: init commit
in worker.../repo/GITFOLDER.zip is the .git folder.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Base controller for in-house admin.
|
||||
# All Admin controllers inherit from this controller.
|
||||
module Admin
|
||||
class BaseController < ApplicationController
|
||||
layout "admin"
|
||||
|
||||
before_action :authenticate_admin
|
||||
|
||||
private
|
||||
|
||||
def authenticate_admin
|
||||
redirect_to root_path, alert: t("application.access_denied.admin_required") unless current_user&.admin?
|
||||
end
|
||||
|
||||
# Apply sorting to a collection based on params
|
||||
# @param collection [ActiveRecord::Relation] The base collection to sort
|
||||
# @param default [String] The default column to sort by
|
||||
# @return [ActiveRecord::Relation] The sorted collection
|
||||
def apply_sorting(collection, default:)
|
||||
sort_column = params[:sort].presence || default
|
||||
sort_direction = params[:direction] == "desc" ? :desc : :asc
|
||||
collection.reorder(sort_column => sort_direction)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user