-
-
Notifications
You must be signed in to change notification settings - Fork 499
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
4780: Fix item lookup issues on new kit page #4781
4780: Fix item lookup issues on new kit page #4781
Conversation
Looks good to me from a funcitonal pov. Over to @dorner for technical comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this existed before - but in previous usages, the ID was added in the calling code, which "knew" that the IDs were unique. In this case we're moving it to the helper, so we need to be a bit more careful.
app/helpers/ui_helper.rb
Outdated
@@ -14,6 +14,7 @@ def add_element_button(label, container_selector:, **html_attrs, &block) | |||
add_dest_selector: container_selector, | |||
action: "click->form-input#addItem:prevent" }, | |||
role: "button", | |||
id: "__add_line_item", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assumes we'd never have more than one "add element button" on a page. Can we key off something other than ID?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point. I will move the id back to being passed in as an argument.
While we could change it to being an .add_line_item
class here, we would have to modify the JS that clicks this button automatically to find the element by class rather than id. And then use some logic to determine which (or all) of the add element buttons to click. Which feels like coding for some hypothetical future case of having mutliple add item buttons, which doesn't exist yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this id back to being an argument.
@@ -22,7 +22,7 @@ | |||
</div> | |||
<div class="row links"> | |||
<div class="col-xs-12 p-3"> | |||
<%= add_element_button "Add Another Item", container_selector: "#audit_line_items" do %> | |||
<%= add_element_button "Add Another Item", container_selector: "#audit_line_items", id: "__add_line_item" do %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noticed that this method call was also missing the id
option.
I added some corresponding system specs, but I can remove them if you think the coverage isn't worth the extra weight of system specs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
@coalest: Your PR |
Resolves #4780
Description
The new kit view was missing the bootstrap modal to add new barcode items, and the proper HTML id in order for a new item to be adding automatically after adding an item via barcode.
Note: Because the JS relies on the add another item button to have a certain id, I moved that into the helper method, for future error proofing.
Type of change
How Has This Been Tested?
Added a new system test. (Not sure how else to test this behavior because it relies on JS)