Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscellaneous improvements to admin forms for editing user #2531

Merged
merged 4 commits into from
Nov 20, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add cancel links to edit user name & email pages
floehopper committed Nov 20, 2023
commit acad2fd9cbdb034dca962d5ab5f69b60dab55913
9 changes: 6 additions & 3 deletions app/views/users/emails/edit.html.erb
Original file line number Diff line number Diff line change
@@ -64,9 +64,12 @@
autocomplete: "off",
error_items: @user.errors.full_messages_for(:email).map { |message| { text: message } }
} %>
<%= render "govuk_publishing_components/components/button", {
text: "Change email"
} %>
<div class="govuk-button-group">
<%= render "govuk_publishing_components/components/button", {
text: "Change email",
} %>
<%= link_to "Cancel", edit_user_path(@user), class: "govuk-link govuk-link--no-visited-state" %>
</div>
<% end %>
</div>
</div>
9 changes: 6 additions & 3 deletions app/views/users/names/edit.html.erb
Original file line number Diff line number Diff line change
@@ -51,9 +51,12 @@
autocomplete: "off",
error_items: @user.errors.full_messages_for(:name).map { |message| { text: message } }
} %>
<%= render "govuk_publishing_components/components/button", {
text: "Change name"
} %>
<div class="govuk-button-group">
<%= render "govuk_publishing_components/components/button", {
text: "Change name",
} %>
<%= link_to "Cancel", edit_user_path(@user), class: "govuk-link govuk-link--no-visited-state" %>
</div>
<% end %>
</div>
</div>
2 changes: 2 additions & 0 deletions test/controllers/users/emails_controller_test.rb
Original file line number Diff line number Diff line change
@@ -19,6 +19,8 @@ class Users::EmailsControllerTest < ActionController::TestCase
assert_template :edit
assert_select "form[action='#{user_email_path(user)}']" do
assert_select "input[name='user[email]']", value: "[email protected]"
assert_select "button[type='submit']", text: "Change email"
assert_select "a[href='#{edit_user_path(user)}']", text: "Cancel"
end
end

2 changes: 2 additions & 0 deletions test/controllers/users/names_controller_test.rb
Original file line number Diff line number Diff line change
@@ -16,6 +16,8 @@ class Users::NamesControllerTest < ActionController::TestCase
assert_template :edit
assert_select "form[action='#{user_name_path(user)}']" do
assert_select "input[name='user[name]']", value: "user-name"
assert_select "button[type='submit']", text: "Change name"
assert_select "a[href='#{edit_user_path(user)}']", text: "Cancel"
end
end