Enable registration to proceed without requiring a ticket.

Requiring a ticket after registration is convoluted; while it may be neccesary
for some workflows, it definitely isn't for others, and the core of osem
doesn't need it... so let's make it optional.
This commit is contained in:
James Mason 2018-12-29 00:08:32 -08:00 committed by Henne Vogelsang
parent 228190396c
commit 072116fffe
12 changed files with 168 additions and 128 deletions

View file

@ -8,29 +8,38 @@
.row
.col-md-8
%dl.dl-horizontal
%dt
Start Date
%dd
= @registration_period.start_date
%dt
End Date
%dd
= @registration_period.end_date
%dt Start Date
%dd= @registration_period.start_date
%dt End Date
%dd= @registration_period.end_date
%dt Ticket required?
%dd= @conference.tickets.for_registration.any? ? 'Yes' : 'No'
.row
.col-md-12
%p
If you would like to require a ticket purchase for registration, at least
one
= link_to 'ticket', admin_conference_tickets_path(@conference)
must be set as a registration ticket, and the registration process
will not proceed without the purchase (or selection of a free) single
registration ticket.
%p
To make ticketing optional, do not mark any
= link_to 'tickets', admin_conference_tickets_path(@conference)
as registration tickets, and registration can proceed without them.
.row
.col-md-12.text-right
- if @registration_period
- if can? :update, @registration_period
= link_to 'Edit', edit_admin_conference_registration_period_path, class: 'btn btn-primary'
- if can? :destroy, @registration_period
= link_to 'Delete', admin_conference_registration_period_path,
method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger'
- else
- if @conference.tickets.for_registration.empty?
.h3.text-left
No Registration Tickets!
%small
= link_to 'Create registration tickets', new_admin_conference_ticket_path
before creating the registration period.
- else
- if can? :create, @conference.build_registration_period
= link_to 'New Registration Period', new_admin_conference_registration_period_path, class: 'btn btn-primary'
.btn-group{ role: 'group' }
- if @registration_period
- if can? :update, @registration_period
= link_to 'Edit', edit_admin_conference_registration_period_path,
class: 'btn btn-primary'
- if can? :destroy, @registration_period
= link_to 'Delete', admin_conference_registration_period_path,
method: :delete, data: { confirm: 'Are you sure?' },
class: 'btn btn-danger'
- elsif can? :create, @conference.build_registration_period
= link_to 'New Registration Period',
new_admin_conference_registration_period_path,
class: 'btn btn-primary'

View file

