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

SolidusAdmin: Components per Adjustment Source #5789

Merged
merged 1 commit into from
Jun 14, 2024

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Jun 13, 2024

This adds a few components that just display adjustment sources. There are no visual changes. The improvement I was looking for is to de-couple the adjustments table from individual source types through dynamic component lookup:

component_name = adjustment.source&.class&.table_name&.singularize
component_key = ["orders/show/adjustments/index/adjustment", component_name].compact.join("/")
render component(component_key).new(adjustment)

This allows the solidus_legacy_promotions gem to ship with a component that knows how to render an adjustment source of type Spree::PromotionAction without hardcoding anything in SolidusAdmin.

@mamhoff mamhoff requested a review from a team as a code owner June 13, 2024 14:02
@mamhoff mamhoff force-pushed the admin-adjustment-components branch from 651d942 to 58325d1 Compare June 13, 2024 14:09
Copy link

codecov bot commented Jun 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.78%. Comparing base (44603e1) to head (ca574c9).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5789      +/-   ##
==========================================
+ Coverage   88.73%   88.78%   +0.05%     
==========================================
  Files         713      717       +4     
  Lines       16924    16936      +12     
==========================================
+ Hits        15017    15037      +20     
+ Misses       1907     1899       -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This adds a few components that just display adjustment sources. There
are no visual changes. The improvement I was looking for is to de-couple
the adjustments table from individual source types through dynamic
component lookup:

```
component_name = adjustment.source&.class&.table_name&.singularize
component_key = ["orders/show/adjustments/index/adjustment", component_name].compact.join("/")
render component(component_key).new(adjustment)
```

This allows the `solidus_legacy_promotions` gem to ship with a component
that knows how to render an adjustment source of type
`Spree::PromotionAction` without hardcoding anything in `SolidusAdmin`.
@mamhoff mamhoff force-pushed the admin-adjustment-components branch from 58325d1 to ca574c9 Compare June 13, 2024 15:40
Copy link
Member

@elia elia left a comment

Choose a reason for hiding this comment

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

👏

Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

🪄

@kennyadsl kennyadsl merged commit f7d8f27 into solidusio:main Jun 14, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants