This commit is contained in:
Rishabh Saxena 2016-08-10 06:18:19 +00:00 committed by GitHub
commit 211410b6f0
33 changed files with 621 additions and 91 deletions

View file

@ -89,29 +89,27 @@
%span.fa-stack
%i.fa.fa-square-o.fa-stack-2x
%i.fa.fa-ticket.fa-stack-1x
Tickets
Ticket Purchases
-if @tickets.any?
= "(#{@total_price} #{@tickets.first.price.symbol})"
= "(#{@tickets.first.price.symbol}#{humanized_money @total_price})"
%ul
- @tickets.each do |ticket|
%li
= ticket.quantity
= ticket.title
= word_pluralize(ticket.quantity, 'Ticket')
for
= humanized_money ticket.price
= ticket.price.symbol
= link_to conference_ticket_purchase_path(@conference.short_title, ticket.id), method: :delete,
id: "ticket-#{ticket.id}-delete",
class: 'btn btn-danger btn-xs',
data: { confirm: "Do you really want to delete the #{ticket.title} ticket for #{@conference.title}?" } do
%i.fa.fa-trash-o
%li
- if @tickets.any?
= link_to 'Buy more tickets', conference_tickets_path(@conference.short_title)
- else
You haven't bought any tickets.
= link_to 'Please buy some tickets to support us!', conference_tickets_path(@conference.short_title)
.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 tickets.first.price
%br
- if @tickets.any?
= link_to 'Buy more tickets', conference_tickets_path(@conference.short_title), class: "btn btn-default"
- else
You haven't bought any tickets.
= link_to 'Please buy some tickets to support us!', conference_tickets_path(@conference.short_title)
%p
(Your registration won't be complete without buying a ticket)
.row
.col-md-12

View file

@ -0,0 +1,25 @@
= semantic_form_for(@payment, url: conference_payments_path) do |f|
.form-group
= f.label :full_name, 'Full name (as on card)'
= f.text_field :full_name, class: "form-control", placeholder: "John Doe", id: "full_name"
%span.pull-right
%img.img-responsive{:src => image_url('credit_card.png')}
.form-group
= f.label :credit_card_number, "Credit Card number (without spaces)"
.input-group
= f.text_field :credit_card_number, class: "form-control", placeholder: "XXXX XXXX XXXX XXXX", id: "credit_card_number"
%span.input-group-addon
%i.fa.fa-credit-card
.form-group.col-md-6
= f.label :expiration_month
= f.select :expiration_month, months, {}, class: "form-control", id: "expiration_month"
.form-group.col-md-6
= f.label :expiration_year
= f.select :expiration_year, years, {}, class: "form-control", id: "expiration_year"
.form-group.col-md-10
= f.label :card_verification_value, 'Security Code (3 on back, AmEx: 4 on front)'
= f.text_field :card_verification_value, class: "form-control", placeholder: "XXX", id: "card_verification_value"
= f.number_field :amount, value: @total_amount_to_pay, class: "form-control", type: 'hidden'
.form-group.text-center
= f.submit "Pay #{number_to_currency @total_amount_to_pay, unit: @total_amount_to_pay.symbol}", class: "btn btn-primary", id: "Charge Card"
= link_to "Cancel", conference_conference_registration_path, class: "btn btn-danger"

View file

@ -0,0 +1,14 @@
.container
.row
.col-xs-6.col-xs-offset-3
%h1
Buy tickets for
= @total_amount_to_pay.symbol
= humanized_money @total_amount_to_pay
- if @payment.errors.any?
.alert.alert-danger
%ul
- @payment.errors.full_messages.each do |msg|
%li= msg
.col-xs-6.col-xs-offset-3.well
= render partial: 'payment'

View file

@ -8,12 +8,8 @@
- unless ticket.description.blank?
= markdown(ticket.description)
%td.col-sm-1.col-md-1
- if ticket.bought?(current_user)
= text_field_tag("tickets[][#{ticket.id}]", ticket.quantity_bought_by(current_user),
= text_field_tag("tickets[][#{ticket.id}]", 0,
type: 'number', min: 0, class: "form-control quantity", 'data-id' => ticket.id)
- else
= text_field_tag("tickets[][#{ticket.id}]", 0, type: 'number', min: 0,
class: "form-control quantity", 'data-id' => ticket.id)
%td.col-sm-1.col-md-1.text-center
= ticket.price.symbol
%span{id: "price_#{ticket.id}"}

View file

@ -5,10 +5,10 @@
%h1
Tickets
%p.lead
If you like, support
Please choose your tickets for
%strong
= @conference.title
by buying a ticket*
here*
=form_tag(conference_ticket_purchases_path, method: :post) do |f|
%table.table.table-hover
%thead
@ -35,12 +35,11 @@
.pull-right
.btn-group-vertical
= button_tag(type: 'submit', class: 'btn btn-success btn-lg') do
Support
Continue
%i.fa.fa-shopping-cart
= link_to 'Continue without a Ticket!', conference_conference_registration_path(@conference.short_title),
class: 'btn btn-danger btn-sm'
= link_to 'Cancel registration', conference_conference_registration_path(@conference.short_title), method: :delete, class: 'btn btn-danger btn-sm'
.row
.col-md-13
%p.text-muted.text-center
%small
* Buying a ticket is not mandatory. Checkout will be at the conference registration.
* Buying a ticket is mandatory. Your registration will not complete until you buy a ticket.