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.

40 lines
981 B

  1. # frozen_string_literal: true
  2. module Admin
  3. class EmailDomainBlocksController < BaseController
  4. before_action :set_email_domain_block, only: [:show, :destroy]
  5. def index
  6. @email_domain_blocks = EmailDomainBlock.page(params[:page])
  7. end
  8. def new
  9. @email_domain_block = EmailDomainBlock.new
  10. end
  11. def create
  12. @email_domain_block = EmailDomainBlock.new(resource_params)
  13. if @email_domain_block.save
  14. redirect_to admin_email_domain_blocks_path, notice: I18n.t('admin.email_domain_blocks.created_msg')
  15. else
  16. render :new
  17. end
  18. end
  19. def destroy
  20. @email_domain_block.destroy
  21. redirect_to admin_email_domain_blocks_path, notice: I18n.t('admin.email_domain_blocks.destroyed_msg')
  22. end
  23. private
  24. def set_email_domain_block
  25. @email_domain_block = EmailDomainBlock.find(params[:id])
  26. end
  27. def resource_params
  28. params.require(:email_domain_block).permit(:domain)
  29. end
  30. end
  31. end