Skip to content

feat: Content Asset Media Library — shared image management for admin#108

Open
aaronsmulktis wants to merge 5 commits into
@aaron.smulktis/developfrom
feat/content-asset-media-library-upstream
Open

feat: Content Asset Media Library — shared image management for admin#108
aaronsmulktis wants to merge 5 commits into
@aaron.smulktis/developfrom
feat/content-asset-media-library-upstream

Conversation

@aaronsmulktis
Copy link
Copy Markdown
Member

Summary

Adds a shared media library so content images (homepage sections, CMS pages) can be uploaded, browsed, and selected from within the admin UI — eliminating dependency on external CDN URLs and missing local image paths.

  • ContentAsset modelSpree::Base with ActiveStorage (S3), 7 responsive variants, file type/size validations, tag filtering, search
  • Admin CRUD — Grid index view with thumbnails, upload, edit metadata (alt text, tag), delete, pagination
  • Picker modal — Reusable partial with JS grid, search, tag filter, and inline upload. Writes selected image's proxy URL into any target form field
  • REST API — Full CRUD at /api/v1/content_assets with public read, admin-only writes, standard response envelope
  • Sidebar nav — "Content Assets" tab in admin menu
  • Homepage section integration — Picker buttons on the edit form for common image settings keys
  • Migration rake taskcontent_assets:migrate_existing downloads images from external URLs, creates ContentAsset records, updates JSON settings/body

Key design decisions

Decision Choice Rationale
Storage ActiveStorage (not Paperclip) Paperclip is deprecated; ActiveStorage already configured for S3
Serving Proxy mode (rails_storage_proxy_path) Stable cacheable URLs, no expiring S3 signatures
Integration Picker writes URLs into existing JSON fields Zero schema changes to HomepageSection or Spree::Page
Base class Spree::Base Consistent with all custom models (HomepageSection, Contact, etc.)

Test plan

  • 29 tests, 62 assertions, 0 failures
  • Upload image via admin → verify thumbnail in grid
  • Edit alt text and tag → verify changes persist
  • Open homepage section edit → click "Choose Image" → modal shows uploaded images
  • Select image in picker → URL populates target field
  • Inline upload from picker modal → new image appears in grid
  • API: GET /api/v1/content_assets returns JSON with proxy URLs
  • API: GET /api/v1/content_assets/:id returns all variant URLs
  • Run rake content_assets:migrate_existing to import existing image URLs

Files changed (25 files, +1,136 lines)

Area Files
Model app/models/content_asset.rb, migration, factory
Admin Controller, 4 views (index, new, edit, _form), sidebar
API Controller with CRUD + auth
Picker _picker_modal.html.erb, content_assets.js, content_assets.css
Config Routes, i18n, ActiveStorage proxy, dev/test URL options, docker volumes
Migration lib/tasks/content_assets_migrate.rake
Tests Model (12), API (11), Admin (6)

🤖 Generated with Claude Code
via Happy

aaronsmulktis and others added 5 commits January 10, 2026 20:10
Docker, Homepage, Favs, Public Users w/Follows, Fix Cart, Editor, CORs, Streams, Swagger
Bumps [lodash-es](https://github.com/lodash/lodash) from 4.17.11 to 4.17.23.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.11...4.17.23)

---
updated-dependencies:
- dependency-name: lodash-es
  dependency-version: 4.17.23
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Fix Homepage Section Order, Tweak Nav, Remove Dead Files
…swagger-ui/lodash-es-4.17.23

Bump lodash-es from 4.17.11 to 4.17.23 in /public/swagger-ui
Adds a shared media library so content images (homepage sections, CMS pages)
can be uploaded, browsed, and selected from within the admin UI.

- ContentAsset model (Spree::Base + ActiveStorage/S3, 7 responsive variants)
- Admin CRUD with grid index, upload, edit, delete
- Reusable picker modal (JS grid, search, tag filter, inline upload)
- REST API at /api/v1/content_assets (public read, admin writes)
- Sidebar navigation tab
- Homepage section form integration with picker buttons
- Migration rake task (content_assets:migrate_existing)

29 tests, 62 assertions, 0 failures.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
@aaronsmulktis aaronsmulktis changed the base branch from master to @aaron.smulktis/develop April 23, 2026 01:30
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