Use standard UI

This commit is contained in:
Artur Beljajev 2019-12-09 22:13:53 +02:00
parent 837f3ed541
commit b850efb939
4 changed files with 9 additions and 8 deletions

View file

@ -1,5 +1,5 @@
<%= form_for([:admin, @api_user.registrar, @api_user], html: { class: 'form-horizontal', autocomplete: 'off' }) do |f| %>
<%= render 'shared/full_errors', object: @api_user %>
<%= render 'form_errors', target: @api_user %>
<div class="row">
<div class="col-md-8">
@ -48,12 +48,11 @@
</div>
</div>
<hr/>
<hr>
<div class="row">
<div class="col-md-8 text-right">
<%= button_tag(t(:save), class: 'btn btn-primary') %>
<%= button_tag t(".#{f.object.new_record? ? 'create' : 'update'}_btn"), class: 'btn btn-success' %>
</div>
</div>
<% end %>

View file

@ -14,12 +14,12 @@
<div class="col-sm-4 text-right">
<%= link_to t('.edit_btn'), edit_admin_registrar_api_user_path(@api_user.registrar,
@api_user),
class: 'btn btn-default' %>
class: 'btn btn-primary' %>
<%= link_to t('.delete_btn'), admin_registrar_api_user_path(@api_user.registrar,
@api_user),
method: :delete,
data: { confirm: t(:are_you_sure) },
class: 'btn btn-danger' %>
class: 'btn btn-default' %>
</div>
</div>
</div>

View file

@ -19,3 +19,5 @@ en:
form:
active: Active
create_btn: Create API user
update_btn: Update API user

View file

@ -14,7 +14,7 @@ class AdminRegistrarsApiUsersSystemTest < ApplicationSystemTestCase
fill_in 'Username', with: username
fill_in 'Password', with: valid_password
click_on 'Save'
click_on 'Create API user'
assert_text 'Record created'
assert_text "Username #{username}"
@ -43,7 +43,7 @@ class AdminRegistrarsApiUsersSystemTest < ApplicationSystemTestCase
visit admin_registrar_api_user_path(api_user.registrar, api_user)
click_link_or_button 'Edit'
fill_in 'Username', with: new_username
click_link_or_button 'Save'
click_link_or_button 'Update API user'
assert_text 'Record updated'
assert_text "Username #{new_username}"