mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 21:25:39 +02:00
Improve error messages
This commit is contained in:
parent
61f6a3705f
commit
aa8be7d148
3 changed files with 20 additions and 11 deletions
|
@ -16,8 +16,8 @@ module Admin
|
||||||
|
|
||||||
if @api_user.valid?
|
if @api_user.valid?
|
||||||
@api_user.save!
|
@api_user.save!
|
||||||
flash[:notice] = I18n.t('record_created')
|
redirect_to admin_registrar_api_user_path(@api_user.registrar, @api_user),
|
||||||
redirect_to admin_registrar_api_user_path(@api_user.registrar, @api_user)
|
notice: t('.created')
|
||||||
else
|
else
|
||||||
render 'new'
|
render 'new'
|
||||||
end
|
end
|
||||||
|
@ -38,8 +38,8 @@ module Admin
|
||||||
|
|
||||||
if @api_user.valid?
|
if @api_user.valid?
|
||||||
@api_user.save!
|
@api_user.save!
|
||||||
flash[:notice] = I18n.t('record_updated')
|
redirect_to admin_registrar_api_user_path(@api_user.registrar, @api_user),
|
||||||
redirect_to admin_registrar_api_user_path(@api_user.registrar, @api_user)
|
notice: t('.updated')
|
||||||
else
|
else
|
||||||
render 'edit'
|
render 'edit'
|
||||||
end
|
end
|
||||||
|
@ -47,7 +47,7 @@ module Admin
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@api_user.destroy!
|
@api_user.destroy!
|
||||||
redirect_to admin_registrar_path(@api_user.registrar), notice: t('record_deleted')
|
redirect_to admin_registrar_path(@api_user.registrar), notice: t('.deleted')
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -5,18 +5,27 @@ en:
|
||||||
header: API users
|
header: API users
|
||||||
active: Active
|
active: Active
|
||||||
|
|
||||||
|
new:
|
||||||
|
header: New API user
|
||||||
|
|
||||||
|
create:
|
||||||
|
created: API user has been successfully created
|
||||||
|
|
||||||
show:
|
show:
|
||||||
active: Active
|
active: Active
|
||||||
subject: Subject
|
subject: Subject
|
||||||
edit_btn: Edit
|
edit_btn: Edit
|
||||||
delete_btn: Delete
|
delete_btn: Delete
|
||||||
|
|
||||||
new:
|
|
||||||
header: New API user
|
|
||||||
|
|
||||||
edit:
|
edit:
|
||||||
header: Edit API user
|
header: Edit API user
|
||||||
|
|
||||||
|
update:
|
||||||
|
updated: API user has been successfully updated
|
||||||
|
|
||||||
|
destroy:
|
||||||
|
deleted: API user has been successfully deleted
|
||||||
|
|
||||||
form:
|
form:
|
||||||
active: Active
|
active: Active
|
||||||
create_btn: Create API user
|
create_btn: Create API user
|
||||||
|
|
|
@ -16,7 +16,7 @@ class AdminRegistrarsApiUsersSystemTest < ApplicationSystemTestCase
|
||||||
fill_in 'Password', with: valid_password
|
fill_in 'Password', with: valid_password
|
||||||
click_on 'Create API user'
|
click_on 'Create API user'
|
||||||
|
|
||||||
assert_text 'Record created'
|
assert_text 'API user has been successfully created'
|
||||||
assert_text "Username #{username}"
|
assert_text "Username #{username}"
|
||||||
new_api_user = ApiUser.last
|
new_api_user = ApiUser.last
|
||||||
assert_current_path admin_registrar_api_user_path(registrar, new_api_user)
|
assert_current_path admin_registrar_api_user_path(registrar, new_api_user)
|
||||||
|
@ -45,7 +45,7 @@ class AdminRegistrarsApiUsersSystemTest < ApplicationSystemTestCase
|
||||||
fill_in 'Username', with: new_username
|
fill_in 'Username', with: new_username
|
||||||
click_link_or_button 'Update API user'
|
click_link_or_button 'Update API user'
|
||||||
|
|
||||||
assert_text 'Record updated'
|
assert_text 'API user has been successfully updated'
|
||||||
assert_text "Username #{new_username}"
|
assert_text "Username #{new_username}"
|
||||||
assert_current_path admin_registrar_api_user_path(api_user.registrar, api_user)
|
assert_current_path admin_registrar_api_user_path(api_user.registrar, api_user)
|
||||||
end
|
end
|
||||||
|
@ -56,7 +56,7 @@ class AdminRegistrarsApiUsersSystemTest < ApplicationSystemTestCase
|
||||||
visit admin_registrar_api_user_path(api_user.registrar, api_user)
|
visit admin_registrar_api_user_path(api_user.registrar, api_user)
|
||||||
click_on 'Delete'
|
click_on 'Delete'
|
||||||
|
|
||||||
assert_text 'Record deleted'
|
assert_text 'API user has been successfully deleted'
|
||||||
assert_current_path admin_registrar_path(api_user.registrar)
|
assert_current_path admin_registrar_path(api_user.registrar)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue