mirror of
https://github.com/manyfold3d/manyfold.git
synced 2026-10-23 12:12:21 -05:00
38 lines
1002 B
Ruby
38 lines
1002 B
Ruby
class Settings::DomainBlocksController < ApplicationController
|
|
respond_to :html
|
|
|
|
def index
|
|
@blocks = policy_scope(Federails::Moderation::DomainBlock).all
|
|
render layout: "settings"
|
|
end
|
|
|
|
def new
|
|
authorize Federails::Moderation::DomainBlock
|
|
@domain_block = Federails::Moderation::DomainBlock.new
|
|
render layout: "settings"
|
|
end
|
|
|
|
def create
|
|
authorize Federails::Moderation::DomainBlock
|
|
@domain_block = Federails::Moderation::DomainBlock.create(domain_block_params)
|
|
if @domain_block.valid?
|
|
redirect_to settings_domain_blocks_path, notice: t(".success")
|
|
else
|
|
render "new", layout: "settings", status: :unprocessable_entity
|
|
end
|
|
end
|
|
|
|
def destroy
|
|
@domain_block = Federails::Moderation::DomainBlock.find(params[:id])
|
|
authorize @domain_block
|
|
@domain_block.destroy
|
|
redirect_to settings_domain_blocks_path, notice: t(".success")
|
|
end
|
|
|
|
private
|
|
|
|
def domain_block_params
|
|
params.require(:domain_block).permit(:domain)
|
|
end
|
|
end
|