Merge pull request #560 from hennevogel/feature-user-view
Various small UI fixes
This commit is contained in:
commit
b65a33f047
64 changed files with 932 additions and 2243 deletions
|
|
@ -11,6 +11,18 @@ class ConferenceController < ApplicationController
|
|||
@keynote_speakers = @conference.keynote_speakers
|
||||
end
|
||||
|
||||
def schedule
|
||||
@rooms = @conference.rooms
|
||||
@events = @conference.events
|
||||
@dates = @conference.start_date..@conference.end_date
|
||||
|
||||
if @dates == Date.current
|
||||
@today = Date.current.strftime('%Y-%m-%d')
|
||||
else
|
||||
@today = @conference.start_date.strftime('%Y-%m-%d')
|
||||
end
|
||||
end
|
||||
|
||||
def gallery_photos
|
||||
@photos = @conference.photos
|
||||
render 'photos', formats: [:js]
|
||||
|
|
|
|||
|
|
@ -9,24 +9,22 @@ class ConferenceRegistrationsController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
@workshops = @registration.workshops if @registration
|
||||
@workshops = @registration.workshops
|
||||
@total_price = Ticket.total_price(@conference, current_user)
|
||||
@tickets = current_user.ticket_purchases.where(conference_id: @conference.id)
|
||||
end
|
||||
|
||||
def edit; end
|
||||
|
||||
def create
|
||||
user_attributes = registration_params[:user_attributes]
|
||||
params[:registration].delete :user_attributes
|
||||
|
||||
@registration = current_user.registrations.build(registration_params)
|
||||
@registration.conference_id = @conference.id
|
||||
|
||||
if @registration.save && current_user.update_attributes(user_attributes)
|
||||
if @registration.save
|
||||
# Trigger ahoy event
|
||||
ahoy.track 'Registered', title: 'New registration'
|
||||
|
||||
if @conference.tickets.any?
|
||||
if @conference.tickets.any? && !current_user.supports?(@conference)
|
||||
redirect_to conference_tickets_path(@conference.short_title),
|
||||
notice: 'You are now registered and will be receiving E-Mail notifications.'
|
||||
else
|
||||
|
|
@ -66,6 +64,9 @@ class ConferenceRegistrationsController < ApplicationController
|
|||
|
||||
def set_registration
|
||||
@registration = current_user.registrations.find_by(conference_id: @conference.id)
|
||||
if !@registration
|
||||
redirect_to new_conference_conference_registrations_path(@conference.short_title)
|
||||
end
|
||||
end
|
||||
|
||||
def registration_params
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
class ScheduleController < ApplicationController
|
||||
authorize_resource class: false
|
||||
layout 'application'
|
||||
|
||||
def index
|
||||
@conference = Conference.
|
||||
includes(:rooms, events: [:speakers, :track, :event_type]).
|
||||
where(conferences: { short_title: params[:conference_id] }).first
|
||||
@rooms = @conference.rooms
|
||||
@events = @conference.events
|
||||
@dates = @conference.start_date..@conference.end_date
|
||||
|
||||
if @dates == Date.current
|
||||
@today = Date.current.strftime('%Y-%m-%d')
|
||||
else
|
||||
@today = @conference.start_date.strftime('%Y-%m-%d')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -6,9 +6,12 @@ class TicketPurchasesController < ApplicationController
|
|||
def create
|
||||
message = TicketPurchase.purchase(@conference, current_user, params[:tickets][0])
|
||||
if message.blank?
|
||||
redirect_to conference_conference_registrations_path(@conference.short_title),
|
||||
notice: 'Congratulations, you have successfully purchased a ticket! ' \
|
||||
"You can pay for it in cash when you arrive! Thank you for supporting #{@conference.title}!"
|
||||
if current_user.ticket_purchases.any?
|
||||
redirect_to conference_conference_registrations_path(@conference.short_title),
|
||||
notice: "Thank you for supporting #{@conference.title} by purchasing a ticket."
|
||||
else
|
||||
redirect_to conference_conference_registrations_path(@conference.short_title)
|
||||
end
|
||||
else
|
||||
redirect_to conference_conference_registrations_path(@conference.short_title),
|
||||
alert: "Oops, something went wrong with your purchase! #{message}"
|
||||
|
|
@ -16,7 +19,7 @@ class TicketPurchasesController < ApplicationController
|
|||
end
|
||||
|
||||
def destroy
|
||||
@ticket_purchases = current_user.ticket_purchases.find_by(ticket_id: params[:id])
|
||||
@ticket_purchases = current_user.ticket_purchases.find(params[:id])
|
||||
if @ticket_purchases.destroy
|
||||
redirect_to conference_conference_registrations_path(@conference.short_title),
|
||||
notice: 'Ticket successfully deleted.'
|
||||
|
|
|
|||
|
|
@ -1,8 +1,15 @@
|
|||
class TicketsController < ApplicationController
|
||||
before_filter :authenticate_user!
|
||||
load_resource :conference, find_by: :short_title
|
||||
load_resource :tickets, class: Ticket
|
||||
load_resource :ticket, through: :conference
|
||||
authorize_resource :conference_registrations, class: Registration
|
||||
before_filter :check_load_resource, only: :index
|
||||
|
||||
def index; end
|
||||
|
||||
def check_load_resource
|
||||
if @tickets.empty?
|
||||
redirect_to root_path, notice: "There are no tickets available for #{@conference.title}!"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue