Skip to content

Commit

Permalink
Merge pull request #8505 from alphagov/default-role-appointment-perso…
Browse files Browse the repository at this point in the history
…n-to-empty

Make the Person field in the Role Appointments form default to empty
  • Loading branch information
robinjam authored Nov 14, 2023
2 parents a92d176 + 7b12232 commit 0c6e24a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/views/admin/role_appointments/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
label: "Person (required)",
heading_size: "l",
name: "role_appointment[person_id]",
options:
disambiguated_people_names.map { |person_name, person_id|
options: (
[{ text: "", value: "", selected: false }] +
disambiguated_people_names.map do |person_name, person_id|
{
text: person_name,
value: person_id,
selected: form.object.person_id == person_id,
}
}.select do |option|
form.object.new_record? || option[:selected]
end,
end
).select do |option|
form.object.new_record? || option[:selected]
end,
error_message: errors_for_input(form.object.errors, :person_id),
} %>

Expand Down

0 comments on commit 0c6e24a

Please sign in to comment.