Skip to content

Add Tags sections to Stories, CommunityNews, Events, and Resources edit pages#914

Merged
maebeale merged 7 commits intomainfrom
copilot/add-tags-section-edit-page
Feb 12, 2026
Merged

Add Tags sections to Stories, CommunityNews, Events, and Resources edit pages#914
maebeale merged 7 commits intomainfrom
copilot/add-tags-section-edit-page

Conversation

Copy link
Contributor

Copilot AI commented Feb 10, 2026

What is the goal of this PR and why is this important?

Stories, CommunityNews, Events, and Resources edit pages lacked UI for assigning categories and sectors, despite models already having the necessary associations and TagFilterable concern. This adds the missing UI following the Workshop edit page pattern.

How did you approach the change?

Controllers (stories, community_news, events, resources):

  • Added assign_associations method to convert checkbox params to ActiveRecord associations
  • Wrapped create/update in transactions to ensure atomicity with tag assignments
  • Extended set_form_variables to load @sectors and @categories_grouped
  • Added category_ids: [] and sector_ids: [] to strong params

Views (_form.html.erb for each resource):

  • Added collapsible Tags accordion with Service Populations (sectors) and Additional Tags (categories grouped by type)
  • Used checkbox arrays with hidden fields to handle unchecked state
  • Matched Workshop's UI structure and styling exactly
def assign_associations(story)
  selected_category_ids = Array(params[:story][:category_ids]).reject(&:blank?).map(&:to_i)
  story.categories = Category.where(id: selected_category_ids)

  selected_sector_ids = Array(params[:story][:sector_ids]).reject(&:blank?).map(&:to_i)
  story.sectors = Sector.where(id: selected_sector_ids)
end

Anything else to add?

Resources controller already permitted tag params but lacked the assignment logic and form UI. No model changes required - all associations were already configured.

Original prompt

add Tags section to edit page for: Stories, CommunityNews, Events, Resources, if not already present. follow the pattern established in the Workshop edit.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add tags section to edit page for various content types Add Tags sections to Stories, CommunityNews, Events, and Resources edit pages Feb 10, 2026
Copilot AI requested a review from maebeale February 10, 2026 14:08
@maebeale maebeale marked this pull request as ready for review February 10, 2026 14:49
@maebeale maebeale force-pushed the copilot/add-tags-section-edit-page branch 2 times, most recently from 4944713 to fea1589 Compare February 11, 2026 00:49
Copilot AI and others added 5 commits February 11, 2026 19:48
…it pages

Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com>
* add show page image upload

* clean up old asset upload

* add stimulus with status bar

* fix progress bar

* fix spec

* use turbo-frame top

disable broken test

* add policy to button

* rubocop
@maebeale maebeale force-pushed the copilot/add-tags-section-edit-page branch from 803eff6 to ade1343 Compare February 12, 2026 00:51
@maebeale maebeale merged commit c40d628 into main Feb 12, 2026
3 checks passed
@maebeale maebeale deleted the copilot/add-tags-section-edit-page branch February 12, 2026 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants