Merge pull request #42 from snap-cloud/misc-fixes
A Bunch of Changes....
This commit is contained in:
commit
653a9f5cfb
11 changed files with 85 additions and 17 deletions
3
Gemfile
3
Gemfile
|
|
@ -116,8 +116,9 @@ end
|
||||||
gem 'bootstrap3-datetimepicker-rails', '~> 4.17.47'
|
gem 'bootstrap3-datetimepicker-rails', '~> 4.17.47'
|
||||||
|
|
||||||
# data tables
|
# data tables
|
||||||
|
gem 'jquery-datatables'
|
||||||
gem 'ajax-datatables-rails'
|
gem 'ajax-datatables-rails'
|
||||||
gem 'jquery-datatables-rails'
|
# gem 'jquery-datatables-rails'
|
||||||
|
|
||||||
# for charts
|
# for charts
|
||||||
gem 'chartkick'
|
gem 'chartkick'
|
||||||
|
|
|
||||||
|
|
@ -238,11 +238,7 @@ GEM
|
||||||
io-like (0.3.0)
|
io-like (0.3.0)
|
||||||
iso-639 (0.2.8)
|
iso-639 (0.2.8)
|
||||||
jaro_winkler (1.5.3)
|
jaro_winkler (1.5.3)
|
||||||
jquery-datatables-rails (3.4.0)
|
jquery-datatables (1.10.20)
|
||||||
actionpack (>= 3.1)
|
|
||||||
jquery-rails
|
|
||||||
railties (>= 3.1)
|
|
||||||
sass-rails
|
|
||||||
jquery-rails (4.3.5)
|
jquery-rails (4.3.5)
|
||||||
rails-dom-testing (>= 1, < 3)
|
rails-dom-testing (>= 1, < 3)
|
||||||
railties (>= 4.2.0)
|
railties (>= 4.2.0)
|
||||||
|
|
@ -650,7 +646,7 @@ DEPENDENCIES
|
||||||
haml-rails
|
haml-rails
|
||||||
haml_lint
|
haml_lint
|
||||||
iso-639
|
iso-639
|
||||||
jquery-datatables-rails
|
jquery-datatables
|
||||||
jquery-rails
|
jquery-rails
|
||||||
jquery-ui-rails (~> 4.2.1)
|
jquery-ui-rails (~> 4.2.1)
|
||||||
json-schema
|
json-schema
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,14 @@
|
||||||
//= require jquery.ui.draggable
|
//= require jquery.ui.draggable
|
||||||
//= require jquery.ui.droppable
|
//= require jquery.ui.droppable
|
||||||
//= require waypoints/jquery.waypoints
|
//= require waypoints/jquery.waypoints
|
||||||
|
|
||||||
//= require dataTables/jquery.dataTables
|
//= require dataTables/jquery.dataTables
|
||||||
//= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
|
//= require dataTables/dataTables.bootstrap
|
||||||
|
//= require datatables/extensions/Buttons/dataTables.buttons
|
||||||
|
//= require datatables/extensions/Buttons/buttons.bootstrap
|
||||||
|
// = require datatables/extensions/Buttons/buttons.html5
|
||||||
|
// = require datatables/extensions/Buttons/buttons.dataTables
|
||||||
|
|
||||||
//= require cocoon
|
//= require cocoon
|
||||||
//= require bootstrap
|
//= require bootstrap
|
||||||
//= require Chart.bundle
|
//= require Chart.bundle
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
$(function () {
|
$(function () {
|
||||||
$.extend(true, $.fn.dataTable.defaults, {
|
$.extend(true, $.fn.dataTable.defaults, {
|
||||||
|
"buttons": ["csv"],
|
||||||
|
"dom": "lBfrtip",
|
||||||
"stateSave": true,
|
"stateSave": true,
|
||||||
"autoWidth": false,
|
"autoWidth": false,
|
||||||
"pagingType": "full_numbers",
|
"pagingType": "full_numbers",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,13 @@
|
||||||
/*
|
/*
|
||||||
|
*= require dataTables/dataTables.bootstrap
|
||||||
|
*= require datatables/extensions/Responsive/responsive.dataTables
|
||||||
|
*= require dataTables/extensions/Responsive/responsive.bootstrap
|
||||||
|
*= require dataTables/extensions/Select/select.bootstrap
|
||||||
|
*= require dataTables/extensions/Buttons/buttons.dataTables
|
||||||
|
*= require dataTables/extensions/Buttons/buttons.bootstrap
|
||||||
*= require strap-on
|
*= require strap-on
|
||||||
*= require formtastic-bootstrap
|
*= require formtastic-bootstrap
|
||||||
*= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
|
|
||||||
*= require selectize
|
*= require selectize
|
||||||
*= require selectize.bootstrap3
|
*= require selectize.bootstrap3
|
||||||
*= require bootstrap-select
|
*= require bootstrap-select
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,8 @@ module Admin
|
||||||
# load_and_authorize_resource :event, through: :program
|
# load_and_authorize_resource :event, through: :program
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@events = Event.accessible_by(current_ability).where(program: @program)
|
@events = Event.accessible_by(current_ability).where(program: @program,
|
||||||
|
state: [:confirmed, :unconfirmed])
|
||||||
@events_commercials = Commercial.where(commercialable_type: 'Event', commercialable_id: @events.pluck(:id))
|
@events_commercials = Commercial.where(commercialable_type: 'Event', commercialable_id: @events.pluck(:id))
|
||||||
@events_missing_commercial = @events.where.not(id: @events_commercials.pluck(:commercialable_id))
|
@events_missing_commercial = @events.where.not(id: @events_commercials.pluck(:commercialable_id))
|
||||||
@events_with_requirements = @events.where.not(description: ['', nil])
|
@events_with_requirements = @events.where.not(description: ['', nil])
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ class PhysicalTicketsController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@physical_tickets = current_user.physical_tickets.by_conference(@conference)
|
@physical_tickets = current_user.physical_tickets.by_conference(@conference)
|
||||||
|
@has_registration_ticket = current_user.ticket_purchases.where(ticket: @conference.registration_tickets, paid: true).any?
|
||||||
@unpaid_ticket_purchases = current_user.ticket_purchases.by_conference(@conference).unpaid
|
@unpaid_ticket_purchases = current_user.ticket_purchases.by_conference(@conference).unpaid
|
||||||
@user = current_user
|
@user = current_user
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,15 @@ class Payment < ApplicationRecord
|
||||||
Ticket.total_price(conference, user, paid: false).cents
|
Ticket.total_price(conference, user, paid: false).cents
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def stripe_description
|
||||||
|
#"ticket purchases(#{user.username})"
|
||||||
|
"Tickets for #{conference.title} #{user.name} #{user.email}"
|
||||||
|
end
|
||||||
|
|
||||||
def purchase
|
def purchase
|
||||||
gateway_response = Stripe::Charge.create source: stripe_customer_token,
|
gateway_response = Stripe::Charge.create source: stripe_customer_token,
|
||||||
receipt_email: stripe_customer_email,
|
receipt_email: stripe_customer_email,
|
||||||
description: "ticket purchases(#{user.username})",
|
description: stripe_description,
|
||||||
amount: amount_to_pay,
|
amount: amount_to_pay,
|
||||||
currency: conference.tickets.first.price_currency
|
currency: conference.tickets.first.price_currency
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
:javascript
|
:javascript
|
||||||
$(function () {
|
$(function () {
|
||||||
$('#users.datatable').DataTable({
|
$('#users.datatable').DataTable({
|
||||||
|
"buttons": { buttons: ["csv"] },
|
||||||
"processing": true,
|
"processing": true,
|
||||||
"serverSide": true,
|
"serverSide": true,
|
||||||
"ajax": $('#users.datatable').data('source'),
|
"ajax": $('#users.datatable').data('source'),
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,17 @@
|
||||||
.text-muted
|
.text-muted
|
||||||
Your tickets for the conference
|
Your tickets for the conference
|
||||||
|
|
||||||
- if !@conference.user_registered?(@user)
|
-# TODO: And if they have a registration ticket?
|
||||||
.row
|
- if !@conference.user_registered?(@user) && @has_registration_ticket
|
||||||
.col-md-12
|
.col-md-12
|
||||||
|
.alert.alert-success{role: 'alert'}
|
||||||
|
= link_to 'Complete Registration',
|
||||||
|
new_conference_conference_registration_path(@conference),
|
||||||
|
class: 'btn btn-info pull-right btn-lg'
|
||||||
|
%h3
|
||||||
|
🎉 Thanks for getting a #{@conference.title} ticket! One last step...
|
||||||
%strong
|
%strong
|
||||||
You are not yet registered for the conference.
|
You are not yet registered for the conference.
|
||||||
= link_to 'Complete Registration',
|
|
||||||
conference_conference_registration_path(@conference),
|
|
||||||
class: 'btn btn-success pull-right'
|
|
||||||
|
|
||||||
.col-md-12
|
.col-md-12
|
||||||
- if @physical_tickets.present?
|
- if @physical_tickets.present?
|
||||||
|
|
|
||||||
46
lib/tasks/registrations.rake
Normal file
46
lib/tasks/registrations.rake
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
namespace :registrations do
|
||||||
|
desc "Create missing registrations for those how have a registration ticket."
|
||||||
|
task :create_missing, [:conference] => :environment do |t, args|
|
||||||
|
|
||||||
|
fail 'Please supply a conference short name.' unless args.conference
|
||||||
|
|
||||||
|
conf = Conference.find_by(short_title: args.conference)
|
||||||
|
# Check if a user is found based on the supplied email address
|
||||||
|
fail "Coud not find conference #{args.conference}" unless conf
|
||||||
|
|
||||||
|
purchases = conf.ticket_purchases.where(ticket: conf.registration_tickets, paid: true)
|
||||||
|
unregistered = purchases.select { |tp| !conf.user_registered?(tp.user) }
|
||||||
|
puts "Found #{unregistered.count} unregistered users for #{purchases.count} ticket purchases."
|
||||||
|
puts "There are currently #{conf.participants.count} registered users."
|
||||||
|
|
||||||
|
unregistered.each do |tp|
|
||||||
|
puts "Creating registration for #{tp.user.email}"
|
||||||
|
Registration.create(user: tp.user, conference: conf)
|
||||||
|
end
|
||||||
|
puts "Done."
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Show User emails who have not paid, but did register"
|
||||||
|
task :list_unpaid, [:conference] => :environment do |t, args|
|
||||||
|
|
||||||
|
fail 'Please supply a conference short name.' unless args.conference
|
||||||
|
|
||||||
|
conf = Conference.find_by(short_title: args.conference)
|
||||||
|
# Check if a user is found based on the supplied email address
|
||||||
|
fail "Coud not find conference #{args.conference}" unless conf
|
||||||
|
|
||||||
|
registered = conf.participants
|
||||||
|
unpaid = registered.select do |user|
|
||||||
|
TicketPurchase.where(conference: conf, paid: true, user: user).empty?
|
||||||
|
end
|
||||||
|
puts "Found #{registered.count} registered users and #{unpaid.count} unpaid attendees."
|
||||||
|
puts
|
||||||
|
|
||||||
|
unpaid.each do |user|
|
||||||
|
puts "'#{user.name}',#{user.email}"
|
||||||
|
end
|
||||||
|
puts ""
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Add table
Add a link
Reference in a new issue