Refactoring Tickets
- Tickets now independent from registration - Implemented money gem #419
This commit is contained in:
parent
5485fe0e7f
commit
5f8a8ac6d9
63 changed files with 1581 additions and 573 deletions
5
app/views/admin/tickets/_form.html.haml
Normal file
5
app/views/admin/tickets/_form.html.haml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
= f.input :title
|
||||
= f.input :description, input_html: { rows: 5, data: { provide: "markdown-editable" } }
|
||||
= f.input :price
|
||||
= f.input :price_currency, as: :select, class: 'form-control', collection: ['USD', 'EUR', 'GBP', 'INR', 'CNY'], include_blank: false
|
||||
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
|
||||
6
app/views/admin/tickets/edit.html.haml
Normal file
6
app/views/admin/tickets/edit.html.haml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
%h1
|
||||
Edit Ticket
|
||||
.row
|
||||
.col-md-8
|
||||
= semantic_form_for(@ticket, :url => admin_conference_ticket_path(@conference.short_title, @ticket)) do |f|
|
||||
= render partial: 'form', locals: { f: f }
|
||||
38
app/views/admin/tickets/index.html.haml
Normal file
38
app/views/admin/tickets/index.html.haml
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
%h1 Tickets
|
||||
%p.lead
|
||||
If you add Tickets to your Conference, people will be redirected after registration to a page where they can purchase tickets.
|
||||
- if @conference.tickets.any?
|
||||
.row
|
||||
.col-md-12
|
||||
%table.table
|
||||
%thead
|
||||
%th #
|
||||
%th Title
|
||||
%th Price
|
||||
%th Buyer
|
||||
%th Show
|
||||
%th Edit
|
||||
%th Delete
|
||||
%tbody
|
||||
- @conference.tickets.each_with_index do |ticket, index|
|
||||
%tr
|
||||
%td
|
||||
= index + 1
|
||||
%td
|
||||
= ticket.title
|
||||
%td
|
||||
= humanized_money_with_symbol ticket.price
|
||||
%td
|
||||
= ticket.buyers.count
|
||||
%td
|
||||
= link_to 'Show', admin_conference_ticket_path(@conference.short_title, ticket.id),
|
||||
method: :get, class: 'btn btn-success'
|
||||
%td
|
||||
= link_to 'Edit', edit_admin_conference_ticket_path(@conference.short_title, ticket.id),
|
||||
method: :get, class: 'btn btn-primary'
|
||||
%td
|
||||
= link_to 'Delete', admin_conference_ticket_path(@conference.short_title, ticket.id),
|
||||
method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete the Ticket for #{ticket.title}?" }
|
||||
|
||||
= link_to 'Add Ticket', new_admin_conference_ticket_path, class: 'btn btn-success'
|
||||
|
||||
6
app/views/admin/tickets/new.html.haml
Normal file
6
app/views/admin/tickets/new.html.haml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
%h1
|
||||
New Ticket
|
||||
.row
|
||||
.col-md-8
|
||||
= semantic_form_for(@ticket, :url => admin_conference_tickets_path(@conference.short_title, @ticket)) do |f|
|
||||
= render partial: 'form', locals: { f: f }
|
||||
33
app/views/admin/tickets/show.html.haml
Normal file
33
app/views/admin/tickets/show.html.haml
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
%h1
|
||||
= @ticket.title
|
||||
%small
|
||||
= humanized_money_with_symbol @ticket.price
|
||||
- if @ticket.description.present?
|
||||
%p.lead
|
||||
= markdown(@ticket.description)
|
||||
|
||||
%h4 The following persons bought this ticket:
|
||||
%table.table#buyers-datatable
|
||||
%thead
|
||||
%th #
|
||||
%th Name
|
||||
%th E-Mail
|
||||
%th Affiliation
|
||||
%th Paid
|
||||
%tbody
|
||||
- @ticket.buyers.each_with_index do |buyer, index|
|
||||
%tr
|
||||
%td
|
||||
= index + 1
|
||||
%td
|
||||
= buyer.name
|
||||
%span.label.label-success
|
||||
= buyer.ticket_purchases.find_by(ticket_id: @ticket.id).quantity
|
||||
%td
|
||||
= buyer.email
|
||||
%td
|
||||
= buyer.affiliation
|
||||
%td
|
||||
= @ticket.paid?(buyer)
|
||||
= link_to 'Edit', edit_admin_conference_ticket_path(@conference.short_title, @ticket.id),
|
||||
method: :get, class: 'btn btn-primary'
|
||||
Loading…
Add table
Add a link
Reference in a new issue