Replace org Windows-audience dropdown with age-range chip picker - #2039
Draft
maebeale wants to merge 1 commit into
Draft
Replace org Windows-audience dropdown with age-range chip picker#2039maebeale wants to merge 1 commit into
maebeale wants to merge 1 commit into
Conversation
The Windows-audience select edited windows_type_id, which no other org flow sets and which duplicated concepts already captured by age ranges. Swap it for the same cocoon age-range chip picker the person form uses, sharing the chip mechanics through AgeGroupTaggable so both models stay in step. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Replaces the Organization edit form’s “Windows audience” (windows_type_id) dropdown with the existing cocoon-based age-range chip picker used on the Person form, and moves the shared age-range nested-association mechanics (ordering + dedupe) into AgeGroupTaggable so both models share the same behavior.
Changes:
- Swap org form UI from
windows_type_idselect to age-range chip picker (nestedage_range_categorizable_items). - Extract Person’s age-range nested association + dedupe + ordering into
AgeGroupTaggable. - Add/adjust specs to assert the new UI and verify age-range saving behavior for organizations.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| spec/views/organizations/edit.html.erb_spec.rb | Updates view spec to assert the windows dropdown is gone and chip picker markup is present. |
| spec/requests/organizations_age_ranges_spec.rb | Adds request coverage for org edit UI and saving/deduping age ranges while preserving other category taggings. |
| app/views/organizations/_form.html.erb | Replaces the windows dropdown with the age-range cocoon chip picker; adds hidden keys to support assign_associations behavior. |
| app/models/person.rb | Removes duplicated age-range nested-association logic now provided by AgeGroupTaggable. |
| app/models/concerns/age_group_taggable.rb | Adds shared age-range nested association + ordering + dedupe used by both Person and Organization. |
| app/controllers/organizations_controller.rb | Provides age-range collections for the form and permits age-range nested attributes; removes windows_type_id from permitted params. |
Suppressed comments (1)
app/controllers/organizations_controller.rb:243
- blocker: Because the form now always submits
organization[category_ids](blank key), permittingcategory_idshere causesassign_attributesto replace the organization’s categories duringupdatebefore the age-range nested attributes and beforeassign_associationscan preserve non-managed types; this can drop age-range taggings and can also break nested updates that submit existingage_range_categorizable_itemsids.
:profile_show_sectors, :profile_show_email, :profile_show_phone,
:profile_show_website, :profile_show_description, :profile_show_workshops,
:profile_show_stories, :profile_show_events_registered, :profile_show_workshop_logs,
category_ids: [],
sectorable_items_attributes: [
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 suggested review level: 3 Read 📖 contained UI swap + a small shared-concern extraction, all covered by specs
What is the goal of this PR and why is this important?
windows_type_id) is replaced by the same cocoon age-range chip picker the person form already uses.windows_type_id, so its permitted param is dropped too (the column/reads elsewhere are untouched).How did you approach the change?
age_range_categorizable_itemsnested association, dedupe, ordering) intoAgeGroupTaggable, which both Person and Organization already include — Person now inherits them instead of defining its own.@age_ranges_collection/@managed_category_type_idsand the form emits thecategory_ids/managed_category_type_idskeys so saving preserves age ranges (and other unmanaged category types) viaassign_associations.Anything else to add?
organizations_age_ranges_spec.rb; person age-range + org edit-view specs still green.