Hide "Change photo" control on published story view#1549
Conversation
The "Change photo" picker sat between the story metadata and the hero image on the published story page, adding empty/right-aligned chrome and vertical whitespace at the top of the page. Editors change a story's primary photo from the edit view (form_image_fields with include_primary_asset), so the inline picker here was redundant. Remove the picker render and its now-orphaned upload-progress bar from the story show view, keeping the hero image display. The shared assets/_primary_image_picker partial is untouched so workshop and resource show pages keep their picker. Closes #1518 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| </div> | ||
|
|
||
| <div class="flex justify-end"> | ||
| <%= render "assets/primary_image_picker", owner: @story %> |
There was a problem hiding this comment.
Removed the inline primary_image_picker render and its upload-progress bar from the published story view, keeping only hero-image. The shared assets/_primary_image_picker partial is intentionally left untouched so the workshop (workshops/_show_header) and resource (resources/show) pages keep their picker. The Stimulus asset_picker_controller references upload-progress/hero-image via guarded getElementById, so dropping the progress bar from this view is safe.
There was a problem hiding this comment.
Pull request overview
This PR removes the inline primary-image “Change photo” UI from the published Story show page to eliminate the extra right-aligned chrome/whitespace, while keeping the hero image display intact. It also adds a view spec to prevent the control from reappearing on the published Story page.
Changes:
- Remove rendering of the primary image picker (and its upload progress bar markup) from
stories/show. - Keep the hero image display on the published Story page.
- Add a view spec asserting the “Change photo” control is not rendered on the Story show view.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| app/views/stories/show.html.erb | Removes the inline primary image picker + upload progress bar from the Story show page while retaining the hero image rendering. |
| spec/views/stories/show.html.erb_spec.rb | Adds a regression test to ensure the “Change photo” control is not rendered on the Story show page. |
| it "does not render the 'Change photo' control, even for admins" do | ||
| render | ||
| expect(rendered).not_to match(/Change photo/) | ||
| end |
Closes #1518
What is the goal of this PR and why is this important?
How did you approach the change?
assets/primary_image_pickerrender and its now-orphanedupload-progressbar fromapp/views/stories/show.html.erb.hero-imagedisplay so the photo still renders.assets/_primary_image_pickerpartial untouched — the workshop and resource show pages still use it (it remains admin-gated viaallowed_to?(:manage?, owner)).shared/form_image_fieldswithinclude_primary_asset: true).UI Testing Checklist
Anything else to add?
🤖 Generated with Claude Code