Skip to content

Commit

Permalink
Merge pull request #2430 from alphagov/improve-organisation-select-on…
Browse files Browse the repository at this point in the history
…-new-batch-upload-page

Improve usability of organisation select on batch_invitations/new
  • Loading branch information
chrislo authored Oct 11, 2023
2 parents dd376e4 + 330d660 commit c60b886
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/batch_invitations/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
id: "batch_invitation_organisation_id",
name: "batch_invitation[organisation_id]",
label: "Organisation",
options: policy_scope(Organisation).map { |organisation| { text: organisation.name_with_abbreviation, value: organisation.id } }
options: policy_scope(Organisation).not_closed.order(:name).map { |organisation| { text: organisation.name_with_abbreviation, value: organisation.id } }
} %>

<% end %>
Expand Down
8 changes: 8 additions & 0 deletions test/controllers/batch_invitations_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ def users_csv(filename = "users.csv")

assert_select "#batch_invitation_organisation_id option", organisation.name
end

should "exclude closed organisations from select" do
create(:organisation)
create(:organisation, closed: true)
get :new

assert_select "#batch_invitation_organisation_id option", 1
end
end

context "POST create" do
Expand Down

0 comments on commit c60b886

Please sign in to comment.