mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Merge branch 'master' into currency_chf
This commit is contained in:
commit
caf2215f5b
41 changed files with 199 additions and 69 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -38,3 +38,5 @@ pickle-email-*.html
|
|||
.env.local
|
||||
docker-compose.env
|
||||
docker-compose.yml
|
||||
.DS_Store
|
||||
.byebug_history
|
||||
|
|
|
|||
5
Gemfile
5
Gemfile
|
|
@ -200,6 +200,11 @@ gem 'sprockets-rails'
|
|||
# for multiple speakers select on proposal/event forms
|
||||
gem 'selectize-rails'
|
||||
|
||||
# Nokogiri < 1.8.1 is subject to:
|
||||
# CVE-2017-0663, CVE-2017-7375, CVE-2017-7376, CVE-2017-9047, CVE-2017-9048,
|
||||
# CVE-2017-9049, CVE-2017-9050
|
||||
gem 'nokogiri', '>= 1.8.1'
|
||||
|
||||
# Use guard and spring for testing in development
|
||||
group :development do
|
||||
# to launch specs when files are modified
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ GEM
|
|||
open4 (~> 1.3.4)
|
||||
rake
|
||||
mini_magick (4.5.1)
|
||||
mini_portile2 (2.2.0)
|
||||
mini_portile2 (2.3.0)
|
||||
minitest (5.10.2)
|
||||
momentjs-rails (2.8.1)
|
||||
railties (>= 3.1)
|
||||
|
|
@ -290,8 +290,8 @@ GEM
|
|||
mysql2 (0.4.9)
|
||||
nenv (0.3.0)
|
||||
netrc (0.11.0)
|
||||
nokogiri (1.8.0)
|
||||
mini_portile2 (~> 2.2.0)
|
||||
nokogiri (1.8.1)
|
||||
mini_portile2 (~> 2.3.0)
|
||||
notiffany (0.1.1)
|
||||
nenv (~> 0.1)
|
||||
shellany (~> 0.0)
|
||||
|
|
@ -609,6 +609,7 @@ DEPENDENCIES
|
|||
mini_magick
|
||||
money-rails
|
||||
mysql2
|
||||
nokogiri (>= 1.8.1)
|
||||
omniauth
|
||||
omniauth-facebook
|
||||
omniauth-github
|
||||
|
|
@ -662,4 +663,4 @@ DEPENDENCIES
|
|||
whenever
|
||||
|
||||
BUNDLED WITH
|
||||
1.15.1
|
||||
1.15.4
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ function update_price($this){
|
|||
// Calculate price for row
|
||||
var value = $this.val();
|
||||
var price = $('#price_' + id).text();
|
||||
$('#total_row_' + id).text(value * price);
|
||||
$('#total_row_' + id).text((value * price).toFixed(2));
|
||||
|
||||
// Calculate total price
|
||||
var total = 0;
|
||||
$('.total_row').each(function( index ) {
|
||||
total += parseInt($(this).text());
|
||||
total += parseFloat($(this).text());
|
||||
});
|
||||
$('#total_price').text(total);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
module Admin
|
||||
class PhysicalTicketController < Admin::BaseController
|
||||
class PhysicalTicketsController < Admin::BaseController
|
||||
before_action :authenticate_user!
|
||||
load_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource
|
||||
|
|
@ -10,6 +10,9 @@ class PaymentsController < ApplicationController
|
|||
|
||||
def new
|
||||
@total_amount_to_pay = Ticket.total_price(@conference, current_user, paid: false)
|
||||
if @total_amount_to_pay.zero?
|
||||
raise CanCan::AccessDenied.new('Nothing to pay for!', :new, Payment)
|
||||
end
|
||||
@unpaid_ticket_purchases = current_user.ticket_purchases.unpaid.by_conference(@conference)
|
||||
end
|
||||
|
||||
|
|
@ -18,7 +21,7 @@ class PaymentsController < ApplicationController
|
|||
|
||||
if @payment.purchase && @payment.save
|
||||
update_purchased_ticket_purchases
|
||||
redirect_to conference_physical_ticket_index_path,
|
||||
redirect_to conference_physical_tickets_path,
|
||||
notice: 'Thanks! Your ticket is booked successfully.'
|
||||
else
|
||||
@total_amount_to_pay = Ticket.total_price(@conference, current_user, paid: false)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class PhysicalTicketController < ApplicationController
|
||||
class PhysicalTicketsController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
load_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource find_by: :token
|
||||
|
|
@ -21,10 +21,10 @@ class SchedulesController < ApplicationController
|
|||
# the schedule takes you to today if it is a date of the schedule
|
||||
@current_day = @conference.current_conference_day
|
||||
@day = @current_day.present? ? @current_day : @dates.first
|
||||
return unless @current_day
|
||||
# the schedule takes you to the current time if it is beetween the start and the end time.
|
||||
@hour_column = @conference.hours_from_start_time(@conf_start, @conference.end_hour)
|
||||
|
||||
unless @current_day
|
||||
# the schedule takes you to the current time if it is beetween the start and the end time.
|
||||
@hour_column = @conference.hours_from_start_time(@conf_start, @conference.end_hour)
|
||||
end
|
||||
# Ids of the schedules of confrmed self_organized tracks along with the selected_schedule_id
|
||||
@selected_schedules_ids = [@conference.program.selected_schedule_id]
|
||||
@conference.program.tracks.self_organized.confirmed.each do |track|
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class TicketPurchasesController < ApplicationController
|
|||
redirect_to new_conference_payment_path,
|
||||
notice: 'Please pay here to get tickets.'
|
||||
elsif current_user.ticket_purchases.by_conference(@conference).paid.any?
|
||||
redirect_to conference_physical_ticket_index_path,
|
||||
redirect_to conference_physical_tickets_path,
|
||||
notice: 'You have free tickets for the conference.'
|
||||
else
|
||||
redirect_to conference_tickets_path(@conference.short_title),
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@ module Users
|
|||
|
||||
def handle(provider)
|
||||
auth_hash = request.env['omniauth.auth']
|
||||
uid = auth_hash[:uid]
|
||||
username = auth_hash.info.email.split('@')[0]
|
||||
openid = Openid.find_for_oauth(auth_hash) # Get or create openid
|
||||
# If openid exists and is associated with a user, sign in with associated user,
|
||||
# even if the email of the associated user and the email of the provided openid are different
|
||||
unless (user = openid.user)
|
||||
user = User.find_for_auth(auth_hash, current_user) # Get or create users
|
||||
user.username = "#{uid}@#{provider}" if user.username.blank?
|
||||
user.username = "#{username}@#{provider}" if user.username.blank?
|
||||
end
|
||||
|
||||
begin
|
||||
|
|
|
|||
|
|
@ -1,3 +1,13 @@
|
|||
class TicketScanning < ActiveRecord::Base
|
||||
belongs_to :physical_ticket
|
||||
|
||||
before_create :mark_user_present
|
||||
|
||||
private
|
||||
|
||||
def mark_user_present
|
||||
if physical_ticket.ticket.registration_ticket?
|
||||
physical_ticket.user.mark_attendance_for_conference(physical_ticket.conference)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -47,7 +47,11 @@ class User < ActiveRecord::Base
|
|||
has_many :event_users, dependent: :destroy
|
||||
has_many :events, -> { uniq }, through: :event_users
|
||||
has_many :presented_events, -> { joins(:event_users).where(event_users: {event_role: 'speaker'}).uniq }, through: :event_users, source: :event
|
||||
has_many :registrations, dependent: :destroy
|
||||
has_many :registrations, dependent: :destroy do
|
||||
def for_conference conference
|
||||
where(conference: conference).first
|
||||
end
|
||||
end
|
||||
has_many :events_registrations, through: :registrations
|
||||
has_many :ticket_purchases, dependent: :destroy
|
||||
has_many :payments, dependent: :destroy
|
||||
|
|
@ -93,6 +97,12 @@ class User < ActiveRecord::Base
|
|||
event_registration.attended
|
||||
end
|
||||
|
||||
def mark_attendance_for_conference conference
|
||||
registration = registrations.for_conference(conference)
|
||||
registration.attended = true
|
||||
registration.save
|
||||
end
|
||||
|
||||
def name
|
||||
self[:name].blank? ? username : self[:name]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -25,20 +25,23 @@ class TicketPdf < Prawn::Document
|
|||
move_up @mid_vertical
|
||||
draw_text 'TICKET HOLDER', at: [@x, cursor - 30], size: 17
|
||||
dash(2, space: 0)
|
||||
stroke_rectangle [@x, cursor - 50], 230, 150
|
||||
move_down 80
|
||||
draw_text 'NAME', at: [@x + 10, cursor], size: 13
|
||||
fill_color '808080'
|
||||
draw_text @user.name.to_s, at: [@x + 10, cursor - 25], size: 20
|
||||
fill_color '000000'
|
||||
draw_text 'EMAIL', at: [@x + 10, cursor - 50], size: 13
|
||||
fill_color '808080'
|
||||
draw_text @user.email.to_s, at: [@x + 10, cursor - 75], size: 20
|
||||
fill_color '000000'
|
||||
move_up 20
|
||||
bounding_box [@x, cursor - 50], width: 230, height: 150 do
|
||||
pad(15) do
|
||||
text_box 'NAME', at: [@x + 10, cursor], size: 13
|
||||
fill_color '808080'
|
||||
text_box @user.name.to_s, at: [@x + 10, cursor - 20], size: 18
|
||||
fill_color '000000'
|
||||
text_box 'EMAIL', at: [@x + 10, cursor - 60], size: 13
|
||||
fill_color '808080'
|
||||
text_box @user.email.to_s, at: [@x + 10, cursor - 80], size: 18, overflow: :shrink_to_fit
|
||||
fill_color '000000'
|
||||
end
|
||||
stroke_bounds
|
||||
end
|
||||
end
|
||||
|
||||
def draw_second_square
|
||||
move_up 150
|
||||
if @conference.picture?
|
||||
if 7 * @conference.picture.image[:width] > 12 * @conference.picture.image[:height]
|
||||
image "#{Rails.root}/public#{@conference.picture_url}", at: [@mid_horizontal + 30, cursor], width: 120
|
||||
|
|
@ -51,7 +54,11 @@ class TicketPdf < Prawn::Document
|
|||
move_down 70
|
||||
draw_text @conference.title.to_s, at: [@mid_horizontal + 30, cursor - 30], size: 12
|
||||
draw_text @conference.organization.name.to_s, at: [@mid_horizontal + 30, cursor - 50], size: 12
|
||||
draw_text @conference.venue.name.to_s, at: [@mid_horizontal + 30, cursor - 70]
|
||||
if @conference.venue
|
||||
draw_text @conference.venue.name, at: [@mid_horizontal + 30, cursor - 70]
|
||||
draw_text @conference.venue.street, at: [@mid_horizontal + 30, cursor - 90]
|
||||
draw_text @conference.venue.city, at: [@mid_horizontal + 30, cursor - 110]
|
||||
end
|
||||
move_up 130
|
||||
move_down @mid_vertical
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,12 +1,16 @@
|
|||
%dt
|
||||
Start Date
|
||||
Type:
|
||||
%dd
|
||||
= @cfp.cfp_type.capitalize
|
||||
%dt
|
||||
Start Date:
|
||||
%dd
|
||||
= @cfp.start_date.strftime('%A, %B %e. %Y')
|
||||
%dt
|
||||
End Date
|
||||
End Date:
|
||||
%dd
|
||||
= @cfp.end_date.strftime('%A, %B %e. %Y')
|
||||
%dt
|
||||
Days Left
|
||||
Days Left:
|
||||
%dd
|
||||
= pluralize(@cfp.remaining_days, 'day')
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
%dt
|
||||
Type:
|
||||
%dd
|
||||
= @cfp.cfp_type.capitalize
|
||||
%dt
|
||||
Start Date:
|
||||
%dd#start_date
|
||||
|
|
@ -19,7 +23,7 @@
|
|||
%dd
|
||||
= tracks(@conference)
|
||||
%dt
|
||||
Public Schedule
|
||||
Public Schedule:
|
||||
%dd#schedule_public
|
||||
- if @program.schedule_public
|
||||
Yes
|
||||
|
|
@ -33,6 +37,6 @@
|
|||
- else
|
||||
No
|
||||
%dt
|
||||
Rating Levels
|
||||
Rating Levels:
|
||||
%dd#rating
|
||||
= @program.rating
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
%dt
|
||||
Type:
|
||||
%dd
|
||||
= @cfp.cfp_type.capitalize
|
||||
%dt
|
||||
Start Date:
|
||||
%dd#start_date
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@
|
|||
%div
|
||||
%a.pull-right.comment-reply-link{ href: '#' } Reply
|
||||
.comment-reply
|
||||
= semantic_form_for :comment, url: '#{comment_admin_conference_program_event_path(@conference.short_title, comment.commentable_id)}', method: :post do |f|
|
||||
= semantic_form_for :comment, url: comment_admin_conference_program_event_path(@conference.short_title, comment.commentable_id), method: :post do |f|
|
||||
= f.input :body
|
||||
%input{ name: 'parent', type: 'hidden', value: '#{comment.id}' }
|
||||
%input{ name: 'parent', type: 'hidden', value: comment.id }
|
||||
%input{ name: 'authenticity_token', type: 'hidden', value: '#{form_authenticity_token}' }
|
||||
%button.btn.btn-primary.pull-right{ name: 'button', type: 'submit' } Add Reply
|
||||
- comment.children.each do |child|
|
||||
|
|
|
|||
|
|
@ -9,13 +9,14 @@
|
|||
=link_to 'Add Event', new_admin_conference_program_event_path(@conference.short_title), class: 'button btn btn-default btn-info'
|
||||
- if can? :read, Event
|
||||
.btn-group
|
||||
%button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' }
|
||||
Export PDF
|
||||
%span.caret
|
||||
%ul.dropdown-menu{ role: 'menu' }
|
||||
%li= link_to 'All Events', admin_conference_program_events_path(@conference.short_title, format: :pdf, event_export_option: 'all')
|
||||
%li= link_to 'Confirmed Events', admin_conference_program_events_path(@conference.short_title, format: :pdf, event_export_option: 'confirmed')
|
||||
%li= link_to 'All Events with Comments', admin_conference_program_events_path(@conference.short_title, format: :pdf, event_export_option: 'all_with_comments')
|
||||
.btn-group
|
||||
%button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' }
|
||||
Export PDF
|
||||
%span.caret
|
||||
%ul.dropdown-menu{ role: 'menu' }
|
||||
%li= link_to 'All Events', admin_conference_program_events_path(@conference.short_title, format: :pdf, event_export_option: 'all')
|
||||
%li= link_to 'Confirmed Events', admin_conference_program_events_path(@conference.short_title, format: :pdf, event_export_option: 'confirmed')
|
||||
%li= link_to 'All Events with Comments', admin_conference_program_events_path(@conference.short_title, format: :pdf, event_export_option: 'all_with_comments')
|
||||
.btn-group
|
||||
%button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' }
|
||||
Export CSV
|
||||
|
|
|
|||
|
|
@ -40,11 +40,23 @@
|
|||
.tab-pane{ class: "#{ (@dates.first == date) ? 'active' : '' }", id: "#{date}" }
|
||||
= render partial: 'day_tab', locals: { date: date }
|
||||
- else
|
||||
.h3
|
||||
No Rooms!
|
||||
%small
|
||||
= link_to 'Create rooms', admin_conference_venue_rooms_path
|
||||
before creating the schedule.
|
||||
- if @venue.try(:rooms).present?
|
||||
.text-right
|
||||
- if can? :create, @program.schedules.new
|
||||
= link_to 'Add Schedule', admin_conference_schedules_path(@conference.short_title),
|
||||
method: :post, class: 'btn btn-primary'
|
||||
- elsif @venue
|
||||
.h3
|
||||
No Rooms!
|
||||
%small
|
||||
= link_to 'Create rooms', admin_conference_venue_rooms_path
|
||||
before creating the schedule.
|
||||
- else
|
||||
.h3
|
||||
No Venue!
|
||||
%small
|
||||
= link_to 'Create a venue with rooms', new_admin_conference_venue_path
|
||||
before creating the schedule.
|
||||
|
||||
:javascript
|
||||
$(document).ready( function() {
|
||||
|
|
|
|||
|
|
@ -40,4 +40,4 @@
|
|||
.row
|
||||
.col-md-12
|
||||
= link_to 'Add Ticket', new_admin_conference_ticket_path, class: 'btn btn-success pull-right'
|
||||
= link_to 'Tickets Sold', admin_conference_physical_ticket_index_path, class: 'button btn btn-default btn-info pull-right'
|
||||
= link_to 'Tickets Sold', admin_conference_physical_tickets_path, class: 'button btn btn-default btn-info pull-right'
|
||||
|
|
|
|||
|
|
@ -15,6 +15,12 @@
|
|||
= semantic_form_for(@venue, url: admin_conference_venue_path(@conference.short_title)) do |f|
|
||||
= f.inputs :name, :website
|
||||
= f.input :description, input_html: { rows: 5, cols: 20, data: { provide: 'markdown-editable' } }, hint: markdown_hint
|
||||
= f.label 'Venue Logo'
|
||||
%br
|
||||
- if @venue.picture?
|
||||
= image_tag @venue.picture.thumb.url
|
||||
= f.input :picture, label: false, hint: 'This will be displayed on the venue are of the splash page.'
|
||||
= f.hidden_field :picture_cache
|
||||
= f.inputs :street, :postalcode, :city, :country, :latitude, :longitude
|
||||
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
- else
|
||||
- conference = Conference.find_by(id: version.conference_id)
|
||||
- conference_short_title = conference.try(:short_title) || current_or_last_object_state('Conference', version.conference_id).try(:short_title) || ' '
|
||||
= link_if_alive version, role.try(:name), admin_conference_role_path(role.try(:name) || ' ', conference_short_title), conference
|
||||
= link_if_alive version, role.try(:name), admin_conference_role_path(conference_short_title,role.try(:name) || ' '), conference
|
||||
|
||||
= version.event == 'create' ? 'to' : 'from'
|
||||
user
|
||||
|
|
|
|||
|
|
@ -47,4 +47,4 @@
|
|||
- else
|
||||
= link_to 'Unsubscribe', conference_subscriptions_path(conference.short_title), method: :delete, class: 'btn btn-default'
|
||||
- if current_user && current_user.physical_tickets.by_conference(conference).any?
|
||||
= link_to "My Tickets", conference_physical_ticket_index_path(conference.short_title), class: 'btn btn-default'
|
||||
= link_to "My Tickets", conference_physical_tickets_path(conference.short_title), class: 'btn btn-default'
|
||||
|
|
|
|||
|
|
@ -32,4 +32,4 @@
|
|||
= @conference.venue.country_name
|
||||
- if @conference.venue.website
|
||||
%br
|
||||
=link_to @conference.venue.website, @conference.venue.website
|
||||
=link_to(h(@conference.venue.website), h(@conference.venue.website)).html_safe
|
||||
|
|
|
|||
|
|
@ -1,17 +1,16 @@
|
|||
#map{style: "height: 500px;" }
|
||||
- popup = "<h3>#{@conference.venue.name}</h3><br>#{@conference.venue.street}<br>#{@conference.venue.city}<br>#{@conference.venue.country_name}"
|
||||
- content_for(:script_body) do
|
||||
:javascript
|
||||
// create a map in the "map" div, set the view to a given place and zoom
|
||||
var map = L.map('map', { scrollWheelZoom: false }).setView([#{@conference.venue.latitude}, #{@conference.venue.longitude}], 11);
|
||||
var map = L.map('map', { scrollWheelZoom: false }).setView([#{h(@conference.venue.latitude)}, #{h(@conference.venue.longitude)}], 11);
|
||||
// add an OpenStreetMap tile layer
|
||||
L.tileLayer('//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>',
|
||||
maxZoom: 18
|
||||
}).addTo(map);
|
||||
// add a marker in the given location, attach some popup content to it and open the popup
|
||||
L.marker([#{@conference.venue.latitude}, #{@conference.venue.longitude}]).addTo(map)
|
||||
.bindPopup("#{popup}")
|
||||
L.marker([#{h @conference.venue.latitude}, #{h @conference.venue.longitude}]).addTo(map)
|
||||
.bindPopup("#{escape_javascript(render '/conferences/venue_map_marker', venue: @conference.venue)}")
|
||||
.openPopup();
|
||||
// Turn scrollwheel on when user clicks
|
||||
map.on('focus', function(e) {
|
||||
|
|
|
|||
13
app/views/conferences/_venue_map_marker.html.haml
Normal file
13
app/views/conferences/_venue_map_marker.html.haml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
- if venue.picture?
|
||||
= image_tag venue.picture.thumb.url,
|
||||
alt: venue.name,
|
||||
class: 'img-responsive pull-right'
|
||||
%h3= venue.name
|
||||
%p
|
||||
= venue.street
|
||||
%br
|
||||
= venue.city
|
||||
%br
|
||||
= venue.country_name
|
||||
- if venue.website
|
||||
%p.text-center.clearfix= sanitize(link_to venue.website, venue.website)
|
||||
|
|
@ -82,7 +82,7 @@
|
|||
|
||||
- content_for :script_head do
|
||||
:javascript
|
||||
var triangle_tcs = tinycolor("#{@conference.color}").monochromatic();
|
||||
var triangle_tcs = tinycolor("#{h(@conference.color)}").monochromatic();
|
||||
var triangle_colors = triangle_tcs.map(function(t) { return t.toHexString(); });
|
||||
$(function () {
|
||||
$(document).ready(function() {
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
%p
|
||||
Knowing the number of visitors for the conference helps the organizers plan better.
|
||||
|
||||
%table.table.table-striped
|
||||
%table.table.table-striped#events
|
||||
- @events.each do |event|
|
||||
%tr
|
||||
%td{style: "padding:20px 8px 20px 8px;"}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ Osem::Application.routes.draw do
|
|||
resources :targets, except: [:show]
|
||||
resources :campaigns, except: [:show]
|
||||
resources :emails, only: [:show, :update, :index]
|
||||
resources :physical_ticket, only: [:index]
|
||||
resources :physical_tickets, only: [:index]
|
||||
resources :roles, except: [:new, :create] do
|
||||
member do
|
||||
post :toggle_user
|
||||
|
|
@ -184,7 +184,7 @@ Osem::Application.routes.draw do
|
|||
resources :tickets, only: [:index]
|
||||
resources :ticket_purchases, only: [:create, :destroy, :index]
|
||||
resources :payments, only: [:index, :new, :create]
|
||||
resources :physical_ticket, only: [:index, :show]
|
||||
resources :physical_tickets, only: [:index, :show]
|
||||
resource :subscriptions, only: [:create, :destroy]
|
||||
resource :schedule, only: [:show] do
|
||||
member do
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ describe Admin::TicketScanningsController do
|
|||
let(:admin) { create(:admin) }
|
||||
let(:conference) { create(:conference) }
|
||||
let(:user) { create(:user) }
|
||||
let(:paid_ticket_purchase) { create(:ticket_purchase, conference: conference, user: user) }
|
||||
let!(:registration) { create(:registration, conference: conference, user: user) }
|
||||
let(:registration_ticket) { create(:registration_ticket, conference: conference) }
|
||||
let(:paid_ticket_purchase) { create(:ticket_purchase, conference: conference, user: user, ticket: registration_ticket, quantity: 1) }
|
||||
let(:physical_ticket) { create(:physical_ticket, ticket_purchase: paid_ticket_purchase) }
|
||||
|
||||
context 'logged in as user with no role' do
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe PhysicalTicketController do
|
||||
describe PhysicalTicketsController do
|
||||
let(:conference) { create(:conference) }
|
||||
let(:user) { create(:user) }
|
||||
let(:paid_ticket_purchase) { create(:ticket_purchase, conference: conference, user: user) }
|
||||
|
|
|
|||
5
spec/factories/ticket_scanning.rb
Normal file
5
spec/factories/ticket_scanning.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
FactoryGirl.define do
|
||||
factory :ticket_scanning do
|
||||
physical_ticket
|
||||
end
|
||||
end
|
||||
|
|
@ -36,7 +36,14 @@ feature Sponsor do
|
|||
end
|
||||
|
||||
# Remove sponsor
|
||||
click_link 'Delete'
|
||||
visit admin_conference_sponsors_path(
|
||||
conference_id: conference.short_title
|
||||
)
|
||||
within('table#sponsors') do
|
||||
page.accept_confirm do
|
||||
click_link 'Delete'
|
||||
end
|
||||
end
|
||||
expect(flash).to eq('Sponsor successfully deleted.')
|
||||
expect(page).to_not have_selector('table#sponsors')
|
||||
end
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ feature Registration do
|
|||
|
||||
click_button 'Continue'
|
||||
|
||||
expect(current_path).to eq(conference_physical_ticket_index_path(conference.short_title))
|
||||
expect(current_path).to eq(conference_physical_tickets_path(conference.short_title))
|
||||
purchase = TicketPurchase.where(user_id: participant.id, ticket_id: free_ticket.id).first
|
||||
expect(purchase.quantity).to eq(5)
|
||||
expect(purchase.paid).to be true
|
||||
|
|
|
|||
|
|
@ -36,8 +36,11 @@ feature Track do
|
|||
|
||||
expected = expect do
|
||||
visit admin_conference_program_tracks_path(conference_id: conference.short_title)
|
||||
|
||||
click_link 'Delete'
|
||||
within('#tracks', visible: true) do
|
||||
page.accept_confirm do
|
||||
find_link('Delete').click
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
expected.to change { Track.count }.by(-1)
|
||||
|
|
@ -53,7 +56,9 @@ feature Track do
|
|||
|
||||
expected = expect do
|
||||
visit admin_conference_program_tracks_path(conference_id: conference.short_title)
|
||||
click_link 'Edit'
|
||||
within('#tracks', visible: true) do
|
||||
find_link('Edit').trigger('click')
|
||||
end
|
||||
|
||||
fill_in 'track_name', with: 'Distribution'
|
||||
fill_in 'track_short_name', with: 'Distribution'
|
||||
|
|
|
|||
|
|
@ -193,7 +193,9 @@ feature 'Version' do
|
|||
click_link 'Reject event'
|
||||
|
||||
visit conference_program_proposals_path(conference_id: conference.short_title)
|
||||
click_link 'Re-Submit'
|
||||
within('#events') do
|
||||
click_link 'Re-Submit'
|
||||
end
|
||||
|
||||
visit admin_conference_program_events_path(conference.short_title)
|
||||
click_button 'New'
|
||||
|
|
|
|||
20
spec/models/ticket_scanning_spec.rb
Normal file
20
spec/models/ticket_scanning_spec.rb
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe TicketScanning do
|
||||
let(:conference) { create(:conference) }
|
||||
let(:user) { create(:user) }
|
||||
let(:registration) { create(:registration, conference: conference, user: user) }
|
||||
let(:registration_ticket) { create(:registration_ticket, conference: conference) }
|
||||
let(:paid_ticket_purchase) { create(:ticket_purchase, conference: conference, user: user, ticket: registration_ticket, quantity: 1) }
|
||||
let(:physical_ticket) { create(:physical_ticket, ticket_purchase: paid_ticket_purchase) }
|
||||
let(:ticket_scanning) { create(:ticket_scanning, physical_ticket: physical_ticket) }
|
||||
|
||||
describe 'before_create' do
|
||||
it 'marks user as present' do
|
||||
expect(registration.attended).to eq(false)
|
||||
ticket_scanning
|
||||
registration.reload
|
||||
expect(registration.attended).to eq(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -59,7 +59,7 @@ RSpec.configure do |config|
|
|||
Capybara.javascript_driver = :poltergeist
|
||||
|
||||
Capybara.register_driver :poltergeist do |app|
|
||||
Capybara::Poltergeist::Driver.new(app, phantomjs: Phantomjs.path, js_errors: false)
|
||||
Capybara::Poltergeist::Driver.new(app, phantomjs: Phantomjs.path, js_errors: false, window_size: [1920, 1080])
|
||||
end
|
||||
|
||||
# Includes helpers and connect them to specific types of tests
|
||||
|
|
@ -82,6 +82,14 @@ RSpec.configure do |config|
|
|||
# Types of tests (controller, feature, model) will
|
||||
# be inferred from subfolder name
|
||||
config.infer_spec_type_from_file_location!
|
||||
|
||||
# Enable this if you like to see what you're debugging
|
||||
# config.after(:example) do |example|
|
||||
# if example.exception
|
||||
# save_and_open_screenshot
|
||||
# save_and_open_page
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
OmniAuth.config.test_mode = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue