mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
modify ticket purchases view
This commit is contained in:
parent
92dc0edff2
commit
1894cea975
3 changed files with 9 additions and 26 deletions
|
|
@ -4,11 +4,11 @@ class TicketPurchasesController < ApplicationController
|
|||
authorize_resource :conference_registrations, class: Registration
|
||||
|
||||
def create
|
||||
TicketPurchase.by_conference(@conference).unpaid.by_user(current_user).destroy_all
|
||||
message = TicketPurchase.purchase(@conference, current_user, params[:tickets][0])
|
||||
if message.blank?
|
||||
if current_user.ticket_purchases.any?
|
||||
redirect_to conference_conference_registration_path(@conference.short_title),
|
||||
notice: "Thank you for supporting #{@conference.title} by purchasing a ticket."
|
||||
if current_user.ticket_purchases.by_conference(@conference).unpaid.any?
|
||||
redirect_to new_conference_payment_path, notice: 'Please pay here to purchase tickets.'
|
||||
else
|
||||
redirect_to conference_conference_registration_path(@conference.short_title)
|
||||
end
|
||||
|
|
@ -18,18 +18,6 @@ class TicketPurchasesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@ticket_purchases = current_user.ticket_purchases.find(params[:id])
|
||||
if @ticket_purchases.destroy
|
||||
redirect_to conference_conference_registration_path(@conference.short_title),
|
||||
notice: 'Ticket successfully deleted.'
|
||||
else
|
||||
redirect_to conference_conference_registration_path(@conference.short_title),
|
||||
error: 'An error prohibited deleting your purchase! '\
|
||||
"#{@ticket_purchases.errors.full_messages.join('. ')}."
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def ticket_purchase_params
|
||||
|
|
|
|||
|
|
@ -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}"}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue