Skip to content

Commit

Permalink
Merge pull request #258 from fnf-org/mfl/fix-finalize-guests
Browse files Browse the repository at this point in the history
finalize guest list issues
  • Loading branch information
beingmattlevy authored Aug 8, 2024
2 parents 6077f0d + 18ac59e commit 54b0b77
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 25 deletions.
4 changes: 0 additions & 4 deletions app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ def create
TimeHelper.normalize_time_attributes(create_params)

@event = Event.new(create_params)
# if create_params[:event_addons_attributes].present?
# @event.build_event_addons_from_params(create_params[:event_addons_attributes])
# end

Rails.logger.info("event_create: created event: #{@event.id} event_addons: #{@event.event_addons.inspect}")

if @event.save
Expand Down
2 changes: 0 additions & 2 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class Event < ApplicationRecord

MAX_NAME_LENGTH = 100

GUEST_LIST_FINAL_WITHIN = 2.days

attr_accessible :name, :start_time, :end_time, :adult_ticket_price,
:kid_ticket_price, :max_adult_tickets_per_request, :max_kid_tickets_per_request,
:photo, :photo_cache, :tickets_require_approval, :require_mailing_address,
Expand Down
31 changes: 12 additions & 19 deletions app/views/ticket_requests/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,18 @@
.row
.col-lg-6.col-xl-6.col-md-12.col-sm-12
- list_finalized = (@event.start_time - Time.current) < ::Event::GUEST_LIST_FINAL_WITHIN
- if list_finalized
%span.text-error
Guest list has already been finalized. If you need to update your guests, please email
= mail_to '[email protected]'
%br
- else
%h4 Adult Guests
%h5 Examples:
%ul
%li DJ Carl Cox (as himself) &lt;[email protected]&gt;
%li John Digweed &lt;[email protected]&gt;
- total_guests = @ticket_request.guest_count
- adult_guests = @ticket_request.adults
- adult_guests.times do |guest_id|
- default_value = guest_id == 0 ? @ticket_request.user.name_and_email : ''
= f.label "Guest #{guest_id + 1}"
= f.text_field :guest_list, readonly: list_finalized, multiple: true, value: Array(@ticket_request.guests[0...adult_guests])[guest_id] || default_value, style: 'width: 80%'
%h4 Adult Guests
%h5 Examples:
%ul
%li DJ Carl Cox (as himself) &lt;[email protected]&gt;
%li John Digweed &lt;[email protected]&gt;
- total_guests = @ticket_request.guest_count
- adult_guests = @ticket_request.adults
- adult_guests.times do |guest_id|
- default_value = guest_id == 0 ? @ticket_request.user.name_and_email : ''
= f.label "Guest #{guest_id + 1}"
= f.text_field :guest_list, readonly: list_finalized, multiple: true, value: Array(@ticket_request.guests[0...adult_guests])[guest_id] || default_value, style: 'width: 80%'

- if @ticket_request.kids.positive?
.col-lg-6.col-xl-6.col-md-12.col-sm-12
Expand Down

0 comments on commit 54b0b77

Please sign in to comment.