mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
Create blocked domains #2564
This commit is contained in:
parent
cd277c25ed
commit
d93d43e75c
13 changed files with 254 additions and 80 deletions
22
app/controllers/admin/blocked_domains_controller.rb
Normal file
22
app/controllers/admin/blocked_domains_controller.rb
Normal file
|
@ -0,0 +1,22 @@
|
|||
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
|
Loading…
Add table
Add a link
Reference in a new issue