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.

32 lines
677 B

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