Skip to content

Conversation

chaimann
Copy link
Contributor

@chaimann chaimann commented May 21, 2025

Closes #6125

Summary

Screen.Recording.2025-05-30.at.18.30.04.mov

Other changes

  • add embedded option to UI table to allow it perfectly fit inside a UI panel;
  • add Moveable concern to contain the logic for resources that allow sorting; - split to [Admin] Extract #move action into concern #6282
  • move flashes to its own layout component - split to [Admin] Flashes helper and reorganization #6280;
  • add prefer_turbo_stream? option to resources_controller for children controllers to override when they'd prefer to respond to turbo stream format rather than default html.

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

@github-actions github-actions bot added changelog:solidus_core Changes to the solidus_core gem changelog:solidus_admin labels May 21, 2025
@chaimann chaimann force-pushed the admin-add-edit-option-types branch 2 times, most recently from d5c97a5 to f2d2c8e Compare May 22, 2025 21:44
@github-actions github-actions bot added changelog:solidus_legacy_promotions Changes to the solidus_legacy_promotions gem changelog:solidus_promotions Changes to the solidus_promotions gem and removed changelog:solidus_core Changes to the solidus_core gem labels May 22, 2025
@chaimann chaimann force-pushed the admin-add-edit-option-types branch from f2d2c8e to 06ac254 Compare May 23, 2025 10:39
Copy link

codecov bot commented May 23, 2025

Codecov Report

Attention: Patch coverage is 98.05825% with 2 lines in your changes missing coverage. Please review.

Project coverage is 88.97%. Comparing base (2aed8c3) to head (988b9a1).

Files with missing lines Patch % Lines
...app/controllers/concerns/solidus_admin/moveable.rb 93.33% 1 Missing ⚠️
...trollers/solidus_admin/option_values_controller.rb 96.42% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6236      +/-   ##
==========================================
+ Coverage   88.86%   88.97%   +0.10%     
==========================================
  Files         857      865       +8     
  Lines       18415    18463      +48     
==========================================
+ Hits        16365    16427      +62     
+ Misses       2050     2036      -14     

☔ View full report in Codecov by Sentry.
📢 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.

@chaimann chaimann force-pushed the admin-add-edit-option-types branch 6 times, most recently from c1f6435 to 540ad6a Compare May 30, 2025 16:09
@chaimann chaimann changed the title [Admin] add edit option types [Admin] Enable creation and editing of option type and management of related option values May 30, 2025
@chaimann chaimann force-pushed the admin-add-edit-option-types branch from 9e289b0 to 8bf5466 Compare June 2, 2025 19:42
chaimann added 12 commits June 3, 2025 12:07
Since forms might be not only in modals, change the turbo frame name to
be more general :resource_form
Sortable URL parameter, which is required for sorting to
work properly, was not present for option types table after
changing the index table to use explicit links rather than
`row_url`s, due to condition in the table component
template. Here we move `data-sortable-url` attribute out of
the condition, so it's applicable to any index page that
defines `sortable_options`.
If embedded, table container won't have a border, this will allow for
a table to be rendered inside a panel section without unnecessary
spacing.
`xlink:href` is deprecated per
https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Attribute/xlink:href, recommendation is to use `href` attribute instead.
Leaving `xlink:href` as a fallback option just in case.
This replicates legacy admin flow where newly created option type is
shown with ability to add option values.
chaimann added 22 commits June 3, 2025 12:07
Option values table was not meant to be nested inside the form.
Adds modals for option value add/edit
This will help turbo stream responses to render flashes correctly.
Since we have a form for option type above the option values table, and
users might have unsaved changes in that form, it's a good idea to not
do a full page re-render on create and only target the table that was
changed (plus clearing the modal frame and showing appropriate flash).
DRY actions, resources_controller.rb can now respond to turbo stream if
inheriting controller opts in with #prefer_turbo_stream? override.
Allows for more customization, with ability to override resources paths,
 expected redirection paths, and specify endpoints to skip (e.g. if
 route is not defined).
Following 38c5b69 this file is obsolete
 and can be deleted.
To create separate nested groups, so that different shared examples
don't share same context.
This just doesn't seem to be sensible to have since resources_controller
defines all the CRUD actions, and as soon as all our controllers inherit
from resources_controller, they won't be rubocop compliant because of
this.
@chaimann chaimann force-pushed the admin-add-edit-option-types branch from 8bf5466 to 988b9a1 Compare June 3, 2025 10:08
@chaimann chaimann marked this pull request as ready for review June 3, 2025 16:00
@chaimann chaimann requested a review from a team as a code owner June 3, 2025 16:00
@chaimann chaimann marked this pull request as draft June 5, 2025 10:52
@chaimann
Copy link
Contributor Author

chaimann commented Jun 6, 2025

going to split few changes to separate PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_admin changelog:solidus_legacy_promotions Changes to the solidus_legacy_promotions gem changelog:solidus_promotions Changes to the solidus_promotions gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Admin][Products] Enable creation and editing of option type and management of related option values
1 participant