[solidus_admin] Add product taxon management - #6610
benjaminwil wants to merge 19 commits into
Conversation
e3300a1 to
1c258fb
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6610 +/- ##
==========================================
+ Coverage 92.33% 92.35% +0.02%
==========================================
Files 1050 1052 +2
Lines 21364 21354 -10
==========================================
- Hits 19726 19722 -4
+ Misses 1638 1632 -6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
1c258fb to
a2dcfb3
Compare
852c261 to
e932dda
Compare
4931362 to
4d2e196
Compare
46f3ad3 to
5573c62
Compare
8aaeac6 to
59e1684
Compare
Delegate option type methods #name, #presentation, #option_values for easier access in the view.
Now that the pull request that replaced the referenced PR has been merged, we no longer need to skip this test.
By default, a selected option has the same text representation as in the options list. This change allows to customize it.
Indentation with an arrow is only useful when showing the list of taxons in the dropdown, we can just show the name of taxon when selected to save space.
Include hidden field to allow emptying categories collection when none selected. Add link and turbo frame for a new category modal. Modal frame targets category select, so on successful request the only part of the form that will be updated is this select field, preserving any other inputs that user might have yet unsaved in the product form. Turbo stream action update will empty the modal essentially closing it.
With turbo frame response only `product_organization_frame` will be targeted for change after successful request, so in order to show flash message we can use turbo stream replace from within the frame to refresh the flashes.
Hides implementation details of the modal "close" and flashes refresh logic, and also allows to reuse it in similar scenarios.
These helpers are related to new admin so it's better to place them in feature_helpers.rb
Choosing empty parent category will create a root taxon and a new taxonomy record under the hood.
These tests were failing due to there being two dialogs in the DOM. We can disambiguate using the heading text of the dialog.
This change more closely mirrors how the working form for product option type IDs works. Feature tests related to adding taxons were failing, and this change resolves the issue.
I have verified that this is still an issue. I have updated the comment so nobody thinks it's stale (because of the reference to Circle CI).
59e1684 to
d9c7d1a
Compare
|
I just rebased against the latest |
tvdeyen
left a comment
There was a problem hiding this comment.
I have not verified with the Figma design, but the taxon select looks weirdly off. We have prett_name on Taxon. Either use that or create a TaxonSelect component. We can do this in subsequent PRs, though
|
|
||
| def parent_taxon_options | ||
| @parent_taxon_options ||= Spree::Taxon.order(:lft).pluck(:name, :id, :depth).map do | ||
| name, id, depth = _1 |
There was a problem hiding this comment.
Why not use Taxon#pretty_name here?
Even if we decide to use a new style for this select I propose to create a dedicated TaxonSelect instead of hiding it in here.
Summary
Replaces #6296.
This pull request implements product taxon management functionality in the product editor. Now, there are two ways to manage taxons:
I have co-opted much of this work from the original author. I will assume responsibility for any changes that need to be made as a result of code review.
Checklist
Note that the original author had already marked these checklist items as completed on #6296.
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: