Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 20, 2026

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

Port the WordPress story submission form fields to the Rails app's /stories/new and /story_ideas/new forms. The WordPress form captures story categories (25 types like "Advocacy", "Domestic Violence", "LGBTQIA+") and story populations (7 types like "Adults", "Children", "Self") via multi-select checkboxes.

How did you approach the change?

Database:

  • Added story_populations JSON column to stories and story_ideas tables
  • Created migration seeding 25 story categories under new StoryCategory type

Models:

  • Story: Added nested attributes for categorizable_items
  • StoryIdea: Added categorizable_items associations and nested attributes
  • Category: Added story_categories scope filtering by type

Controllers:

  • Updated strong params to permit story_populations[], category_ids[], categorizable_items_attributes
  • Load story categories in form setup methods

Views:

  • Added category checkboxes (multi-select, 3-column grid)
  • Added population checkboxes (multi-select, 4-column grid)
  • Disabled fields respect promoted story state in StoryIdea form

Example checkbox implementation:

<%= f.collection_check_boxes :category_ids, @categories, :id, :name do |b| %>
  <div class="flex items-center">
    <%= b.check_box class: "rounded border-gray-300 text-purple-600" %>
    <%= b.label class: "ml-2 text-sm text-gray-700" %>
  </div>
<% end %>

Anything else to add?

Story populations use JSON arrays for flexible querying. Categories leverage existing polymorphic categorizable_items system used by workshops and other models.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add story_categories and story_populations to StoryIdea and Story</issue_title>
<issue_description>Figure out if these can become Sectors or if they need to be Categories or an entirely new model

Currently serviced via wordpress: https://stories.awbw.org/share/ (pics below).

We have most of this form under /story_ideas/new, and now need to add the multiselect checkboxes to that form.

Let's add story_populations as a json field to Story and StoryIdea

Both models will need to:
has_many :categorizable_items, dependent: :destroy, as: :categorizable
has_many :categories, through: :categorizable_items

And then the accepts_nested_attributes so these can pass via strong params
</issue_description>

<agent_instructions>follow the instructions in the description and reference the images and links to adapt the current system to be able to simulate under stories/new and story_ideas/new the same thing they have on wordpress currently.

</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@maebeale Image Image Image

Image</comment_new>
<comment_new>@maebeale
cc @johnpaulashenfelter </comment_new>
<comment_new>@maebeale
@copilot follow the instructions in the description and reference the images and links to adapt the current system to be able to simulate under stories/new and story_ideas/new the same thing they have on wordpress currently.</comment_new>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 20, 2026 00:55
…ryIdea models

Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com>
Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com>
Copilot AI changed the title [WIP] Add story_categories and story_populations to models Add story categories and populations to Story and StoryIdea forms Jan 20, 2026
Copilot AI requested a review from maebeale January 20, 2026 01:00
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.

Add story_categories and story_populations to StoryIdea and Story

2 participants