- Enhanced events index page with improved visual design and better information display - Completely redesigned event show page with modern layout, ticket selection, and checkout functionality - Implemented Stripe payment processing for ticket purchases - Created ticket generation system with PDF tickets and QR codes - Added email confirmation system with ticket attachments - Updated database configuration to use SQLite for easier development setup - Fixed gem dependencies and resolved conflicts - Improved error handling throughout the checkout process - Enhanced Stimulus controller for ticket cart management - Added proper redirect handling for successful and cancelled payments
44 lines
1.8 KiB
Ruby
Executable File
44 lines
1.8 KiB
Ruby
Executable File
# Controller for static pages and user dashboard
|
|
# Handles basic page rendering and user-specific content
|
|
class PagesController < ApplicationController
|
|
# Skip authentication for public pages
|
|
# skip_before_action :authenticate_user!, only: [ :home ]
|
|
before_action :authenticate_user!, only: [ :dashboard ]
|
|
|
|
# Homepage showing featured events
|
|
def home
|
|
# @events = Event.published.featured.limit(3)
|
|
# @events = Event.where(state: :published).order(created_at: :desc)
|
|
|
|
if user_signed_in?
|
|
return redirect_to(dashboard_path)
|
|
end
|
|
end
|
|
|
|
# User dashboard showing personalized content
|
|
# Accessible only to authenticated users
|
|
def dashboard
|
|
# Metrics for dashboard cards
|
|
@booked_events = current_user.tickets.joins(:ticket_type, :event).where(events: { state: :published }).count
|
|
@events_today = Event.published.where("DATE(start_time) = ?", Date.current).count
|
|
@events_tomorrow = Event.published.where("DATE(start_time) = ?", Date.current + 1).count
|
|
@upcoming_events = Event.published.upcoming.count
|
|
|
|
# User's booked events
|
|
@user_booked_events = Event.joins(ticket_types: :tickets)
|
|
.where(tickets: { user: current_user, status: 'active' })
|
|
.distinct
|
|
.limit(5)
|
|
|
|
# Events sections
|
|
@today_events = Event.published.where("DATE(start_time) = ?", Date.current).order(start_time: :asc)
|
|
@tomorrow_events = Event.published.where("DATE(start_time) = ?", Date.current + 1).order(start_time: :asc)
|
|
@other_events = Event.published.upcoming.where.not("DATE(start_time) IN (?)", [Date.current, Date.current + 1]).order(start_time: :asc).page(params[:page])
|
|
end
|
|
|
|
# Events page showing all published events with pagination
|
|
def events
|
|
@events = Event.published.order(created_at: :desc).page(params[:page])
|
|
end
|
|
end
|