Skip to content

Improve variation and variation idea views and promotion flow#1334

Open
maebeale wants to merge 14 commits intomainfrom
maebeale/variation-form-improvements
Open

Improve variation and variation idea views and promotion flow#1334
maebeale wants to merge 14 commits intomainfrom
maebeale/variation-form-improvements

Conversation

@maebeale
Copy link
Collaborator

@maebeale maebeale commented Mar 3, 2026

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

  • Workshop variations previously delegated windows_type to their parent workshop — this adds a windows_type_id column so variations can have their own type
  • Variation and variation idea edit pages had generic headings that didn't show which record was being edited
  • The workshop dropdown was always visible on forms, but non-admin users shouldn't need to change the workshop association
  • Promoting a variation idea to a variation was missing windows_type_id and organization_id in the attribute copy
  • Both index pages lacked consistency, useful cross-links, and visual polish
  • Purple promote banners (Promoted from/to) needed to be visible on show, edit, and form pages with proper policy gating

How did you approach the change?

Model & migration:

  • Added windows_type_id to workshop_variations table with foreign key
  • Removed delegate :windows_type, to: :workshop — variations now have their own windows type
  • Added model validations for name, rhino_body, windows_type_id, author_credit_preference

Forms & edit pages:

  • Added windows type dropdown next to name on both variation and variation idea forms
  • Gated workshop dropdown behind params[:admin]=true; otherwise passes workshop_id as hidden field
  • Updated edit page headings to show record name with workshop subtitle
  • Fixed controller set_form_variables bug where && short-circuit returned false instead of nil
  • Added enriched variation idea dropdown showing author, windows type abbreviation, and workshop info

Promote banners (purple):

  • Added "Promoted from:" banner on variation form, show, and edit pages (gated by edit policy)
  • Added "Promoted to:" banner on idea show and edit pages — visible to all if variation is published, admin-only otherwise
  • "Not promoted yet" message on ideas is admin-only

Index page redesign (both variations and ideas):

  • Unified column layout: image thumbnail, name (with workshop subtitle), description icon with hover tooltip, author link, lineage cross-link, updated date, actions
  • Variations index: "From idea" column links to source idea (e.g., "Idea Remove Coffeescript #4")
  • Ideas index: "Promoted to" column links to promoted variation (e.g., "Variation Support running the application locally without S3 account #12")
  • Unpublished badge uses pill chip with eye-slash icon matching title_with_badges style

Seeds & tests:

  • Updated seeds so most variations are published and some link to variation ideas
  • Added model spec validations and association tests
  • Added request spec tests for promoted-from banner visibility on show/edit

UI Testing Checklist

  • Run migration: ai/db-migrate
  • Workshop variation edit page shows "Edit workshop variation: {name}" with workshop subtitle
  • Workshop variation idea edit page shows "Edit workshop variation idea: {name}" with workshop subtitle
  • Windows type dropdown appears next to name on both forms and is saveable
  • Workshop dropdown hidden by default, visible with ?admin=true on both forms
  • Promote a variation idea to a variation — windows type and organization carry over
  • Purple "Promoted from:" banner appears on variation show/edit/form when linked to an idea (admin only)
  • Purple "Promoted to:" banner appears on idea show/edit when published variations exist (visible to all)
  • "Not promoted yet" message on ideas is admin-only
  • Variations index: image thumbnail, name with workshop subtitle, description icon, author link, "From idea" cross-link, unpublished chip, updated date
  • Ideas index: matching layout with "Promoted to" cross-link and updated date
  • Unpublished variations show pill chip with eye-slash icon inline with name

Anything else to add?

🤖 Generated with Claude Code

@maebeale maebeale force-pushed the maebeale/variation-form-improvements branch from 985f8c8 to d965b90 Compare March 4, 2026 10:48
maebeale and others added 12 commits March 4, 2026 09:10
- Add windows_type_id column to workshop_variations table
- Remove delegate :windows_type from WorkshopVariation (uses own column now)
- Add windows type dropdown to variation form next to name field
- Permit windows_type_id in workshop_variations controller
- Move windows type to same row as name in variation idea form
- Hide workshop dropdown unless params[:admin]=true on both forms
- Show variation/idea name and parent workshop on edit page headings
- Copy windows_type_id and organization_id when promoting idea to variation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…onal

Ensures admin users with ?admin=true can change the workshop even
when @Workshop is set, rather than always hiding the dropdown.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The workshop_id dropdown now shows on new records so users can select
a workshop. On edit, it remains hidden unless ?admin=true.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reorders the form so workshop and organization appear first,
followed by name and windows type below.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Lets both workshop and windows type labels use the same simple_form
default styling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Workshop dropdown is already above the name row. Adds the windows
type dropdown next to the name field, matching the variation idea
form layout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds py-2 to windows type select inputs on both variation and
variation idea forms.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Uses the same tailwind classes as the simple_form text input wrapper
(rounded-lg, px-3 py-2, shadow-sm) on both windows type selects.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix controller bug where `&&` short-circuit set instance vars to `false` instead of `nil`
- Add purple "Promoted from/to" banners on variation and idea show/edit/form pages
- Add admin-only variation idea dropdown with searchable select on variation form
- Default windows_type to Combined and author_credit_preference to full_name on form
- Show windows type in variation title on show/index pages with Combined fallback
- Consistent "Workshop:" button styling across all variation/idea pages
- Variation index: name column first with linked title, workshop as grey text link
- Show [UNPUBLISHED] badge and 80-char description with 500-char hover on index
- Gate promote banners by policy: "Promoted to" visible if published, "Not promoted" admin-only
- Seed most variations as published and link some to variation ideas

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Update factory to include required windows_type and author_credit_preference
- Add model spec validation tests for all required fields
- Add association tests for windows_type, created_by, workshop_variation_idea
- Add request spec tests for show page promoted-from banner visibility
- Add request spec test for edit page rendering without false instance vars
- Fix promotion test params to include new required fields

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Unify both indexes with matching columns: image thumbnail, name (with
workshop subtitle), description icon, author link, lineage cross-links
(From idea / Promoted to), updated date. Add unpublished badge chip
with eye-slash icon matching title_with_badges style.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@maebeale maebeale changed the title Improve variation and variation idea forms and edit pages Improve variation and variation idea views and promotion flow Mar 4, 2026
@maebeale maebeale force-pushed the maebeale/variation-form-improvements branch from 1867867 to f00f916 Compare March 4, 2026 14:33
maebeale and others added 2 commits March 4, 2026 09:48
- Update page_bg_class_alignment_spec to expect "admin-or-auth" for
  ideas index after changing from "admin-only bg-blue-100"
- Fix show view spec to use author_credit instead of user.name
- Fix unpublished indicator check to match title_with_badges output

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nsity

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
workshop_variation:
rhino_body: "Details"
workshop_variation_idea:
rhino_body: "Details"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the error was saying "Rhino body can't be blank" and people won't understand what that means. Went with "Details" so we know it's not referring to a field in the db.

rhino_body: var_data[:rhino_body],
position: var_data[:position]
position: var_data[:position],
published: i != variations.length - 1
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed position (label was Ordering) from the UI in this pr, but still setting seeded variations w a position.

we may want to add in a way for admins to organize the variations on Workshop Show later, but we can wait until that bubbles up from the user.

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.

1 participant