2016-12-13 04:42:10 -08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-04-10 12:27:03 -07:00
|
|
|
module Admin
|
|
|
|
class DomainBlocksController < BaseController
|
|
|
|
def index
|
2017-04-10 16:11:41 -07:00
|
|
|
@blocks = DomainBlock.page(params[:page])
|
2017-04-10 12:27:03 -07:00
|
|
|
end
|
2016-12-13 04:42:10 -08:00
|
|
|
|
2017-04-10 12:27:03 -07:00
|
|
|
def new
|
|
|
|
@domain_block = DomainBlock.new
|
|
|
|
end
|
2017-04-03 09:55:06 -07:00
|
|
|
|
2017-04-10 12:27:03 -07:00
|
|
|
def create
|
|
|
|
@domain_block = DomainBlock.new(resource_params)
|
2017-04-03 09:55:06 -07:00
|
|
|
|
2017-04-10 12:27:03 -07:00
|
|
|
if @domain_block.save
|
|
|
|
DomainBlockWorker.perform_async(@domain_block.id)
|
|
|
|
redirect_to admin_domain_blocks_path, notice: 'Domain block is now being processed'
|
|
|
|
else
|
|
|
|
render action: :new
|
|
|
|
end
|
2017-04-03 09:55:06 -07:00
|
|
|
end
|
|
|
|
|
2017-04-10 12:27:03 -07:00
|
|
|
private
|
2017-04-03 09:55:06 -07:00
|
|
|
|
2017-04-10 12:27:03 -07:00
|
|
|
def resource_params
|
|
|
|
params.require(:domain_block).permit(:domain, :severity)
|
|
|
|
end
|
2016-12-13 04:42:10 -08:00
|
|
|
end
|
|
|
|
end
|