@ -97,37 +97,48 @@
- if @conference.tickets.any?
.row
.col-md-12
-if @tickets.any?
%h4
%span.fa-stack
%i.fa.fa-square-o.fa-stack-2x
%i.fa.fa-ticket.fa-stack-1x
Ticket Purchases
= "(#{@tickets.first.price.symbol}#{humanized_money @total_price})"
%ul
.col-md-12
- @ticket_payments.each_pair do |ticket_id, tickets|
%li
= @total_quantity[ticket_id]
= tickets.first.title
= word_pluralize(@total_quantity[ticket_id], 'Ticket')
for
= tickets.first.price.symbol
= humanized_money @total_price_per_ticket[ticket_id]
%br
%h4
%span.fa-stack
%i.fa.fa-square-o.fa-stack-2x
%i.fa.fa-ticket.fa-stack-1x
Tickets
- if @tickets.any?
.btn-group
= link_to 'View all tickets', conference_physical_tickets_path(@conference.short_title), class: "btn btn-success"
= link_to 'Get more tickets', conference_tickets_path(@conference.short_title), class: "btn btn-default"
Total Purchased:
= "(#{@tickets.first.price.symbol}#{humanized_money @total_price})"
%ul
.col-md-12
- @ticket_payments.each_pair do |ticket_id, tickets|
%li
= @total_quantity[ticket_id]
= tickets.first.title
= word_pluralize(@total_quantity[ticket_id], 'Ticket')
for
= tickets.first.price.symbol
= humanized_money @total_price_per_ticket[ticket_id]
%br
.btn-group{ role: 'group' }
= link_to 'View all tickets',
conference_physical_tickets_path(@conference.short_title),
class: 'btn btn-success'
= link_to 'Get more tickets',
conference_tickets_path(@conference.short_title),
class: 'btn btn-default'
- else
You haven't bought any tickets.
= link_to 'Please get some tickets to support us!', conference_tickets_path(@conference.short_title)
%p
(Your participation won't be valid without getting a registration ticket)
You haven't bought any tickets.
= link_to 'Please get some tickets to support us!', conference_tickets_path(@conference.short_title)
- if @conference.tickets.for_registration.any?
%p
%em
Your participation won't be valid without getting a
registration ticket.
= link_to 'Get tickets',
conference_tickets_path(@conference.short_title),
class: 'btn btn-default'
.row
.col-md-12
-if @registration
- if @registration
.btn-group-vertical.pull-right
= link_to 'Edit your Registration', edit_conference_conference_registration_path(@conference.short_title), class: 'btn btn-success', disabled: @conference.end_date < Date.today
- if @tickets.any?

View file

@ -2,18 +2,26 @@
%td.col-sm-8.col-md-4
.media
.media-body
%h4.media-heading
= ticket.title
%h5.media-heading
- unless ticket.description.blank?
= markdown(ticket.description)
%td.col-sm-1.col-md-2.text-center
= ticket.registration_ticket? ? 'Yes' : 'No'
%h4.media-heading= ticket.title
%h5.media-heading= markdown(ticket.description)
- if @conference.tickets.for_registration.any?
%td.col-sm-1.col-md-2.text-center
= ticket.registration_ticket? ? 'Yes' : 'No'
%td.col-sm-1.col-md-1
- options = { type: 'number', min: 0, max: 99, class: "form-control quantity", 'data-id' => ticket.id }
- if ticket.registration_ticket?
- options[:max] = 1
- options[:disabled] = current_user.tickets.for_registration(ticket.conference).present?
:ruby
options = {
type: 'number',
min: 0,
max: 99,
class: 'form-control quantity',
'data-id' => ticket.id
}
if ticket.registration_ticket?
options[:max] = 1
options[:disabled] = current_user.tickets.for_registration(
ticket.conference
).present?
end
= text_field_tag("tickets[][#{ticket.id}]", 0, options)
%td.col-sm-1.col-md-1.text-center
= ticket.price.symbol

View file

@ -5,25 +5,26 @@
%h1
Tickets
%p.lead
Please choose your tickets for
Please choose your tickets for
%strong
= @conference.title
here*
=form_tag(conference_ticket_purchases_path, method: :post) do |f|
= form_tag(conference_ticket_purchases_path, method: :post) do |f|
%table.table.table-hover
%thead
%tr
%th Ticket
%th Registration Ticket
- if @conference.tickets.for_registration.any?
%th Registration Ticket
%th Quantity
%th Price
%th Total
%tbody
- @conference.tickets.each do |ticket|
= render partial: 'ticket', f: f, locals: {ticket: ticket}
= render 'ticket', f: f, ticket: ticket
%tr
%td
%td
- if @conference.tickets.for_registration.any?
%td
%td
%td.col-sm-1.col-md-1.text-center
%h4
@ -32,20 +33,20 @@
%h4
%strong
= @conference.tickets.first.price.symbol
%span{id: 'total_price'}
%span{ id: 'total_price' }
0
.pull-right
.btn-group-vertical
= button_tag(type: 'submit', class: 'btn btn-success btn-lg') do
Continue
%i.fa.fa-shopping-cart
- if current_user.ticket_purchases.by_conference(@conference).any?
= link_to 'Back to registration', conference_conference_registration_path(@conference.short_title), class: 'btn btn-default btn-sm'
- else
= link_to 'Cancel registration', conference_conference_registration_path(@conference.short_title), method: :delete, class: 'btn btn-danger btn-sm',
data: { confirm: 'Are you sure you want to unregister?' }
.row
.col-md-13
%p.text-muted.text-center
%small
* Getting a registration ticket is mandatory. Your participation will not be valid until you get a registration ticket.
= link_to 'Back to registration',
conference_conference_registration_path(@conference.short_title),
class: 'btn btn-default btn-sm'
- if @conference.tickets.for_registration.any?
.row
.col-md-13
%p.text-muted.text-center
%small
Getting a registration ticket is mandatory. Your participation
will not be valid until you get a registration ticket.