feat: Complete hybrid image upload system with URL compatibility

- Add hybrid image system supporting both file uploads and URL images
- Implement Active Storage for file uploads while preserving existing URL functionality
- Update Event model with both has_one_attached :image and image_url virtual attribute
- Create tabbed interface in event forms for upload/URL selection
- Add JavaScript preview functionality for both upload and URL inputs
- Fix promotion code validation issue in tests using distinct() to prevent duplicates
- Update all views to use hybrid display methods prioritizing uploads over URLs
- Update seeds file to use image_url attribute for compatibility
- Ensure backward compatibility with existing events using URL images

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
kbe
2025-09-30 01:06:12 +02:00
parent d85996a1bb
commit ef3f05661e
12 changed files with 316 additions and 40 deletions

View File

@@ -10,9 +10,13 @@
<!-- Event main wrapper -->
<div class="bg-white rounded-2xl shadow-xl overflow-hidden">
<!-- Event Header with Image -->
<% if @event.image.attached? %>
<% if @event.has_image? %>
<div class="relative h-96">
<%= image_tag @event.event_image_variant(:large), class: "w-full h-full object-cover" %>
<% if @event.image.attached? %>
<%= image_tag @event.event_image_variant(:large), class: "w-full h-full object-cover" %>
<% else %>
<%= image_tag @event.image_url, class: "w-full h-full object-cover", alt: @event.name %>
<% end %>
<div class="absolute inset-0 bg-gradient-to-t from-black via-black/70 to-transparent"></div>
<div class="absolute bottom-0 left-0 right-0 p-6 md:p-8">
<div class="max-w-4xl mx-auto">