1
0
puyopuyotetr.is/app/controllers/admin/instances_controller.rb

35 lines
707 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module Admin
class InstancesController < BaseController
before_action :set_instances, only: :index
2019-07-30 18:10:46 +09:00
before_action :set_instance, only: :show
def index
authorize :instance, :index?
end
2019-01-08 21:39:49 +09:00
def show
authorize :instance, :show?
end
private
2019-07-30 18:10:46 +09:00
def set_instance
@instance = Instance.find(params[:id])
end
2019-07-30 18:10:46 +09:00
def set_instances
@instances = filtered_instances.page(params[:page])
2019-07-30 18:10:46 +09:00
end
2017-09-13 19:30:07 +09:00
def filtered_instances
2019-07-30 18:10:46 +09:00
InstanceFilter.new(whitelist_mode? ? { allowed: true } : filter_params).results
2017-09-13 19:30:07 +09:00
end
def filter_params
params.slice(*InstanceFilter::KEYS).permit(*InstanceFilter::KEYS)
2017-09-13 19:30:07 +09:00
end
end
end