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
|
|
@ -12,10 +12,6 @@
|
|||
= u.input :nickname, as: :string
|
||||
= u.input :affiliation, placeholder: 'Company/User Group/nothing', as: :string
|
||||
= f.inputs 'Registration Information' do
|
||||
- if @conference.use_supporter_levels? and @conference.supporter_levels.length > 0
|
||||
= f.semantic_fields_for :supporter_registration do |reg|
|
||||
= reg.input :supporter_level, as: :select, collection: @conference.supporter_levels
|
||||
%span#supporter-link.help-block
|
||||
- @conference.questions.each do |q|
|
||||
%h5
|
||||
= "Q: #{q.title}"
|
||||
|
|
@ -33,10 +29,3 @@
|
|||
%br
|
||||
= f.input :social_events, as: :check_boxes, label: false, collection: @conference.social_events
|
||||
= f.action :submit, button_html: { value: 'Edit Registration', class: 'btn btn-primary' }
|
||||
:javascript
|
||||
$("#registration_supporter_registration_attributes_supporter_level_id").change(function () {
|
||||
var str = "";
|
||||
#{generate_supporter_level_js @conference}
|
||||
$("#supporter-link").html(str);
|
||||
})
|
||||
.trigger('change');
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
%th #
|
||||
%th Name
|
||||
%th E-Mail
|
||||
%th Ticket
|
||||
%th Arrival
|
||||
%th Departure
|
||||
%th Attended
|
||||
|
|
@ -32,9 +31,6 @@
|
|||
= registration.name
|
||||
%td
|
||||
= registration.email
|
||||
%td
|
||||
- if registration.supporter_level
|
||||
= registration.supporter_level.title
|
||||
%td
|
||||
- if registration.arrival
|
||||
= registration.arrival.strftime("%d %b %H:%M")
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
<div class="nested-fields">
|
||||
<%= f.inputs do %>
|
||||
<%= f.input :title%>
|
||||
<%= f.input :url %>
|
||||
<%= f.input :description, hint: markdown_hint, input_html: { data: { provide: "markdown-editable" } } %>
|
||||
<%= f.input :ticket_price, hint: 'Please enter price with currency symbol.
|
||||
For example, $200,₹300' %>
|
||||
<%= remove_association_link :supporter_level, f %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
.row
|
||||
.col-md-8
|
||||
= semantic_form_for(@conference, :url => admin_conference_supporter_level_path(@conference.short_title, @conference.supporter_levels)) do |f|
|
||||
= f.input :use_supporter_levels, :label => false
|
||||
= f.input :include_tickets_in_splash, hint: 'On setting this true you will enable the tickets to be displayed on the splash page'
|
||||
= dynamic_association :supporter_levels, "Supporter Levels", f
|
||||
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
|
||||
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