Repository navigation
Improve Spree::Preferences constants and source code documentation - #6696
jarednorman merged 3 commits into
Conversation
3bda527 to
5f00236
Compare
Spree::Prefrences constants and source code documentationSpree::Preferences constants and source code documentation
5f00236 to
6b57fb1
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6696 +/- ##
=======================================
Coverage 92.46% 92.46%
=======================================
Files 1058 1058
Lines 21495 21495
=======================================
Hits 19875 19875
Misses 1620 1620 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| # @return [Array] | ||
| def allowed_admin_form_preference_types = Spree::Preferences::FORM_FIELD_TYPES | ||
| def allowed_admin_form_preference_types | ||
| Spree::Preferences::FORM_FIELD_TYPES.dup |
There was a problem hiding this comment.
After coming to this fresh today, I realized that this breaks current functionality in payment method extensions.
So I intend to drop this change.
I'll instead create a separate pull request to deprecate this method and make allowed form preference types a proper configuration point on Spree::AppConfiguration.
There was a problem hiding this comment.
To clarify: by "this change" I just mean the commit where I add the #dup call.
6b57fb1 to
b2229c3
Compare
|
Real failures on CI? |
|
@jarednorman Yeah, real. Merge conflict after #6695 was merged. Will fix this today. |
I found the old `DEFAULT_ADMIN_FORM_PREFERENCE_TYPES` constant to be a bit buried given how critical the information it contains is. (It's used across Solidus libraries for calculators, promotions, and payment methods.) It serves as better documentation as a part of the main `Spree::Preferences` class where the rest of the documentation for preferences live. This also clarify exactly what preferences are explicitly supported by Solidus. Before this, you had to dig through a case statement to see the full list.
While I was referring to the preferences documentation I found a lot of detail that muddied the purpose and usage instructions. This commit rewrites the docs and removes some superfluous and repeated docs. Hopefully this makes the documentation more maintainable over time. I also wanted to add explicit reference to preferences within the payment method class documentation. Hopefully this helps orient developers working on payment method integrations so that they understand better: - which preference types are built-in. - where the seams are for making admin-editable payment method records In subsequent commits, I will add additional documentation for where admin view components will be expected for applications using `solidus_admin`. There is only one preference to the legacy `preference_fields/` partials directory now, so there is now only one place to add references to the new admin's fields directory.
b2229c3 to
e9a73d6
Compare
|
I amended a test assertion introduced when #6695 was merged. It was using one of the old constants that I removed in this pull request. No other changes. |
…tation-improvements Improve `Spree::Preferences` constants and source code documentation
Summary
While I have been building out payment method interfaces for the new
solidus_admingem, I had reason to dig into how preferences work. I needed to test that forms were working correctly against every supported preference type.I noticed that some of the documentation was unclear or could be improved.
I also noticed some constants related to
Spree::Preferencesfunctionality could be renamed to act as better documentation for these features, too.Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: