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

Started switching user data entry to use autocomplete #1035

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

hectorcorrea
Copy link
Member

@hectorcorrea hectorcorrea commented Nov 7, 2024

Updates the user entry elements on the form to use an autocomplete textbox and mimics the validation requested on #980.

This animated GIF shows both the autocomplete and the validation in action:
user-autocomplete

Closes #980

User.all.map(&:uid)
end

# Users that can be project sponsors
def self.sponsor_users
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.sponsor_users and self.manager_users below now returns a list of User objects (rather than just their uids) so that we can display both the user name and their netid

@coveralls
Copy link

coveralls commented Nov 14, 2024

Coverage Status

coverage: 84.306% (+0.04%) from 84.27%
when pulling 7c4427d on 980-single-user-select
into 81c95c4 on main.

@@ -88,3 +88,11 @@
end
end
end

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This helper removes the need of calling page.find("body").click as a separate step when validating textboxes since it forces the textbox to lose focus (via tabbing out)

</div>
</div> <!-- id=edit -->

<script>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the biggest change in this PR: the JavaScript logic to get the autocomplete and the validation to work together.

# Without removing the focus from the form field, the "change" event is not propagated for the DOM
page.find("body").click
click_on "btn-add-rw-user"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice that clicking on the button to add the user once selected is not longer necessary in the UI (and therefore on the test). The value selected is automatically added as a user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Single Select User
2 participants