Skip to content

Hide "Change photo" control on published story view#1549

Draft
maebeale wants to merge 1 commit into
mainfrom
maebeale/tirana-v2
Draft

Hide "Change photo" control on published story view#1549
maebeale wants to merge 1 commit into
mainfrom
maebeale/tirana-v2

Conversation

@maebeale

@maebeale maebeale commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Closes #1518

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

  • The "Change photo" control on the published story view added right-aligned chrome and vertical whitespace near the top of the page.
  • In practice, editors always change a story's primary photo from the edit view, so the inline picker on the published page was redundant.

How did you approach the change?

  • Removed the assets/primary_image_picker render and its now-orphaned upload-progress bar from app/views/stories/show.html.erb.
  • Kept the hero-image display so the photo still renders.
  • Left the shared assets/_primary_image_picker partial untouched — the workshop and resource show pages still use it (it remains admin-gated via allowed_to?(:manage?, owner)).
  • Photo editing is preserved via the story edit form (shared/form_image_fields with include_primary_asset: true).

UI Testing Checklist

  • Published story page no longer shows the "Change photo" button (admin and non-admin), and the top whitespace is reduced.
  • Story photo still displays on the published page.
  • Workshop and resource show pages still show their "Change photo" picker for admins.
  • Changing a story's primary photo from the edit view still works.

Anything else to add?

  • Added a view spec asserting the published story view does not render the "Change photo" control even for admins (red-green verified).
  • Considered restricting the control to admins instead, but it was already admin-only; hiding it entirely resolves the whitespace complaint that motivated the issue.

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings June 5, 2026 00:42
</div>

<div class="flex justify-end">
<%= render "assets/primary_image_picker", owner: @story %>

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment on lines +23 to +26
it "does not render the 'Change photo' control, even for admins" do
render
expect(rendered).not_to match(/Change photo/)
end
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.

Published story: hide 'Change photo' control (or restrict to admin) — creates white space

2 participants