Various small fixes for the participant UI
This commit is contained in:
parent
b6abe96279
commit
d13efa5f52
31 changed files with 287 additions and 279 deletions
|
|
@ -49,4 +49,8 @@ body {
|
||||||
|
|
||||||
.col-top {
|
.col-top {
|
||||||
vertical-align:top;
|
vertical-align:top;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset {
|
||||||
|
margin: 20px 0 20px 0;
|
||||||
}
|
}
|
||||||
|
|
@ -9,24 +9,22 @@ class ConferenceRegistrationsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@workshops = @registration.workshops if @registration
|
@workshops = @registration.workshops
|
||||||
@total_price = Ticket.total_price(@conference, current_user)
|
@total_price = Ticket.total_price(@conference, current_user)
|
||||||
|
@tickets = current_user.ticket_purchases.where(conference_id: 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit; end
|
def edit; end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
user_attributes = registration_params[:user_attributes]
|
|
||||||
params[:registration].delete :user_attributes
|
|
||||||
|
|
||||||
@registration = current_user.registrations.build(registration_params)
|
@registration = current_user.registrations.build(registration_params)
|
||||||
@registration.conference_id = @conference.id
|
@registration.conference_id = @conference.id
|
||||||
|
|
||||||
if @registration.save && current_user.update_attributes(user_attributes)
|
if @registration.save
|
||||||
# Trigger ahoy event
|
# Trigger ahoy event
|
||||||
ahoy.track 'Registered', title: 'New registration'
|
ahoy.track 'Registered', title: 'New registration'
|
||||||
|
|
||||||
if @conference.tickets.any?
|
if @conference.tickets.any? && !current_user.supports?(@conference)
|
||||||
redirect_to conference_tickets_path(@conference.short_title),
|
redirect_to conference_tickets_path(@conference.short_title),
|
||||||
notice: 'You are now registered and will be receiving E-Mail notifications.'
|
notice: 'You are now registered and will be receiving E-Mail notifications.'
|
||||||
else
|
else
|
||||||
|
|
@ -66,6 +64,9 @@ class ConferenceRegistrationsController < ApplicationController
|
||||||
|
|
||||||
def set_registration
|
def set_registration
|
||||||
@registration = current_user.registrations.find_by(conference_id: @conference.id)
|
@registration = current_user.registrations.find_by(conference_id: @conference.id)
|
||||||
|
if !@registration
|
||||||
|
redirect_to new_conference_conference_registrations_path(@conference.short_title)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def registration_params
|
def registration_params
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,12 @@ class TicketPurchasesController < ApplicationController
|
||||||
def create
|
def create
|
||||||
message = TicketPurchase.purchase(@conference, current_user, params[:tickets][0])
|
message = TicketPurchase.purchase(@conference, current_user, params[:tickets][0])
|
||||||
if message.blank?
|
if message.blank?
|
||||||
redirect_to conference_conference_registrations_path(@conference.short_title),
|
if current_user.ticket_purchases.any?
|
||||||
notice: 'Congratulations, you have successfully purchased a ticket! ' \
|
redirect_to conference_conference_registrations_path(@conference.short_title),
|
||||||
"You can pay for it in cash when you arrive! Thank you for supporting #{@conference.title}!"
|
notice: "Thank you for supporting #{@conference.title} by purchasing a ticket."
|
||||||
|
else
|
||||||
|
redirect_to conference_conference_registrations_path(@conference.short_title)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
redirect_to conference_conference_registrations_path(@conference.short_title),
|
redirect_to conference_conference_registrations_path(@conference.short_title),
|
||||||
alert: "Oops, something went wrong with your purchase! #{message}"
|
alert: "Oops, something went wrong with your purchase! #{message}"
|
||||||
|
|
@ -16,7 +19,7 @@ class TicketPurchasesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@ticket_purchases = current_user.ticket_purchases.find_by(ticket_id: params[:id])
|
@ticket_purchases = current_user.ticket_purchases.find(params[:id])
|
||||||
if @ticket_purchases.destroy
|
if @ticket_purchases.destroy
|
||||||
redirect_to conference_conference_registrations_path(@conference.short_title),
|
redirect_to conference_conference_registrations_path(@conference.short_title),
|
||||||
notice: 'Ticket successfully deleted.'
|
notice: 'Ticket successfully deleted.'
|
||||||
|
|
|
||||||
|
|
@ -199,6 +199,17 @@ module ApplicationHelper
|
||||||
return ts
|
return ts
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# rubocop:disable Lint/EndAlignment
|
||||||
|
def word_pluralize(count, singular, plural = nil)
|
||||||
|
word = if (count == 1 || count =~ /^1(\.0+)?$/)
|
||||||
|
singular
|
||||||
|
else
|
||||||
|
plural || singular.pluralize
|
||||||
|
end
|
||||||
|
|
||||||
|
"#{word}"
|
||||||
|
end
|
||||||
|
|
||||||
def markdown(text)
|
def markdown(text)
|
||||||
options = {
|
options = {
|
||||||
autolink: true,
|
autolink: true,
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,14 @@ class Ability
|
||||||
# Abilities for everyone, even guests (not logged in users)
|
# Abilities for everyone, even guests (not logged in users)
|
||||||
def guest
|
def guest
|
||||||
# can view conferences
|
# can view conferences
|
||||||
can [:index, :show, :schedule], Conference
|
can [:index], Conference
|
||||||
|
can [:show], Conference do |conference|
|
||||||
|
conference.splashpage && conference.splashpage.public == true
|
||||||
|
end
|
||||||
|
can [:schedule], Conference do |conference|
|
||||||
|
conference.call_for_paper && conference.call_for_paper.schedule_public
|
||||||
|
end
|
||||||
|
|
||||||
# can view confirmed Events
|
# can view confirmed Events
|
||||||
can :show, Event do |event|
|
can :show, Event do |event|
|
||||||
event.state == 'confirmed'
|
event.state == 'confirmed'
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,18 @@ class TicketPurchase < ActiveRecord::Base
|
||||||
scope: :ticket_id,
|
scope: :ticket_id,
|
||||||
message: 'already bought this ticket!'
|
message: 'already bought this ticket!'
|
||||||
|
|
||||||
|
delegate :title, to: :ticket
|
||||||
|
delegate :description, to: :ticket
|
||||||
|
delegate :price, to: :ticket
|
||||||
|
delegate :price_cents, to: :ticket
|
||||||
|
delegate :price_currency, to: :ticket
|
||||||
|
|
||||||
def self.purchase(conference, user, purchases)
|
def self.purchase(conference, user, purchases)
|
||||||
errors = []
|
errors = []
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
conference.tickets.each do |ticket|
|
conference.tickets.each do |ticket|
|
||||||
quantity = purchases[ticket.id.to_s].to_i
|
quantity = purchases[ticket.id.to_s].to_i
|
||||||
|
# if the user bought the ticket, just update the quantity
|
||||||
if ticket.bought?(user)
|
if ticket.bought?(user)
|
||||||
purchase = update_quantity(conference, quantity, ticket, user)
|
purchase = update_quantity(conference, quantity, ticket, user)
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ class Track < ActiveRecord::Base
|
||||||
has_many :events
|
has_many :events
|
||||||
|
|
||||||
before_create :generate_guid
|
before_create :generate_guid
|
||||||
|
validates :name, presence: true
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,13 +59,17 @@ class User < ActiveRecord::Base
|
||||||
self.subscriptions.find_by(conference_id: conference.id).present?
|
self.subscriptions.find_by(conference_id: conference.id).present?
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the ticket purchased ticket
|
# Returns the purchased ticket
|
||||||
# ====Returns
|
# ====Returns
|
||||||
# * +TicketUser::ActiveRecord_Relation+ -> user
|
# * +TicketUser::ActiveRecord_Relation+ -> user
|
||||||
def ticket(id)
|
def ticket(id)
|
||||||
ticket_purchases.where(ticket_id: id).first
|
ticket_purchases.where(ticket_id: id).first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def supports? conference
|
||||||
|
ticket_purchases.find_by(conference_id: conference.id).present?
|
||||||
|
end
|
||||||
|
|
||||||
def self.for_ichain_username(username, attributes)
|
def self.for_ichain_username(username, attributes)
|
||||||
user = find_by(username: username)
|
user = find_by(username: username)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class Venue < ActiveRecord::Base
|
||||||
after_update :send_mail_notification
|
after_update :send_mail_notification
|
||||||
|
|
||||||
def address
|
def address
|
||||||
"#{conference.venue.street}, #{conference.venue.postalcode} #{conference.venue.city}, #{conference.venue.country}"
|
"#{street}, #{city}, #{country_name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def country_name
|
def country_name
|
||||||
|
|
|
||||||
|
|
@ -30,4 +30,4 @@
|
||||||
method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete #{difficulty_level.title}?" }
|
method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete #{difficulty_level.title}?" }
|
||||||
.row
|
.row
|
||||||
.col-md-12.text-right
|
.col-md-12.text-right
|
||||||
= link_to 'Add Difficulty Level', new_admin_conference_difficulty_level_path(@conference.short_title), class: 'btn btn-primary'
|
= link_to 'Add Difficulty Level', new_admin_conference_difficulty_level_path(@conference.short_title), class: 'btn btn-primary'
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
.page-header
|
.page-header
|
||||||
-if @sponsor.new_record?
|
|
||||||
New
|
|
||||||
%h1
|
%h1
|
||||||
|
-if @sponsor.new_record?
|
||||||
|
New
|
||||||
Sponsor
|
Sponsor
|
||||||
= @sponsor.name
|
= @sponsor.name
|
||||||
.row
|
.row
|
||||||
|
|
@ -16,4 +16,4 @@
|
||||||
= f.input :website_url
|
= f.input :website_url
|
||||||
= f.input :sponsorship_level, collection: @conference.sponsorship_levels
|
= f.input :sponsorship_level, collection: @conference.sponsorship_levels
|
||||||
%p.text-right
|
%p.text-right
|
||||||
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
|
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
%table.table.table-hover#tickets
|
%table.table.table-hover#tickets
|
||||||
%thead
|
%thead
|
||||||
%th Title
|
%th Title
|
||||||
|
%th Description
|
||||||
%th Price
|
%th Price
|
||||||
%th Sold
|
%th Sold
|
||||||
%th Actions
|
%th Actions
|
||||||
|
|
@ -19,6 +20,8 @@
|
||||||
%td
|
%td
|
||||||
= link_to(admin_conference_ticket_path(@conference.short_title, ticket.id)) do
|
= link_to(admin_conference_ticket_path(@conference.short_title, ticket.id)) do
|
||||||
= ticket.title
|
= ticket.title
|
||||||
|
%td
|
||||||
|
= truncate(ticket.description)
|
||||||
%td
|
%td
|
||||||
= humanized_money_with_symbol ticket.price
|
= humanized_money_with_symbol ticket.price
|
||||||
%td
|
%td
|
||||||
|
|
|
||||||
|
|
@ -10,25 +10,26 @@
|
||||||
%small
|
%small
|
||||||
%b
|
%b
|
||||||
= date_string(conference.start_date, conference.end_date)
|
= date_string(conference.start_date, conference.end_date)
|
||||||
|
- if conference.venue
|
||||||
|
%p
|
||||||
|
= "#{conference.venue.city}/#{conference.venue.country_name}"
|
||||||
.col-md-2
|
.col-md-2
|
||||||
.btn-group-vertical
|
.btn-group-vertical
|
||||||
- if current_user.nil? || !current_user.subscribed?(conference)
|
|
||||||
= link_to 'Subscribe', conference_subscriptions_path(conference.short_title), method: :post, class: 'btn btn-info btn-group-vertical'
|
|
||||||
- else
|
|
||||||
= link_to 'Unsubscribe', conference_subscriptions_path(conference.short_title), method: :delete, class: 'btn btn-danger btn-group-vertical'
|
|
||||||
|
|
||||||
- if !@conference || @conference != conference
|
- if !@conference || @conference != conference
|
||||||
- if conference.splashpage && conference.splashpage.public
|
- if conference.splashpage && conference.splashpage.public
|
||||||
= link_to "View Conference", conference_path(conference.short_title), :class =>"btn btn-default"
|
= link_to "View Conference", conference_path(conference.short_title), :class =>"btn btn-default"
|
||||||
|
- if conference.call_for_paper and conference.call_for_paper.schedule_public
|
||||||
|
= link_to "Schedule", schedule_conference_path(conference.short_title), :class =>"btn btn-default"
|
||||||
- if conference.registration_open?
|
- if conference.registration_open?
|
||||||
- if conference.user_registered?(current_user)
|
- if conference.user_registered?(current_user)
|
||||||
= link_to "Modify Registration", edit_conference_conference_registrations_path(conference.short_title), :class =>"btn btn-default"
|
= link_to "My Registration", conference_conference_registrations_path(conference.short_title), :class =>"btn btn-default"
|
||||||
- else
|
- else
|
||||||
= link_to "Register", new_conference_conference_registrations_path(conference.short_title), :class =>"btn btn-success"
|
= link_to "Register", new_conference_conference_registrations_path(conference.short_title), :class =>"btn btn-default"
|
||||||
= link_to "Schedule", schedule_conference_path(conference.short_title), :class =>"btn btn-default" if conference.call_for_paper and conference.call_for_paper.schedule_public
|
|
||||||
- if !current_user.nil? && current_user.proposal_count(conference) > 0
|
- if !current_user.nil? && current_user.proposal_count(conference) > 0
|
||||||
= link_to "View My Proposals", conference_proposal_index_path(conference.short_title), :class =>"btn btn-default"
|
= link_to "My Proposals", conference_proposal_index_path(conference.short_title), :class =>"btn btn-default"
|
||||||
- elsif conference.cfp_open?
|
- elsif conference.cfp_open?
|
||||||
= link_to "Submit Proposal", conference_proposal_index_path(conference.short_title), :class =>"btn btn-default"
|
= link_to "Submit Proposal", conference_proposal_index_path(conference.short_title), :class =>"btn btn-default"
|
||||||
- if !current_user.nil? && conference.tickets.any?
|
- if current_user.nil? || !current_user.subscribed?(conference)
|
||||||
= link_to 'Support', conference_tickets_path(conference.short_title), class: 'btn btn-default'
|
= link_to 'Subscribe', conference_subscriptions_path(conference.short_title), method: :post, class: 'btn btn-default'
|
||||||
|
- else
|
||||||
|
= link_to 'Unsubscribe', conference_subscriptions_path(conference.short_title), method: :delete, class: 'btn btn-default'
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,13 @@
|
||||||
.container
|
.container
|
||||||
.row
|
.row
|
||||||
.col-md-12.text-center
|
.col-md-12.text-center
|
||||||
%h2 Accommodation Deals
|
%h2
|
||||||
|
Where to stay
|
||||||
|
- if @conference.venue
|
||||||
|
in
|
||||||
|
= @conference.venue.city
|
||||||
%p.lead
|
%p.lead
|
||||||
We have prepared affordable accommodation deals for your visit.
|
We recommend these affordable lodging accommodations for your visit.
|
||||||
- @conference.lodgings.each_slice(3) do |slice|
|
- @conference.lodgings.each_slice(3) do |slice|
|
||||||
.row.row-centered
|
.row.row-centered
|
||||||
- slice.each do |lodging|
|
- slice.each do |lodging|
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,13 @@
|
||||||
- @antiquated.each do |conference|
|
- @antiquated.each do |conference|
|
||||||
= render :partial => "conference_details", :locals => {:conference => conference}
|
= render :partial => "conference_details", :locals => {:conference => conference}
|
||||||
|
|
||||||
:javascript
|
-content_for :script_body do
|
||||||
$('#antiquated').on('hidden.bs.collapse', function () {
|
:javascript
|
||||||
$( ".fa-chevron-down" ).hide();
|
$('#antiquated').on('hidden.bs.collapse', function () {
|
||||||
$( ".fa-chevron-right" ).show();
|
$( ".fa-chevron-down" ).hide();
|
||||||
})
|
$( ".fa-chevron-right" ).show();
|
||||||
$('#antiquated').on('shown.bs.collapse', function () {
|
})
|
||||||
$( ".fa-chevron-down" ).show();
|
$('#antiquated').on('shown.bs.collapse', function () {
|
||||||
$( ".fa-chevron-right" ).hide();
|
$( ".fa-chevron-down" ).show();
|
||||||
})
|
$( ".fa-chevron-right" ).hide();
|
||||||
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
$('#gallery .carousel-inner').append("#{escape_javascript(render('gallery_photo', photos: @photos)) }");
|
|
||||||
$('#gallery .modal-body').children('.fa').remove();
|
|
||||||
$('#gallery #carousel-example-generic').css('visibility','visible');
|
|
||||||
|
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
%section#lodging
|
%section#lodging
|
||||||
= render 'lodging'
|
= render 'lodging'
|
||||||
|
|
||||||
- if @conference.tickets.any? and @conference.splashpage.include_tickets
|
- if @conference.tickets.any? and @conference.splashpage.include_tickets and @conference.pending?
|
||||||
%section#tickets
|
%section#tickets
|
||||||
= render 'tickets'
|
= render 'tickets'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,23 @@
|
||||||
.container
|
.container
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
|
.page-header
|
||||||
|
%h1
|
||||||
|
Registration for
|
||||||
|
= @conference.title
|
||||||
|
.row
|
||||||
|
.col-md-8
|
||||||
= semantic_form_for(@registration, url: conference_conference_registrations_path(@conference.short_title)) do |f|
|
= semantic_form_for(@registration, url: conference_conference_registrations_path(@conference.short_title)) do |f|
|
||||||
.tabbable
|
- if @conference.questions.any?
|
||||||
%ul.nav.nav-tabs
|
= render partial: 'questions', locals: { f: f }
|
||||||
%li.active
|
- if @conference.events.workshops.any?
|
||||||
= link_to 'Register', '#register-content', 'data-toggle' => 'tab'
|
=f.inputs 'Register to Workshops' do
|
||||||
- if @conference.use_volunteers
|
= f.input :events, as: :check_boxes, label: false, collection: @conference.events.workshops
|
||||||
%li
|
= f.inputs 'Your Travel Info' do
|
||||||
= link_to 'Volunteer', '#volunteer-content', 'data-toggle' => 'tab'
|
= f.input :arrival, as: :string, label: 'Your arrival time', input_html: { value: (f.object.arrival.to_formatted_s(:db_without_seconds) unless f.object.arrival.nil?), id: 'registration-arrival-datepicker', readonly: 'readonly' }
|
||||||
.tab-content
|
= f.input :departure, as: :string, label: 'Your departure time', input_html: { value: (f.object.departure.to_formatted_s(:db_without_seconds) unless f.object.departure.nil?), id: 'registration-departure-datepicker', readonly: 'readonly' }
|
||||||
#register-content.tab-pane.active
|
%p.pull-right
|
||||||
= render 'conference_registrations/registration', f: f
|
- if @conference.user_registered?(current_user)
|
||||||
- if @conference.use_volunteers
|
= f.action :submit, button_html: { value: 'Update Registration', class: 'btn btn-primary' }
|
||||||
#volunteer-content.tab-pane
|
- else
|
||||||
= render 'conference_registrations/volunteer', f: f
|
= f.action :submit, button_html: { value: 'Register', class: 'btn btn-primary', id: 'register' }
|
||||||
- if @conference.user_registered?(current_user)
|
|
||||||
= f.action :submit, button_html: { value: 'Update Registration', class: 'btn btn-primary' }
|
|
||||||
= link_to 'Unregister', conference_conference_registrations_path(@conference.short_title),
|
|
||||||
method: :delete, class: 'btn btn-danger', confirm: 'Are you sure you want to unregister?'
|
|
||||||
- else
|
|
||||||
= f.action :submit, button_html: { value: 'Register', class: 'btn btn-primary', id: 'register' }
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
- @conference.questions.each do |q|
|
- @conference.questions.each do |q|
|
||||||
%h5
|
= f.inputs 'Additional Info' do
|
||||||
= "Q: #{q.title}"
|
- if q.question_type.id == 1 || q.question_type.id == 2 # yes/no or single choice
|
||||||
- if q.question_type.id == 1 || q.question_type.id == 2 # yes/no or single choice
|
= f.input :qanswers, :collection => q.qanswers, :as => :select, :input_html => { :multiple => false, class: 'col-sm-10' }, label: q.title, :include_blank => "Please make your choice",
|
||||||
= f.input :qanswers, :collection => q.qanswers, :as => :select, :input_html => { :multiple => false }, :label => false, :include_blank => "Please make your choice",
|
:member_label => Proc.new {|a| a.answer.title}
|
||||||
:member_label => Proc.new {|a| a.answer.title}
|
- if q.question_type.id == 3 # multiple choice
|
||||||
|
= f.input :qanswers, :collection => q.qanswers, :as => :check_boxes, :input_html => { class: 'col-sm-2' }, :label => false,
|
||||||
- if q.question_type.id == 3 # multiple choice
|
:member_label => Proc.new {|a| a.answer.title}
|
||||||
= f.input :qanswers, :collection => q.qanswers, :as => :check_boxes, :label => false,
|
|
||||||
:member_label => Proc.new {|a| a.answer.title}
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
.row
|
|
||||||
.col-md-12
|
|
||||||
%h3
|
|
||||||
Registration for
|
|
||||||
= @conference.title
|
|
||||||
- if current_user.proposal_count(@conference) > 0
|
|
||||||
.row
|
|
||||||
.col-md-12
|
|
||||||
%i
|
|
||||||
Please note: Registration is not automatically performed for speakers. If you're scheduled to speak at the conference, you still need to register!
|
|
||||||
.row
|
|
||||||
.col-md-12
|
|
||||||
= f.inputs name: 'Your Details' do
|
|
||||||
- if @conference.questions
|
|
||||||
= render partial: 'questions', locals: { f: f }
|
|
||||||
%br
|
|
||||||
|
|
||||||
- if @conference.events.workshops.any?
|
|
||||||
=f.inputs 'Register to Workshops' do
|
|
||||||
= f.input :events, as: :check_boxes, label: false, collection: @conference.events.workshops
|
|
||||||
|
|
||||||
= f.inputs 'Travel Info' do
|
|
||||||
= f.input :arrival, as: :string, input_html: { value: (f.object.arrival.to_formatted_s(:db_without_seconds) unless f.object.arrival.nil?), id: 'registration-arrival-datepicker', readonly: 'readonly' }
|
|
||||||
= f.input :departure, as: :string, input_html: { value: (f.object.departure.to_formatted_s(:db_without_seconds) unless f.object.departure.nil?), id: 'registration-departure-datepicker', readonly: 'readonly' }
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
%table.table.table-hover
|
|
||||||
%thead
|
|
||||||
%tr
|
|
||||||
%th Ticket
|
|
||||||
%th.text-center Quantity
|
|
||||||
%th.text-center Price
|
|
||||||
%th.text-center Total
|
|
||||||
%th
|
|
||||||
%tbody
|
|
||||||
- tickets.each do |ticket|
|
|
||||||
%tr
|
|
||||||
%td.col-sm-8.col-md-6
|
|
||||||
.media
|
|
||||||
.media-body
|
|
||||||
%h4.media-heading
|
|
||||||
= ticket.title
|
|
||||||
%h5.media-heading
|
|
||||||
-if !ticket.description.blank?
|
|
||||||
= markdown(ticket.description)
|
|
||||||
%td.col-sm-1.col-md-1.text-center
|
|
||||||
= ticket.quantity_bought_by(current_user)
|
|
||||||
%td.col-sm-1.col-md-1.text-center
|
|
||||||
= humanized_money_with_symbol ticket.price
|
|
||||||
%td.col-sm-1.col-md-1.text-center
|
|
||||||
%strong
|
|
||||||
= ticket.total_price(current_user)
|
|
||||||
%td.col-sm-1.col-md-1.text-center
|
|
||||||
= link_to conference_ticket_purchase_path(@conference.short_title, ticket.id),
|
|
||||||
method: :delete, class: 'btn btn-danger',
|
|
||||||
data: { confirm: "Do you really want to delete the #{ticket.title} for #{@conference.title}?" } do
|
|
||||||
Delete
|
|
||||||
%i.fa.fa-trash-o
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%td
|
|
||||||
%td
|
|
||||||
%td.col-sm-1.col-md-1.text-center
|
|
||||||
%h4
|
|
||||||
Total
|
|
||||||
%td.col-sm-1.col-md-1.text-center
|
|
||||||
%h4
|
|
||||||
%strong
|
|
||||||
- if @total_price.cents == -1
|
|
||||||
not-calculable
|
|
||||||
- else
|
|
||||||
= humanized_money_with_symbol Ticket.total_price(@conference, current_user)
|
|
||||||
|
|
@ -3,117 +3,136 @@
|
||||||
.col-md-12
|
.col-md-12
|
||||||
.page-header
|
.page-header
|
||||||
%h1
|
%h1
|
||||||
|
Registration for
|
||||||
= @conference.title
|
= @conference.title
|
||||||
|
%p.text-muted
|
||||||
|
-if @conference.venue
|
||||||
|
at
|
||||||
|
%strong
|
||||||
|
= "#{@conference.venue.name},"
|
||||||
|
= "#{@conference.venue.street},"
|
||||||
|
= "#{@conference.venue.city} / #{@conference.venue.country_name}."
|
||||||
%small
|
%small
|
||||||
= date_string(@conference.start_date, @conference.end_date)
|
= date_string(@conference.start_date, @conference.end_date)
|
||||||
.row
|
|
||||||
.col-md-6
|
|
||||||
- if @conference.venue
|
|
||||||
%p
|
|
||||||
%small
|
|
||||||
at
|
|
||||||
= link_to @conference.venue.name
|
|
||||||
,
|
|
||||||
= link_to @conference.venue.address, "http://maps.google.com/maps?q=#{@conference.venue.address}"
|
|
||||||
.col-md-4
|
|
||||||
- if @conference.contact.facebook.present?
|
|
||||||
= link_to "#{ @conference.contact.facebook }" do
|
|
||||||
%i.fa.fa-facebook-square
|
|
||||||
- if @conference.contact.twitter.present?
|
|
||||||
= link_to "#{ @conference.contact.twitter }" do
|
|
||||||
%i.fa.fa-twitter
|
|
||||||
- if @conference.contact.instagram.present?
|
|
||||||
= link_to "#{ @conference.contact.instagram }" do
|
|
||||||
%i.fa.fa-instagram
|
|
||||||
- if @conference.contact.googleplus.present?
|
|
||||||
= link_to "#{ @conference.contact.googleplus }" do
|
|
||||||
%i.fa.fa-google-plus-square
|
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
- if @conference.tickets.any?
|
%h4
|
||||||
%h3
|
%span.fa-stack
|
||||||
Tickets
|
%i.fa.fa-square-o.fa-stack-2x
|
||||||
- if current_user.tickets.any?
|
%i.fa.fa-plane.fa-stack-1x
|
||||||
%p
|
Travel Schedule
|
||||||
You have purchased the following tickets:
|
%ul
|
||||||
= render partial: 'tickets_bought', locals: { tickets: current_user.tickets }
|
%li
|
||||||
- else
|
- if @registration.arrival.present?
|
||||||
= render partial: 'tickets', locals: { tickets: @conference.tickets }
|
arrive at
|
||||||
%p
|
%strong
|
||||||
If you would like to buy more tickets, please click
|
= @registration.arrival.strftime('%A, %B %-d. %Y %H:%m')
|
||||||
= link_to 'here', conference_tickets_path(@conference.short_title)
|
- else
|
||||||
.row
|
You haven't scheduled your arrival
|
||||||
.col-md-12
|
%li
|
||||||
- if @conference.speakers.confirmed.any?
|
- if @registration.departure.present?
|
||||||
%h3
|
depart at
|
||||||
= pluralize(@conference.speakers.confirmed.count, 'Speaker')
|
%strong
|
||||||
- @conference.speakers.confirmed.limit(12).each_slice(4) do |slice|
|
= @registration.departure.strftime('%A, %B %-d. %Y %H:%m')
|
||||||
.row
|
- else
|
||||||
- slice.each do |speaker|
|
You haven't scheduled your departure
|
||||||
.col-md-3
|
- if @conference.questions.any?
|
||||||
.row
|
.row
|
||||||
.col-md-3
|
.col-md-12
|
||||||
= image_tag(speaker.gravatar_url(size: '25'),
|
%h4
|
||||||
title: "Yo #{speaker.name}!",
|
%span.fa-stack
|
||||||
alt: '', 'class' => 'img-circle img-responsive text-center')
|
%i.fa.fa-square-o.fa-stack-2x
|
||||||
.col-md-9
|
%i.fa.fa-info.fa-stack-1x
|
||||||
%h4
|
Additional Info
|
||||||
= speaker.name
|
%ul
|
||||||
.row
|
|
||||||
.col-md-12
|
|
||||||
- if @conference.events.confirmed.any?
|
|
||||||
%h3
|
|
||||||
= pluralize(@conference.events.confirmed.count, 'Event')
|
|
||||||
%ul.list-unstyled
|
|
||||||
- @conference.events.confirmed.limit(10).each do |event|
|
|
||||||
%li
|
|
||||||
%h4
|
|
||||||
= link_to event.title, conference_proposal_path(@conference.short_title, event.id)
|
|
||||||
%strong
|
|
||||||
presented by
|
|
||||||
= event.speaker_names
|
|
||||||
.row
|
|
||||||
.col-md-12
|
|
||||||
- if @conference.participants.any?
|
|
||||||
%h3
|
|
||||||
= pluralize(@conference.participants.count, 'Participant')
|
|
||||||
- @conference.participants.limit(36).each_slice(12) do |slice|
|
|
||||||
.row
|
|
||||||
- slice.each do |participant|
|
|
||||||
.col-md-1
|
|
||||||
= image_tag(participant.gravatar_url(size: '25'),
|
|
||||||
title: "Yo #{participant.name}!",
|
|
||||||
alt: '', 'class' => 'img-circle img-responsive text-center')
|
|
||||||
.row
|
|
||||||
.col-md-12
|
|
||||||
- if @registration
|
|
||||||
%h2
|
|
||||||
Congratulations! You are now registered for
|
|
||||||
= "#{@conference.title}!"
|
|
||||||
- if @conference.questions.any?
|
|
||||||
%h3 Your answers to the registrations questions are:
|
|
||||||
- @conference.questions.each do |q|
|
- @conference.questions.each do |q|
|
||||||
%p
|
%li
|
||||||
%b Question:
|
%strong
|
||||||
= q.title
|
= q.title
|
||||||
%b Your Answer:
|
- if @registration.qanswers.any?
|
||||||
- @registration.qanswers.where(:question_id => q.id).each do |qa|
|
- @registration.qanswers.where(:question_id => q.id).each do |qa|
|
||||||
= qa.answer.title
|
= qa.answer.title
|
||||||
- if @workshops.any?
|
- else
|
||||||
%h3 You are registered for the following workshops:
|
You haven't answered
|
||||||
%ul.list-unstyled
|
- if @workshops.any?
|
||||||
- @workshops.each do |workshop|
|
.row
|
||||||
%li
|
.col-md-12
|
||||||
%h4
|
%h4
|
||||||
= link_to workshop.title, conference_proposal_path(@conference.short_title, workshop.id)
|
%span.fa-stack
|
||||||
%strong
|
%i.fa.fa-square-o.fa-stack-2x
|
||||||
presented by
|
%i.fa.fa-check.fa-stack-1x
|
||||||
= workshop.speaker_names
|
Event Registrations
|
||||||
%div
|
%ul
|
||||||
= link_to 'Modify your Registration', edit_conference_conference_registrations_path(@conference.short_title), class: 'btn btn-success'
|
- @workshops.each do |workshop|
|
||||||
|
%li
|
||||||
|
= link_to workshop.title, conference_proposal_path(@conference.short_title, workshop.id)
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
%h4
|
||||||
|
%span.fa-stack
|
||||||
|
%i.fa.fa-square-o.fa-stack-2x
|
||||||
|
%i.fa.fa-ticket.fa-stack-1x
|
||||||
|
Tickets
|
||||||
|
-if @tickets.any?
|
||||||
|
= "(#{@total_price} #{@tickets.first.price.symbol})"
|
||||||
|
%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)
|
||||||
|
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
-if @registration
|
||||||
|
.btn-group-vertical.pull-right
|
||||||
|
= link_to 'Edit your Registration', edit_conference_conference_registrations_path(@conference.short_title), class: 'btn btn-success'
|
||||||
= link_to 'Unregister', conference_conference_registrations_path(@conference.short_title),
|
= link_to 'Unregister', conference_conference_registrations_path(@conference.short_title),
|
||||||
method: :delete, class: 'btn btn-danger', confirm: 'Are you sure you want to unregister?'
|
method: :delete, class: 'btn btn-danger btn-xs', confirm: 'Are you sure you want to unregister?'
|
||||||
- else
|
- else
|
||||||
%p.lead
|
= link_to 'Register', new_conference_conference_registrations_path(@conference.short_title), class: 'btn btn-success btn-lg pull-right'
|
||||||
= "Unfortunately you are not registered for #{@conference.title}. If you want to register click"
|
|
||||||
= link_to 'here.', new_conference_conference_registrations_path(@conference.short_title)
|
.row
|
||||||
|
.col-md-12
|
||||||
|
.page-header
|
||||||
|
%h1
|
||||||
|
%small
|
||||||
|
Meet the people of
|
||||||
|
= @conference.short_title
|
||||||
|
.col-md-4
|
||||||
|
- if @conference.participants.any?
|
||||||
|
%h4
|
||||||
|
%span.fa-stack
|
||||||
|
%i.fa.fa-square-o.fa-stack-2x
|
||||||
|
%i.fa.fa-group.fa-stack-1x
|
||||||
|
= @conference.participants.count
|
||||||
|
Registered
|
||||||
|
= word_pluralize(@conference.participants.count, 'Attendees')
|
||||||
|
- @conference.participants.each do |participant|
|
||||||
|
= image_tag(participant.gravatar_url(size: '25'), title: "#{participant.name}!", class: 'img-circle')
|
||||||
|
.col-md-4.col-md-offset-2
|
||||||
|
- if @conference.speakers.any?
|
||||||
|
%h4
|
||||||
|
%span.fa-stack
|
||||||
|
%i.fa.fa-square-o.fa-stack-2x
|
||||||
|
%i.fa.fa-microphone.fa-stack-1x
|
||||||
|
= @conference.speakers.count
|
||||||
|
Confirmed
|
||||||
|
= word_pluralize(@conference.speakers.count, 'Speaker')
|
||||||
|
- @conference.speakers.each do |speaker|
|
||||||
|
= image_tag(speaker.gravatar_url(size: '25'), title: "#{speaker.name}!", class: 'img-circle')
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
= link_to(edit_user_path(current_user.id)) do
|
= link_to(edit_user_path(current_user.id)) do
|
||||||
%span.fa.fa-user
|
%span.fa.fa-user
|
||||||
Edit Profile
|
Edit Profile
|
||||||
-if @conference and @conference.id
|
-if @conference and @conference.call_for_paper
|
||||||
%li
|
%li
|
||||||
= link_to(conference_proposal_index_path(@conference.short_title)) do
|
= link_to(conference_proposal_index_path(@conference.short_title)) do
|
||||||
%span.fa.fa-comment
|
%span.fa.fa-comment
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,10 @@
|
||||||
%td.col-sm-1.col-md-1
|
%td.col-sm-1.col-md-1
|
||||||
- if ticket.bought?(current_user)
|
- if ticket.bought?(current_user)
|
||||||
= text_field_tag("tickets[][#{ticket.id}]", ticket.quantity_bought_by(current_user),
|
= text_field_tag("tickets[][#{ticket.id}]", ticket.quantity_bought_by(current_user),
|
||||||
type: 'number', min: 0, class: 'form-control quantity', 'data-id' => ticket.id)
|
type: 'number', min: 0, class: "form-control quantity", 'data-id' => ticket.id)
|
||||||
- else
|
- else
|
||||||
= text_field_tag("tickets[][#{ticket.id}]", 0, type: 'number', min: 0,
|
= text_field_tag("tickets[][#{ticket.id}]", 0, type: 'number', min: 0,
|
||||||
class: 'form-control quantity', 'data-id' => ticket.id)
|
class: "form-control quantity", 'data-id' => ticket.id)
|
||||||
%td.col-sm-1.col-md-1.text-center
|
%td.col-sm-1.col-md-1.text-center
|
||||||
= ticket.price.symbol
|
= ticket.price.symbol
|
||||||
%span{id: "price_#{ticket.id}"}
|
%span{id: "price_#{ticket.id}"}
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,10 @@
|
||||||
%h1
|
%h1
|
||||||
Tickets
|
Tickets
|
||||||
%p.lead
|
%p.lead
|
||||||
Please buy a ticket to support
|
Support
|
||||||
%b
|
%strong
|
||||||
= @conference.title
|
= @conference.title
|
||||||
|
by buying a ticket
|
||||||
=form_tag(conference_ticket_purchases_path, method: :post) do |f|
|
=form_tag(conference_ticket_purchases_path, method: :post) do |f|
|
||||||
%table.table.table-hover
|
%table.table.table-hover
|
||||||
%thead
|
%thead
|
||||||
|
|
@ -28,11 +29,18 @@
|
||||||
%td.col-sm-1.col-md-1.text-center
|
%td.col-sm-1.col-md-1.text-center
|
||||||
%h4
|
%h4
|
||||||
%strong
|
%strong
|
||||||
|
= @conference.tickets.first.price.symbol
|
||||||
%span{id: 'total_price'}
|
%span{id: 'total_price'}
|
||||||
0
|
0
|
||||||
.pull-right
|
.pull-right
|
||||||
= button_tag(type: 'submit', class: 'btn btn-success btn-lg') do
|
.btn-group-vertical
|
||||||
Support
|
= button_tag(type: 'submit', class: 'btn btn-success btn-lg') do
|
||||||
%i.fa.fa-shopping-cart
|
Support
|
||||||
= link_to 'Continue without a Ticket!', conference_conference_registrations_path(@conference.short_title),
|
%i.fa.fa-shopping-cart
|
||||||
class: 'btn btn-danger btn-sm'
|
= link_to 'Continue without a Ticket!', conference_conference_registrations_path(@conference.short_title),
|
||||||
|
class: 'btn btn-danger btn-sm'
|
||||||
|
.row
|
||||||
|
.col-md-13
|
||||||
|
%p.text-muted.text-center
|
||||||
|
%small
|
||||||
|
Checkout will be at the conference registration
|
||||||
|
|
@ -3,6 +3,5 @@ FactoryGirl.define do
|
||||||
title 'Business Ticket'
|
title 'Business Ticket'
|
||||||
price_cents 1000
|
price_cents 1000
|
||||||
price_currency 'USD'
|
price_currency 'USD'
|
||||||
conference
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ feature 'Has correct abilities' do
|
||||||
let(:user) { create(:user, role_ids: [role_organizer.id, role_cfp.id, role_info_desk.id, role_volunteer_coordinator.id]) }
|
let(:user) { create(:user, role_ids: [role_organizer.id, role_cfp.id, role_info_desk.id, role_volunteer_coordinator.id]) }
|
||||||
|
|
||||||
scenario 'when user is organizer' do
|
scenario 'when user is organizer' do
|
||||||
|
user.is_admin = false
|
||||||
sign_in user
|
sign_in user
|
||||||
visit admin_conference_path(conference1.short_title)
|
visit admin_conference_path(conference1.short_title)
|
||||||
|
|
||||||
|
|
@ -86,6 +87,7 @@ feature 'Has correct abilities' do
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'when user is cfp' do
|
scenario 'when user is cfp' do
|
||||||
|
user.is_admin = false
|
||||||
sign_in user
|
sign_in user
|
||||||
visit admin_conference_path(conference2.short_title)
|
visit admin_conference_path(conference2.short_title)
|
||||||
|
|
||||||
|
|
@ -156,6 +158,7 @@ feature 'Has correct abilities' do
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'when user is info desk' do
|
scenario 'when user is info desk' do
|
||||||
|
user.is_admin = false
|
||||||
sign_in user
|
sign_in user
|
||||||
visit admin_conference_path(conference3.short_title)
|
visit admin_conference_path(conference3.short_title)
|
||||||
|
|
||||||
|
|
@ -227,6 +230,7 @@ feature 'Has correct abilities' do
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'when user is volunteer coordinator' do
|
scenario 'when user is volunteer coordinator' do
|
||||||
|
user.is_admin = false
|
||||||
sign_in user
|
sign_in user
|
||||||
visit admin_conference_path(conference4.short_title)
|
visit admin_conference_path(conference4.short_title)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,21 +18,22 @@ feature Registration do
|
||||||
|
|
||||||
scenario 'updates conference registration', feature: true, js: true do
|
scenario 'updates conference registration', feature: true, js: true do
|
||||||
visit root_path
|
visit root_path
|
||||||
click_link 'Modify Registration'
|
click_link 'My Registration'
|
||||||
|
expect(current_path).to eq(conference_conference_registrations_path(conference.short_title))
|
||||||
|
|
||||||
|
click_link 'Edit your Registration'
|
||||||
expect(current_path).to eq(edit_conference_conference_registrations_path(conference.short_title))
|
expect(current_path).to eq(edit_conference_conference_registrations_path(conference.short_title))
|
||||||
click_button 'Update Registration'
|
|
||||||
|
|
||||||
|
click_button 'Update Registration'
|
||||||
expect(conference.user_registered?(participant)).to be(true)
|
expect(conference.user_registered?(participant)).to be(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'unregisters for a conference', feature: true, js: true do
|
scenario 'unregisters for a conference', feature: true, js: true do
|
||||||
visit root_path
|
visit root_path
|
||||||
click_link 'Modify Registration'
|
click_link 'My Registration'
|
||||||
|
expect(current_path).to eq(conference_conference_registrations_path(conference.short_title))
|
||||||
|
|
||||||
expect(current_path).to eq(edit_conference_conference_registrations_path(conference.short_title))
|
|
||||||
click_link 'Unregister'
|
click_link 'Unregister'
|
||||||
|
|
||||||
expect(conference.user_registered?(participant)).to be(false)
|
expect(conference.user_registered?(participant)).to be(false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ feature DifficultyLevel do
|
||||||
within('table#difficulty_levels') do
|
within('table#difficulty_levels') do
|
||||||
expect(page.has_content?('Hard')).to be true
|
expect(page.has_content?('Hard')).to be true
|
||||||
expect(page.has_content?('Life is the hardest')).to be true
|
expect(page.has_content?('Life is the hardest')).to be true
|
||||||
expect(page.assert_selector('tr', count: 2)).to be true
|
expect(page.assert_selector('tr', count: 5)).to be true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -38,12 +38,17 @@ feature DifficultyLevel do
|
||||||
conference_id: conference.short_title)
|
conference_id: conference.short_title)
|
||||||
|
|
||||||
# Remove difficulty level
|
# Remove difficulty level
|
||||||
click_link 'Delete'
|
within('table tr:nth-of-type(4)') do
|
||||||
|
click_link 'Delete'
|
||||||
|
end
|
||||||
|
|
||||||
# Validations
|
# Validations
|
||||||
expect(flash).to eq('Difficulty level successfully deleted.')
|
expect(flash).to eq('Difficulty level successfully deleted.')
|
||||||
within('table#difficulty_levels') do
|
within('table#difficulty_levels') do
|
||||||
expect(page.assert_selector('tr', count: 1)).to be true
|
expect(page.assert_selector('tr', count: 4)).to be true
|
||||||
|
expect(page.has_content?('Easy Events')).to be true
|
||||||
|
expect(page.has_content?('Medium Events')).to be true
|
||||||
|
expect(page.has_content?('Hard Events')).to be true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
||||||
|
|
||||||
feature Registration do
|
feature Registration do
|
||||||
let!(:ticket) { create(:ticket) }
|
let!(:ticket) { create(:ticket) }
|
||||||
let!(:conference) { create(:conference, title: 'ExampleCon', tickets: [ticket]) }
|
let!(:conference) { create(:conference, title: 'ExampleCon', tickets: [ticket], registration_period: create(:registration_period, start_date: 3.days.ago)) }
|
||||||
let!(:participant) { create(:user) }
|
let!(:participant) { create(:user) }
|
||||||
|
|
||||||
context 'as a participant' do
|
context 'as a participant' do
|
||||||
|
|
@ -18,7 +18,10 @@ feature Registration do
|
||||||
|
|
||||||
scenario 'purchases a ticket', feature: true, js: true do
|
scenario 'purchases a ticket', feature: true, js: true do
|
||||||
visit root_path
|
visit root_path
|
||||||
click_link 'Support'
|
click_link 'Register'
|
||||||
|
|
||||||
|
expect(current_path).to eq(new_conference_conference_registrations_path(conference.short_title))
|
||||||
|
click_button 'Register'
|
||||||
|
|
||||||
fill_in "tickets__#{ticket.id}", with: '2'
|
fill_in "tickets__#{ticket.id}", with: '2'
|
||||||
expect(current_path).to eq(conference_tickets_path(conference.short_title))
|
expect(current_path).to eq(conference_tickets_path(conference.short_title))
|
||||||
|
|
@ -29,20 +32,18 @@ feature Registration do
|
||||||
expect(purchase.quantity).to eq(2)
|
expect(purchase.quantity).to eq(2)
|
||||||
expect(current_path).to eq(conference_conference_registrations_path(conference.short_title))
|
expect(current_path).to eq(conference_conference_registrations_path(conference.short_title))
|
||||||
expect(flash).
|
expect(flash).
|
||||||
to eq('Congratulations, you have successfully purchased a ticket! You can pay for it in cash when you arrive! Thank you for supporting ExampleCon!')
|
to eq("Thank you for supporting #{conference.title} by purchasing a ticket.")
|
||||||
expect(page.has_content?('Business Ticket')).to be true
|
expect(page.has_content?('2 Business Ticket Tickets for 10')).to be true
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'deletes a purchased ticket', feature: true, js: true do
|
scenario 'deletes a purchased ticket', feature: true, js: true do
|
||||||
create(:ticket_purchase,
|
create(:registration, conference: conference, user: participant)
|
||||||
user_id: participant.id,
|
create(:ticket_purchase, conference: conference, user: participant, ticket: ticket, quantity: 4)
|
||||||
ticket_id: ticket.id,
|
|
||||||
quantity: 2)
|
|
||||||
|
|
||||||
visit conference_conference_registrations_path(conference.short_title)
|
visit conference_conference_registrations_path(conference.short_title)
|
||||||
expect(page.has_content?('Business Ticket')).to be true
|
expect(page.has_content?('4 Business Ticket Tickets for 10')).to be true
|
||||||
|
|
||||||
click_link 'Delete'
|
click_link "ticket-#{ticket.id}-delete"
|
||||||
expect(flash).to eq('Ticket successfully deleted.')
|
expect(flash).to eq('Ticket successfully deleted.')
|
||||||
expect(TicketPurchase.count).to eq(0)
|
expect(TicketPurchase.count).to eq(0)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ describe 'User' do
|
||||||
let!(:first_user) { create(:user) } # automatically becomes admin
|
let!(:first_user) { create(:user) } # automatically becomes admin
|
||||||
let(:user){ nil }
|
let(:user){ nil }
|
||||||
let(:conference_not_public) { create(:conference, splashpage: create(:splashpage, public: false)) }
|
let(:conference_not_public) { create(:conference, splashpage: create(:splashpage, public: false)) }
|
||||||
let(:conference_public) { create(:conference, splashpage: create(:splashpage, public: true)) }
|
let(:conference_public) { create(:conference, splashpage: create(:splashpage, public: true), call_for_paper: create(:call_for_paper, schedule_public: true)) }
|
||||||
let(:event_confirmed) { create(:event, state: 'confirmed') }
|
let(:event_confirmed) { create(:event, state: 'confirmed') }
|
||||||
let(:someevent) { create(:event) }
|
let(:someevent) { create(:event) }
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ describe 'User' do
|
||||||
it{ should be_able_to(:show, event_confirmed)}
|
it{ should be_able_to(:show, event_confirmed)}
|
||||||
it{ should_not be_able_to(:show, someevent)}
|
it{ should_not be_able_to(:show, someevent)}
|
||||||
|
|
||||||
it{ should be_able_to(:index, :schedule)}
|
it{ should be_able_to(:schedule, conference_public)}
|
||||||
|
|
||||||
it{ should_not be_able_to(:create, Event)}
|
it{ should_not be_able_to(:create, Event)}
|
||||||
it{ should_not be_able_to(:manage, Event)}
|
it{ should_not be_able_to(:manage, Event)}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue