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:
1
db/schema.rb
generated
1
db/schema.rb
generated
@@ -56,6 +56,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_09_29_222616) do
|
||||
t.boolean "allow_booking_during_event", default: false, null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "image_url"
|
||||
t.index ["featured"], name: "index_events_on_featured"
|
||||
t.index ["latitude", "longitude"], name: "index_events_on_latitude_and_longitude"
|
||||
t.index ["state"], name: "index_events_on_state"
|
||||
|
||||
14
db/seeds.rb
14
db/seeds.rb
@@ -44,7 +44,7 @@ events_data = [
|
||||
start_time: 1.day.from_now,
|
||||
end_time: 1.day.from_now + 6.hours,
|
||||
featured: true,
|
||||
image: "https://fastly.picsum.photos/id/407/300/200.jpg?hmac=9EhoXMZ1QdwJue90vzxcjBg2YzsZsAWCjJ7oxOhtcU0",
|
||||
image_url: "https://fastly.picsum.photos/id/407/300/200.jpg?hmac=9EhoXMZ1QdwJue90vzxcjBg2YzsZsAWCjJ7oxOhtcU0",
|
||||
user: users.first
|
||||
},
|
||||
{
|
||||
@@ -58,7 +58,7 @@ events_data = [
|
||||
start_time: 3.days.from_now,
|
||||
end_time: 3.days.from_now + 4.hours,
|
||||
featured: true,
|
||||
image: "https://images.unsplash.com/photo-1511671782779-c97d3d27a1d4?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80",
|
||||
image_url: "https://images.unsplash.com/photo-1511671782779-c97d3d27a1d4?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80",
|
||||
user: users.second
|
||||
},
|
||||
{
|
||||
@@ -72,7 +72,7 @@ events_data = [
|
||||
start_time: 1.week.from_now,
|
||||
end_time: 1.week.from_now + 8.hours,
|
||||
featured: false,
|
||||
image: "https://images.unsplash.com/photo-1470225620780-dba8ba36b745?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80",
|
||||
image_url: "https://images.unsplash.com/photo-1470225620780-dba8ba36b745?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80",
|
||||
user: users.third
|
||||
}
|
||||
]
|
||||
@@ -147,7 +147,7 @@ belle_epoque_event = Event.find_or_create_by!(name: "LA BELLE ÉPOQUE PAR SISLEY
|
||||
e.start_time = 3.days.from_now
|
||||
e.end_time = 3.days.from_now + 8.hours
|
||||
e.featured = false
|
||||
e.image = "https://data.bizouk.com/cache1/events/images/10/78/87/b801a9a43266b4cc54bdda73bf34eec8_700_800_auto_97.jpg"
|
||||
e.image_url = "https://data.bizouk.com/cache1/events/images/10/78/87/b801a9a43266b4cc54bdda73bf34eec8_700_800_auto_97.jpg"
|
||||
e.user = promoter
|
||||
e.allow_booking_during_event = true
|
||||
end
|
||||
@@ -201,7 +201,7 @@ konpa_event = Event.find_or_create_by!(name: "Konpa With Bev - Cours De Konpa Go
|
||||
e.start_time = Time.parse("2025-10-03 19:00:00")
|
||||
e.end_time = Time.parse("2025-10-03 23:00:00")
|
||||
e.featured = false
|
||||
e.image = "https://data.bizouk.com/cache1/events/images/10/79/61/081f38b583ac651f3a0930c5d8f13458_800_600_auto_97.png"
|
||||
e.image_url = "https://data.bizouk.com/cache1/events/images/10/79/61/081f38b583ac651f3a0930c5d8f13458_800_600_auto_97.png"
|
||||
e.user = promoter
|
||||
e.state = :published
|
||||
end
|
||||
@@ -216,7 +216,7 @@ caribbean_groove_event = Event.find_or_create_by!(name: "La Plus Grosse Soirée
|
||||
e.start_time = Time.parse("2025-10-03 23:00:00")
|
||||
e.end_time = Time.parse("2025-10-04 05:00:00")
|
||||
e.featured = false
|
||||
e.image = "https://data.bizouk.com/cache1/events/images/10/83/15/fa5d43f0b1998f691181cfda8fe35213_800_600_auto_97.png"
|
||||
e.image_url = "https://data.bizouk.com/cache1/events/images/10/83/15/fa5d43f0b1998f691181cfda8fe35213_800_600_auto_97.png"
|
||||
e.user = promoter
|
||||
e.state = :published
|
||||
end
|
||||
@@ -231,7 +231,7 @@ belle_epoque_october_event = Event.find_or_create_by!(name: "LA BELLE ÉPOQUE PA
|
||||
e.start_time = Time.parse("2025-10-04 18:00:00")
|
||||
e.end_time = Time.parse("2025-10-05 02:00:00")
|
||||
e.featured = false
|
||||
e.image = "https://data.bizouk.com/cache1/events/images/10/92/72/351e61b55603a4d142b43486216457c1_800_600_auto_97.jpg"
|
||||
e.image_url = "https://data.bizouk.com/cache1/events/images/10/92/72/351e61b55603a4d142b43486216457c1_800_600_auto_97.jpg"
|
||||
e.user = promoter
|
||||
e.state = :published
|
||||
e.allow_booking_during_event = true
|
||||
|
||||
Reference in New Issue
Block a user