mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Fix cancan form submit
This commit is contained in:
parent
028ca94d49
commit
96eead47b7
4 changed files with 27 additions and 10 deletions
|
@ -1,7 +1,7 @@
|
|||
class Client::DomainsController < ClientController
|
||||
load_and_authorize_resource
|
||||
before_action :set_domain, only: [:show, :edit, :update, :destroy]
|
||||
before_action :verify_deletion, only: [:destroy]
|
||||
load_and_authorize_resource
|
||||
before_action :set_domain, only: [:show, :edit, :update, :destroy]
|
||||
before_action :verify_deletion, only: [:destroy]
|
||||
|
||||
def index
|
||||
@q = Domain.search(params[:q]) if current_user.admin?
|
||||
|
@ -46,6 +46,16 @@ class Client::DomainsController < ClientController
|
|||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @domain.destroy
|
||||
flash[:notice] = I18n.t('shared.domain_deleted')
|
||||
redirect_to client_domains_path
|
||||
else
|
||||
flash[:alert] = I18n.t('shared.failed_to_delete_domain')
|
||||
redirect_to [:client, @domain]
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def domain_params
|
||||
|
@ -74,6 +84,6 @@ class Client::DomainsController < ClientController
|
|||
def verify_deletion
|
||||
return if @domain.can_be_deleted?
|
||||
flash[:alert] = I18n.t('shared.domain_status_prohibits_deleting')
|
||||
redirect_to [:admin, @domain]
|
||||
redirect_to [:client, @domain]
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue