You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
647 B

  1. # frozen_string_literal: true
  2. module Admin
  3. class DomainBlocksController < BaseController
  4. def index
  5. @blocks = DomainBlock.page(params[:page])
  6. end
  7. def new
  8. @domain_block = DomainBlock.new
  9. end
  10. def create
  11. @domain_block = DomainBlock.new(resource_params)
  12. if @domain_block.save
  13. DomainBlockWorker.perform_async(@domain_block.id)
  14. redirect_to admin_domain_blocks_path, notice: 'Domain block is now being processed'
  15. else
  16. render action: :new
  17. end
  18. end
  19. private
  20. def resource_params
  21. params.require(:domain_block).permit(:domain, :severity)
  22. end
  23. end
  24. end