Skip to content

[solidus_admin] Add product taxon management - #6610

Open
benjaminwil wants to merge 19 commits into
solidusio:mainfrom
benjaminwil:admin-product-organization--categories
Open

benjaminwil wants to merge 19 commits into
solidusio:mainfrom
benjaminwil:admin-product-organization--categories

Conversation

@benjaminwil

@benjaminwil benjaminwil commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Replaces #6296.

This pull request implements product taxon management functionality in the product editor. Now, there are two ways to manage taxons:

  1. Adding existing taxons using the taxon multi-select component in the Product organization panel. (This functionality seems to already have existed but is much improved via this pull request.)
  2. Adding new taxons using the Add new category button, which opens up a taxon creation modal dialog form. New taxons can either be created as root taxons or child taxons of existing taxons.
image image

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:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@benjaminwil
benjaminwil requested a review from a team as a code owner September 12, 2026 04:11
@github-actions github-actions Bot added changelog:solidus_core Changes to the solidus_core gem changelog:solidus_admin labels Sep 12, 2026
@benjaminwil
benjaminwil force-pushed the admin-product-organization--categories branch from e3300a1 to 1c258fb Compare September 12, 2026 04:14
@codecov

codecov Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.35%. Comparing base (0c0f5aa) to head (d9c7d1a).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@benjaminwil
benjaminwil force-pushed the admin-product-organization--categories branch from 1c258fb to a2dcfb3 Compare September 12, 2026 04:54
@benjaminwil
benjaminwil marked this pull request as draft September 12, 2026 04:55
@github-actions github-actions Bot added the changelog:solidus_backend Changes to the solidus_backend gem label Sep 12, 2026
@benjaminwil
benjaminwil force-pushed the admin-product-organization--categories branch 4 times, most recently from 852c261 to e932dda Compare September 13, 2026 18:51
@benjaminwil
benjaminwil force-pushed the admin-product-organization--categories branch 15 times, most recently from 4931362 to 4d2e196 Compare September 14, 2026 20:08
@benjaminwil
benjaminwil force-pushed the admin-product-organization--categories branch from 46f3ad3 to 5573c62 Compare September 14, 2026 21:18
@github-actions github-actions Bot removed the changelog:solidus_backend Changes to the solidus_backend gem label Sep 14, 2026
@benjaminwil
benjaminwil force-pushed the admin-product-organization--categories branch 2 times, most recently from 8aaeac6 to 59e1684 Compare September 14, 2026 21:55
@benjaminwil
benjaminwil marked this pull request as ready for review September 14, 2026 23:18
@benjaminwil benjaminwil moved this to Review in Solidus Admin Sep 15, 2026
chaimann and others added 19 commits September 16, 2026 09:34
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).
@benjaminwil
benjaminwil force-pushed the admin-product-organization--categories branch from 59e1684 to d9c7d1a Compare September 16, 2026 16:36
@benjaminwil

Copy link
Copy Markdown
Contributor Author

I just rebased against the latest main and resolved a merge conflict related to the solidus_admin feature test helpers file.

@tvdeyen tvdeyen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Review

Development

Successfully merging this pull request may close these issues.

4 participants