Skip to content

Commit

Permalink
Only open option-selects when app has checked permissions
Browse files Browse the repository at this point in the history
Set each option-select component to open on load only if any of its
permissions are selected. At the moment this is only relevant to the new
invitation page when validation errors have occurred and the form has
been re-rendered. The new batch invitation permissions page currently
never has any validation errors, so we can just hard-code the value of
`closed_on_load` to `true`. This behaviour is very similar to what we
did on the users index page.

Since this behaviour is implemented in JS, it's not possible to test it
in the controller test and it doesn't seem important enough to add an
integration test for it.
  • Loading branch information
floehopper committed Oct 11, 2023
1 parent 80cd767 commit a12bc15
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/views/batch_invitation_permissions/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
key: "user[supported_permission_ids]",
options_container_id: "user_application_#{application.id}_supported_permissions",
show_filter: options.length > 4,
closed_on_load: true,
options:,
}) %>
<% end %>
Expand Down
1 change: 1 addition & 0 deletions app/views/devise/invitations/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
key: "user[supported_permission_ids]",
options_container_id: "user_application_#{application.id}_supported_permissions",
show_filter: options.length > 4,
closed_on_load: options.none? { |o| o[:checked] },
options:,
}) %>
<% end %>
Expand Down

0 comments on commit a12bc15

Please sign in to comment.