mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 09:27:19 +02:00
22 lines
499 B
Ruby
22 lines
499 B
Ruby
class Admin::BlockedDomainsController < AdminController
|
|
load_and_authorize_resource
|
|
|
|
def index
|
|
bd = BlockedDomain.first_or_initialize
|
|
@blocked_domains = bd.names.join("\n")
|
|
end
|
|
|
|
def create
|
|
names = params[:blocked_domains].split("\r\n").map(&:strip)
|
|
|
|
bd = BlockedDomain.first_or_create
|
|
|
|
if bd.update(names: names)
|
|
flash[:notice] = I18n.t('record_updated')
|
|
else
|
|
flash.now[:alert] = I18n.t('failed_to_update_record')
|
|
end
|
|
|
|
redirect_to :back
|
|
end
|
|
end
|