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

Improve usability of organisation select on batch_invitations/new #2430

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
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