mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 11:16:00 +02:00
Merge branch 'registry-765' into registry-623
# Conflicts: # app/models/registrar.rb # config/locales/en.yml # spec/models/registrar_spec.rb # test/models/registrar_test.rb
This commit is contained in:
commit
4f51f6c736
35 changed files with 464 additions and 482 deletions
|
@ -19,17 +19,15 @@ module Admin
|
|||
def create
|
||||
@registrar = Registrar.new(registrar_params)
|
||||
|
||||
begin
|
||||
if @registrar.valid?
|
||||
@registrar.transaction do
|
||||
@registrar.save!
|
||||
@registrar.accounts.create!(account_type: Account::CASH, currency: 'EUR')
|
||||
end
|
||||
|
||||
flash[:notice] = t('.created')
|
||||
redirect_to [:admin, @registrar]
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
flash.now[:alert] = t('.not_created')
|
||||
render 'new'
|
||||
redirect_to [:admin, @registrar], notice: t('.created')
|
||||
else
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -38,22 +36,15 @@ module Admin
|
|||
|
||||
def update
|
||||
if @registrar.update(registrar_params)
|
||||
flash[:notice] = t('.updated')
|
||||
redirect_to [:admin, @registrar]
|
||||
redirect_to [:admin, @registrar], notice: t('.updated')
|
||||
else
|
||||
flash.now[:alert] = t('.not_updated')
|
||||
render 'edit'
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @registrar.destroy
|
||||
flash[:notice] = I18n.t('registrar_deleted')
|
||||
redirect_to admin_registrars_path
|
||||
else
|
||||
flash.now[:alert] = I18n.t('failed_to_delete_registrar')
|
||||
render 'show'
|
||||
end
|
||||
@registrar.destroy!
|
||||
redirect_to admin_registrars_url, notice: t('.deleted')
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue