User/Person models merge
This commit is contained in:
parent
66b84e3660
commit
23bf55b66c
80 changed files with 1064 additions and 1221 deletions
|
|
@ -1,198 +1,200 @@
|
||||||
class Admin::EventsController < ApplicationController
|
module Admin
|
||||||
before_filter :verify_organizer
|
class EventsController < ApplicationController
|
||||||
|
before_filter :verify_organizer
|
||||||
|
|
||||||
# FIXME: The timezome should only be applied on output, otherwise
|
# FIXME: The timezome should only be applied on output, otherwise
|
||||||
# you get lost in timezone conversions...
|
# you get lost in timezone conversions...
|
||||||
# around_filter :set_timezone_for_this_request
|
# around_filter :set_timezone_for_this_request
|
||||||
|
|
||||||
def set_timezone_for_this_request(&block)
|
def set_timezone_for_this_request(&block)
|
||||||
Time.use_zone(@conference.timezone, &block)
|
Time.use_zone(@conference.timezone, &block)
|
||||||
end
|
|
||||||
|
|
||||||
def index
|
|
||||||
@events = @conference.events
|
|
||||||
@tracks = @conference.tracks
|
|
||||||
@machine_states = @events.state_machine.states.map
|
|
||||||
@event_types = @conference.event_types
|
|
||||||
|
|
||||||
@mystates = []
|
|
||||||
@mytypes = []
|
|
||||||
@eventstats = Hash.new
|
|
||||||
statelength = 0
|
|
||||||
@totallength = 0
|
|
||||||
|
|
||||||
@machine_states.each do |mystate|
|
|
||||||
length = 0
|
|
||||||
events_mystate= @events.where("state" => mystate.name)
|
|
||||||
if events_mystate.count > 0
|
|
||||||
@mystates << mystate
|
|
||||||
events_mystate.each do |myevent|
|
|
||||||
length += myevent.event_type.length
|
|
||||||
end
|
|
||||||
@eventstats["#{mystate.name}"] = {"count" => events_mystate.count, "length" => length}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@event_types.each do |mytype|
|
def index
|
||||||
events_mytype = @events.where("event_type_id" => mytype.id)
|
@events = @conference.events
|
||||||
if events_mytype.count > 0
|
@tracks = @conference.tracks
|
||||||
@mytypes << mytype
|
@machine_states = @events.state_machine.states.map
|
||||||
end
|
@event_types = @conference.event_types
|
||||||
end
|
|
||||||
@mytypes.each do |mytype|
|
@mystates = []
|
||||||
@mystates.each do |mystate|
|
@mytypes = []
|
||||||
events_mytype = @events.where("event_type_id" => mytype.id)
|
@eventstats = Hash.new
|
||||||
events_mytype_mystate= events_mytype.where("state" => mystate.name)
|
@totallength = 0
|
||||||
typelength = 0
|
|
||||||
if events_mytype_mystate.count > 0
|
@machine_states.each do |mystate|
|
||||||
events_mytype_mystate.each do |myevent|
|
length = 0
|
||||||
typelength += myevent.event_type.length
|
events_mystate = @events.where('state' => mystate.name)
|
||||||
@totallength += myevent.event_type.length
|
if events_mystate.count > 0
|
||||||
|
@mystates << mystate
|
||||||
|
events_mystate.each do |myevent|
|
||||||
|
length += myevent.event_type.length
|
||||||
end
|
end
|
||||||
@eventstats[mytype.title] = {"count" => events_mytype.count, "length" => events_mytype.count * mytype.length} if @eventstats[mytype.title] == nil
|
@eventstats["#{mystate.name}"] = { 'count' => events_mystate.count, 'length' => length }
|
||||||
tmp = {"#{mystate.name}" => {"type_state_count" => events_mytype_mystate.count, "type_state_length" => typelength}}
|
|
||||||
@eventstats[mytype.title].merge!(tmp)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
@eventstats["totallength"] = @totallength
|
|
||||||
|
|
||||||
respond_to do |format|
|
@event_types.each do |mytype|
|
||||||
format.html
|
events_mytype = @events.where('event_type_id' => mytype.id)
|
||||||
# Explicity call #to_json to avoid the use of EventSerializer
|
if events_mytype.count > 0
|
||||||
format.json { render :json => Event.where(:state => :confirmed).to_json }
|
@mytypes << mytype
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def show
|
|
||||||
@event = @conference.events.find(params[:id])
|
|
||||||
@tracks = @conference.tracks
|
|
||||||
@event_types = @conference.event_types
|
|
||||||
@comments = @event.root_comments
|
|
||||||
@comment_count = @event.comment_threads.count
|
|
||||||
@ratings = @event.votes.includes(:person)
|
|
||||||
@difficulty_levels = @conference.difficulty_levels
|
|
||||||
end
|
|
||||||
|
|
||||||
def edit
|
|
||||||
@event = @conference.events.find(params[:id])
|
|
||||||
@event_types = @conference.event_types
|
|
||||||
@tracks = Track.all
|
|
||||||
@comments = @event.root_comments
|
|
||||||
@comment_count = @event.comment_threads.count
|
|
||||||
@person = @event.submitter
|
|
||||||
@url = admin_conference_event_path(@conference.short_title, @event)
|
|
||||||
end
|
|
||||||
|
|
||||||
def comment
|
|
||||||
event = @conference.events.find_by_id(params[:id])
|
|
||||||
comment = Comment.build_from(event, current_user.id, params[:comment])
|
|
||||||
comment.save!
|
|
||||||
if !params[:parent].nil?
|
|
||||||
comment.move_to_child_of(params[:parent])
|
|
||||||
end
|
|
||||||
|
|
||||||
redirect_to admin_conference_event_path(:conference_id => @conference.short_title)
|
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
|
||||||
@event = Event.find(params[:id])
|
|
||||||
if params.has_key? :track_id
|
|
||||||
@event.update_attribute(:track_id, params[:track_id])
|
|
||||||
end
|
|
||||||
if params.has_key? :event_type_id
|
|
||||||
@event.update_attribute(:event_type_id, params[:event_type_id])
|
|
||||||
end
|
|
||||||
if params.has_key? :difficulty_level_id
|
|
||||||
@event.update_attribute(:difficulty_level_id, params[:difficulty_level_id])
|
|
||||||
end
|
|
||||||
|
|
||||||
if @event.submitter.update_attributes!(params[:person]) && @event.update_attributes!(params[:event])
|
|
||||||
flash[:notice] = "Successfully updated #{@event.title}."
|
|
||||||
else
|
|
||||||
flash[:notice] = "Update not successful."
|
|
||||||
end
|
|
||||||
|
|
||||||
redirect_back_or_to(admin_conference_event_path(@conference.short_title, @event))
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
end
|
|
||||||
|
|
||||||
def accept
|
|
||||||
update_state(params[:id], :accept, 'Event accepted!', true)
|
|
||||||
end
|
|
||||||
|
|
||||||
def confirm
|
|
||||||
update_state(params[:id], :confirm, 'Event confirmed!')
|
|
||||||
end
|
|
||||||
|
|
||||||
def cancel
|
|
||||||
update_state(params[:id], :cancel, 'Event canceled!')
|
|
||||||
end
|
|
||||||
|
|
||||||
def reject
|
|
||||||
update_state(params[:id], :reject, 'Event rejected!', true)
|
|
||||||
end
|
|
||||||
|
|
||||||
def restart
|
|
||||||
update_state(params[:id], :restart, 'Review started!')
|
|
||||||
end
|
|
||||||
|
|
||||||
def vote
|
|
||||||
@event = Event.find(params[:id])
|
|
||||||
@ratings = @event.votes.includes(:person)
|
|
||||||
|
|
||||||
if votes = current_user.person.votes.find_by_event_id(params[:id])
|
|
||||||
votes.update_attributes(:rating => params[:rating])
|
|
||||||
else
|
|
||||||
@myvote = @event.votes.build
|
|
||||||
@myvote.person = current_user.person
|
|
||||||
@myvote.rating = params[:rating]
|
|
||||||
@myvote.save
|
|
||||||
end
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html { redirect_to admin_conference_event_path(@conference.short_title, @event)}
|
|
||||||
format.js
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def update_state(id, transition, notice, mail = false)
|
|
||||||
event = Event.find(id)
|
|
||||||
if mail
|
|
||||||
check_mail_settings(event)
|
|
||||||
end
|
|
||||||
if event
|
|
||||||
begin
|
|
||||||
if mail
|
|
||||||
event.send(transition,
|
|
||||||
send_mail: params[:send_mail])
|
|
||||||
else
|
|
||||||
event.send(transition)
|
|
||||||
end
|
end
|
||||||
event.save
|
|
||||||
rescue Transitions::InvalidTransition => e
|
|
||||||
redirect_to(
|
|
||||||
admin_conference_events_path(conference_id: @conference.short_title),
|
|
||||||
notice: "Update state failed. #{e.message}") && return
|
|
||||||
end
|
end
|
||||||
redirect_to(admin_conference_events_path(conference_id: @conference.short_title),
|
@mytypes.each do |mytype|
|
||||||
notice: notice)
|
@mystates.each do |mystate|
|
||||||
else
|
events_mytype = @events.where('event_type_id' => mytype.id)
|
||||||
redirect_to(admin_conference_events_path(conference_id: @conference.short_title),
|
events_mytype_mystate = events_mytype.where('state' => mystate.name)
|
||||||
notice: 'Error! Could not find event!')
|
typelength = 0
|
||||||
end
|
if events_mytype_mystate.count > 0
|
||||||
end
|
events_mytype_mystate.each do |myevent|
|
||||||
|
typelength += myevent.event_type.length
|
||||||
|
@totallength += myevent.event_type.length
|
||||||
|
end
|
||||||
|
@eventstats[mytype.title] = { 'count' => events_mytype.count, 'length' => events_mytype.count * mytype.length } if @eventstats[mytype.title] == nil
|
||||||
|
tmp = { "#{mystate.name}" => { 'type_state_count' => events_mytype_mystate.count,
|
||||||
|
'type_state_length' => typelength } }
|
||||||
|
@eventstats[mytype.title].merge!(tmp)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@eventstats['totallength'] = @totallength
|
||||||
|
|
||||||
def check_mail_settings(event)
|
respond_to do |format|
|
||||||
if !params[:send_mail].blank? && event &&
|
format.html
|
||||||
event.conference.email_settings.rejected_email_template.nil? &&
|
# Explicity call #to_json to avoid the use of EventSerializer
|
||||||
event.conference.email_settings.accepted_email_template.nil?
|
format.json { render json: Event.where(state: :confirmed).to_json }
|
||||||
redirect_to(admin_conference_events_path(conference_id: @conference.short_title),
|
end
|
||||||
notice: 'Update Email Template before Sending Mails') && return
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@event = @conference.events.find(params[:id])
|
||||||
|
@tracks = @conference.tracks
|
||||||
|
@event_types = @conference.event_types
|
||||||
|
@comments = @event.root_comments
|
||||||
|
@comment_count = @event.comment_threads.count
|
||||||
|
@ratings = @event.votes.includes(:user)
|
||||||
|
@difficulty_levels = @conference.difficulty_levels
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@event = @conference.events.find(params[:id])
|
||||||
|
@event_types = @conference.event_types
|
||||||
|
@tracks = Track.all
|
||||||
|
@comments = @event.root_comments
|
||||||
|
@comment_count = @event.comment_threads.count
|
||||||
|
@user = @event.submitter
|
||||||
|
@url = admin_conference_event_path(@conference.short_title, @event)
|
||||||
|
end
|
||||||
|
|
||||||
|
def comment
|
||||||
|
event = @conference.events.find_by_id(params[:id])
|
||||||
|
comment = Comment.build_from(event, current_user.id, params[:comment])
|
||||||
|
comment.save!
|
||||||
|
if !params[:parent].nil?
|
||||||
|
comment.move_to_child_of(params[:parent])
|
||||||
|
end
|
||||||
|
|
||||||
|
redirect_to admin_conference_event_path(conference_id: @conference.short_title)
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@event = Event.find(params[:id])
|
||||||
|
if params.has_key? :track_id
|
||||||
|
@event.update_attribute(:track_id, params[:track_id])
|
||||||
|
end
|
||||||
|
if params.has_key? :event_type_id
|
||||||
|
@event.update_attribute(:event_type_id, params[:event_type_id])
|
||||||
|
end
|
||||||
|
if params.has_key? :difficulty_level_id
|
||||||
|
@event.update_attribute(:difficulty_level_id, params[:difficulty_level_id])
|
||||||
|
end
|
||||||
|
|
||||||
|
if @event.submitter.update_attributes!(params[:user]) && @event.update_attributes!(params[:event])
|
||||||
|
flash[:notice] = "Successfully updated #{@event.title}."
|
||||||
|
else
|
||||||
|
flash[:notice] = 'Update not successful.'
|
||||||
|
end
|
||||||
|
|
||||||
|
redirect_back_or_to(admin_conference_event_path(@conference.short_title, @event))
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
end
|
||||||
|
|
||||||
|
def accept
|
||||||
|
update_state(params[:id], :accept, 'Event accepted!', true)
|
||||||
|
end
|
||||||
|
|
||||||
|
def confirm
|
||||||
|
update_state(params[:id], :confirm, 'Event confirmed!')
|
||||||
|
end
|
||||||
|
|
||||||
|
def cancel
|
||||||
|
update_state(params[:id], :cancel, 'Event canceled!')
|
||||||
|
end
|
||||||
|
|
||||||
|
def reject
|
||||||
|
update_state(params[:id], :reject, 'Event rejected!', true)
|
||||||
|
end
|
||||||
|
|
||||||
|
def restart
|
||||||
|
update_state(params[:id], :restart, 'Review started!')
|
||||||
|
end
|
||||||
|
|
||||||
|
def vote
|
||||||
|
@event = Event.find(params[:id])
|
||||||
|
@ratings = @event.votes.includes(:user)
|
||||||
|
|
||||||
|
if votes = current_user.votes.find_by_event_id(params[:id])
|
||||||
|
votes.update_attributes(rating: params[:rating])
|
||||||
|
else
|
||||||
|
@myvote = @event.votes.build
|
||||||
|
@myvote.user = current_user
|
||||||
|
@myvote.rating = params[:rating]
|
||||||
|
@myvote.save
|
||||||
|
end
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to admin_conference_event_path(@conference.short_title, @event) }
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def update_state(id, transition, notice, mail = false)
|
||||||
|
event = Event.find(id)
|
||||||
|
if mail
|
||||||
|
check_mail_settings(event)
|
||||||
|
end
|
||||||
|
if event
|
||||||
|
begin
|
||||||
|
if mail
|
||||||
|
event.send(transition,
|
||||||
|
send_mail: params[:send_mail])
|
||||||
|
else
|
||||||
|
event.send(transition)
|
||||||
|
end
|
||||||
|
event.save
|
||||||
|
rescue Transitions::InvalidTransition => e
|
||||||
|
redirect_to(
|
||||||
|
admin_conference_events_path(conference_id: @conference.short_title),
|
||||||
|
notice: "Update state failed. #{e.message}") && return
|
||||||
|
end
|
||||||
|
redirect_to(admin_conference_events_path(conference_id: @conference.short_title),
|
||||||
|
notice: notice)
|
||||||
|
else
|
||||||
|
redirect_to(admin_conference_events_path(conference_id: @conference.short_title),
|
||||||
|
notice: 'Error! Could not find event!')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_mail_settings(event)
|
||||||
|
if !params[:send_mail].blank? && event &&
|
||||||
|
event.conference.email_settings.rejected_email_template.nil? &&
|
||||||
|
event.conference.email_settings.accepted_email_template.nil?
|
||||||
|
redirect_to(admin_conference_events_path(conference_id: @conference.short_title),
|
||||||
|
notice: 'Update Email Template before Sending Mails') && return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
class Admin::PeopleController < ApplicationController
|
|
||||||
before_filter :verify_organizer
|
|
||||||
respond_to :html
|
|
||||||
|
|
||||||
def index
|
|
||||||
@people = Person.all
|
|
||||||
mails = []
|
|
||||||
@people.each do |p|
|
|
||||||
if p.registrations.count < 1 and p.confirmed?
|
|
||||||
mails << p.email
|
|
||||||
end
|
|
||||||
end
|
|
||||||
respond_to do |format|
|
|
||||||
format.html
|
|
||||||
format.text { render :text => mails }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
|
||||||
@person = Person.new
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
@person = Person.new(params[:person])
|
|
||||||
flash[:notice] = 'Person was successfully created.' if @person.save
|
|
||||||
respond_with @person, :location => admin_people_path
|
|
||||||
end
|
|
||||||
|
|
||||||
def show
|
|
||||||
@person = Person.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def edit
|
|
||||||
@person = Person.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
|
||||||
@person = Person.find(params[:id])
|
|
||||||
flash[:notice] = 'Person was successfully updated' if @person.update_attributes(params[:person])
|
|
||||||
respond_with @person, :location => admin_people_path
|
|
||||||
end
|
|
||||||
|
|
||||||
def delete
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -1,134 +1,128 @@
|
||||||
class Admin::RegistrationsController < ApplicationController
|
module Admin
|
||||||
before_filter :verify_organizer
|
class RegistrationsController < ApplicationController
|
||||||
|
before_filter :verify_organizer
|
||||||
|
|
||||||
def index
|
def index
|
||||||
session[:return_to] ||= request.referer
|
session[:return_to] ||= request.referer
|
||||||
@pdf_filename = "#{@conference.title}.pdf"
|
@pdf_filename = "#{@conference.title}.pdf"
|
||||||
@registrations = @conference.registrations.includes(:person).order("registrations.created_at ASC")
|
@registrations = @conference.registrations.includes(:user).order("registrations.created_at ASC")
|
||||||
@attended = @conference.registrations.where("attended = ?", true).count
|
@attended = @conference.registrations.where("attended = ?", true).count
|
||||||
@headers = %w[first_name last_name email irc_nickname other_needs arrival departure attended]
|
@headers = %w[name email nickname other_needs arrival departure attended]
|
||||||
end
|
|
||||||
|
|
||||||
def change_field
|
|
||||||
@registration = Registration.find(params[:id])
|
|
||||||
field = params[:view_field]
|
|
||||||
if @registration.send(field.to_sym)
|
|
||||||
@registration.update_attribute(:"#{field}",0)
|
|
||||||
else
|
|
||||||
@registration.update_attribute(:"#{field}",1)
|
|
||||||
end
|
|
||||||
|
|
||||||
redirect_to admin_conference_registrations_path(@conference.short_title)
|
|
||||||
flash[:notice] = "Updated '#{params[:view_field]}' => #{@registration.attended} for
|
|
||||||
#{(Person.where("id = ?", @registration.person_id).first).email}"
|
|
||||||
end
|
|
||||||
|
|
||||||
def edit
|
|
||||||
@registration = @conference.registrations.where("id = ?", params[:id]).first
|
|
||||||
@person = Person.where("id = ?", @registration.person_id).first
|
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
|
||||||
@registration = @conference.registrations.where("id = ?", params[:id]).first
|
|
||||||
@person = Person.where("id = ?", @registration.person_id).first
|
|
||||||
begin
|
|
||||||
@person.update_attributes!(params[:registration][:person_attributes])
|
|
||||||
params[:registration].delete :person_attributes
|
|
||||||
if params[:registration][:supporter_registration]
|
|
||||||
@registration.supporter_registration.update_attributes(params[:registration][:supporter_registration_attributes])
|
|
||||||
params[:registration].delete :supporter_registration_attributes
|
|
||||||
end
|
|
||||||
@registration.update_attributes!(params[:registration])
|
|
||||||
flash[:notice] = "Successfully updated registration for #{@person.public_name} #{@person.email}"
|
|
||||||
redirect_to(admin_conference_registrations_path(@conference.short_title))
|
|
||||||
rescue Exception => e
|
|
||||||
Rails.logger.debug e.backtrace.join("\n")
|
|
||||||
redirect_to(admin_conference_registrations_path(@conference.short_title),
|
|
||||||
alert: 'Failed to update registration:' + e.message)
|
|
||||||
return
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
def change_field
|
||||||
@user = User.new
|
@registration = Registration.find(params[:id])
|
||||||
@person = Person.new
|
field = params[:view_field]
|
||||||
@registration = @person.registrations.new
|
if @registration.send(field.to_sym)
|
||||||
@supporter_registration = @conference.supporter_registrations.new
|
@registration.update_attribute(:"#{field}",0)
|
||||||
@conference = Conference.find_by(short_title: params[:conference_id])
|
else
|
||||||
end
|
@registration.update_attribute(:"#{field}",1)
|
||||||
|
end
|
||||||
|
|
||||||
def create
|
|
||||||
@conference = Conference.find_by(short_title: params[:conference_id])
|
|
||||||
email = params[:registration][:person].delete(:user)[:email]
|
|
||||||
@person = Person.find_by_email email
|
|
||||||
@registration = nil
|
|
||||||
@user = nil
|
|
||||||
|
|
||||||
if @person
|
|
||||||
if @person.registrations.where(conference_id: @conference).empty?
|
|
||||||
@person.attributes = params[:registration][:person] # Should we really modify person information?
|
|
||||||
else
|
|
||||||
redirect_to admin_conference_registrations_path(@conference.short_title)
|
redirect_to admin_conference_registrations_path(@conference.short_title)
|
||||||
flash[:notice] = "#{@person.email} is already registred!"
|
flash[:notice] = "Updated '#{params[:view_field]}' => #{@registration.attended} for
|
||||||
return
|
#{(User.where("id = ?", @registration.user_id).first).email}"
|
||||||
end
|
|
||||||
else
|
|
||||||
@person = Person.new params[:registration][:person]
|
|
||||||
end
|
end
|
||||||
@person.email = email
|
|
||||||
|
|
||||||
@user = @person.user
|
def edit
|
||||||
if @user.nil?
|
@registration = @conference.registrations.where("id = ?", params[:id]).first
|
||||||
@user = @person.build_user
|
@user = User.where("id = ?", @registration.user_id).first
|
||||||
@user.password = rand(36**6).to_s(36)
|
|
||||||
@user.skip_confirmation!
|
|
||||||
end
|
end
|
||||||
@user.email = @person.email
|
|
||||||
|
|
||||||
@registration = @person.registrations.build
|
def update
|
||||||
if params[:registration][:supporter_registration]
|
@registration = @conference.registrations.where("id = ?", params[:id]).first
|
||||||
@supporter_registration = @registration.build_supporter_registration
|
@user = User.where("id = ?", @registration.user_id).first
|
||||||
@supporter_registration.attributes = params[:registration][:supporter_registration]
|
begin
|
||||||
@supporter_registration.conference_id = @conference.id
|
@user.update_attributes!(params[:registration][:user_attributes])
|
||||||
else
|
params[:registration].delete :user_attributes
|
||||||
@supporter_registration = @conference.supporter_registrations.new
|
if params[:registration][:supporter_registration]
|
||||||
end
|
@registration.supporter_registration.update_attributes(params[:registration][:supporter_registration_attributes])
|
||||||
params[:registration].delete :person
|
params[:registration].delete :supporter_registration_attributes
|
||||||
params[:registration].delete :user
|
end
|
||||||
params[:registration].delete :supporter_registration
|
@registration.update_attributes!(params[:registration])
|
||||||
@registration.attributes = params[:registration]
|
flash[:success] = "Successfully updated registration for #{@user.name} #{@user.email}"
|
||||||
@registration.conference_id = @conference.id
|
redirect_to(admin_conference_registrations_path(@conference.short_title))
|
||||||
@registration.attended = true
|
|
||||||
begin
|
|
||||||
Registration.transaction do
|
|
||||||
@person.save!
|
|
||||||
@user.save!
|
|
||||||
@registration.save!
|
|
||||||
end
|
|
||||||
flash[:notice] = "Successfully created new registration for #{@person.email}."
|
|
||||||
redirect_to admin_conference_registrations_path(@conference.short_title)
|
|
||||||
rescue ActiveRecord::RecordInvalid
|
|
||||||
render action: "new"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
|
||||||
if has_role?(current_user, "Admin")
|
|
||||||
registration = @conference.registrations.where(:id => params[:id]).first
|
|
||||||
person = Person.where("id = ?", registration.person_id).first
|
|
||||||
|
|
||||||
begin registration.destroy
|
|
||||||
redirect_to admin_conference_registrations_path
|
|
||||||
flash[:notice] = "Deleted registration for #{person.public_name} #{person.email}"
|
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
Rails.logger.debug e.backtrace.join("\n")
|
Rails.logger.debug e.backtrace.join("\n")
|
||||||
redirect_to(admin_conference_registrations_path(@conference.short_title),
|
redirect_to(admin_conference_registrations_path(@conference.short_title),
|
||||||
alert: 'Failed to delete registration:' + e.message)
|
alert: 'Failed to update registration:' + e.message)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
else
|
|
||||||
redirect_to(admin_conference_registrations_path(@conference.short_title),
|
|
||||||
alert: 'You must be an admin to delete a registration.')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@user = User.new
|
||||||
|
@registration = @user.registrations.new
|
||||||
|
@supporter_registration = @conference.supporter_registrations.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@user = User.prepare(user_params['user'])
|
||||||
|
@registration = Registration.new
|
||||||
|
|
||||||
|
unless @user.save
|
||||||
|
render action: 'new'
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if @conference.user_registered? @user # Check if user is already registered to the conference
|
||||||
|
redirect_to admin_conference_registrations_path(@conference.short_title)
|
||||||
|
flash[:alert] = "#{@user.email} is already registred!"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
# Build registration
|
||||||
|
@registration = @user.registrations.build
|
||||||
|
@registration.attributes = registration_params
|
||||||
|
@registration.conference_id = @conference.id
|
||||||
|
@registration.attended = true
|
||||||
|
|
||||||
|
if params[:registration][:supporter_registration]
|
||||||
|
@supporter_registration = @registration.build_supporter_registration
|
||||||
|
@supporter_registration.attributes = supporter_params['supporter_registration']
|
||||||
|
@supporter_registration.conference_id = @conference.id
|
||||||
|
else
|
||||||
|
# If we render action: 'new' we need the @supporter_registration variable to be set
|
||||||
|
@supporter_registration = @conference.supporter_registrations.new
|
||||||
|
end
|
||||||
|
|
||||||
|
if @registration.save
|
||||||
|
flash[:success] = "Successfully created new registration for #{@user.email}."
|
||||||
|
redirect_to admin_conference_registrations_path(@conference.short_title)
|
||||||
|
else
|
||||||
|
render action: 'new'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
if has_role?(current_user, "Admin")
|
||||||
|
registration = @conference.registrations.where(:id => params[:id]).first
|
||||||
|
user = User.where("id = ?", registration.user_id).first
|
||||||
|
|
||||||
|
begin registration.destroy
|
||||||
|
redirect_to admin_conference_registrations_path
|
||||||
|
flash[:notice] = "Deleted registration for #{user.name} #{user.email}"
|
||||||
|
rescue Exception => e
|
||||||
|
Rails.logger.debug e.backtrace.join("\n")
|
||||||
|
redirect_to(admin_conference_registrations_path(@conference.short_title),
|
||||||
|
alert: 'Failed to delete registration:' + e.message)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
else
|
||||||
|
redirect_to(admin_conference_registrations_path(@conference.short_title),
|
||||||
|
alert: 'You must be an admin to delete a registration.')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
def registration_params
|
||||||
|
params.require(:registration).permit(:attending_with_partner, :using_affiliated_lodging, :handicapped_access_required, :other_special_needs, :attended)
|
||||||
|
end
|
||||||
|
def user_params
|
||||||
|
params.require(:registration).permit(user: [:email, :name, :nickname, :affiliation])
|
||||||
|
end
|
||||||
|
def supporter_params
|
||||||
|
params.require(:registration).permit(supporter_registration: [:supporter_level_id, :code])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -1,17 +1,19 @@
|
||||||
class Admin::SpeakersController < ApplicationController
|
module Admin
|
||||||
before_filter :verify_organizer
|
class SpeakersController < ApplicationController
|
||||||
respond_to :js, :html
|
before_filter :verify_organizer
|
||||||
|
respond_to :js, :html
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@event = @conference.events.find(params[:event_id])
|
@event = @conference.events.find(params[:event_id])
|
||||||
@speaker = @event.event_people.where(:event_role => "speaker").first
|
@speaker = @event.event_users.where(event_role: 'speaker').first
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@event = @conference.events.find(params[:event_id])
|
@event = @conference.events.find(params[:event_id])
|
||||||
@speaker = @event.event_people.where(:event_role => "speaker").first
|
@speaker = @event.event_users.where(event_role: 'speaker').first
|
||||||
@speaker.person_id = params[:speaker][:person_id]
|
@speaker.user_id = params[:speaker][:user_id]
|
||||||
@speaker.save
|
@speaker.save
|
||||||
respond_with @speaker, :location => admin_conference_events_path(@conference.short_title)
|
respond_with @speaker, location: admin_conference_events_path(@conference.short_title)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,210 +1,211 @@
|
||||||
class Admin::StatsController < ApplicationController
|
module Admin
|
||||||
before_filter :verify_organizer
|
class StatsController < ApplicationController
|
||||||
|
before_filter :verify_organizer
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@registrations = @conference.registrations.includes(:person).order("registrations.created_at ASC")
|
@registrations = @conference.registrations.includes(:user).order('registrations.created_at ASC')
|
||||||
@registered = @conference.registrations.count
|
@registered = @conference.registrations.count
|
||||||
@attendees = @conference.registrations.where("attended = ?", true).count
|
@attendees = @conference.registrations.where('attended = ?', true).count
|
||||||
@pre_registered = @conference.registrations.where("created_at < ?", @conference.start_date).count
|
@pre_registered = @conference.registrations.where('created_at < ?', @conference.start_date).count
|
||||||
@pre_registered_attended = @conference.registrations.where("created_at < ? AND attended = ?", @conference.start_date, true).count
|
@pre_registered_attended = @conference.registrations.where('created_at < ? AND attended = ?', @conference.start_date, true).count
|
||||||
|
|
||||||
@registered_with_partner = @conference.registrations.where("attending_with_partner = ?", true).count
|
@registered_with_partner = @conference.registrations.where('attending_with_partner = ?', true).count
|
||||||
@attended_with_partner = @conference.registrations.where("attending_with_partner = ? AND attended = ?", true, true).count
|
@attended_with_partner = @conference.registrations.where('attending_with_partner = ? AND attended = ?', true, true).count
|
||||||
|
|
||||||
@handicapped_access = @conference.registrations.where(handicapped_access_required: true).count
|
@handicapped_access = @conference.registrations.where(handicapped_access_required: true).count
|
||||||
@handicapped_access_attended = @conference.registrations.where(handicapped_access_required: true)
|
@handicapped_access_attended = @conference.registrations.where(handicapped_access_required: true)
|
||||||
@handicapped_access_attended = @handicapped_access_attended.where(attended: true).count
|
@handicapped_access_attended = @handicapped_access_attended.where(attended: true).count
|
||||||
@suggested_hotel_stay = @conference.registrations.where("using_affiliated_lodging = ?", true).count
|
@suggested_hotel_stay = @conference.registrations.where('using_affiliated_lodging = ?', true).count
|
||||||
|
|
||||||
@events = @conference.events
|
@events = @conference.events
|
||||||
#Events charts
|
# Events charts
|
||||||
@machine_states = [['confirmed'], ['cancelled'], ['rejected'], ['withdrawn'], ['new', 'review'], ['unconfirmed', 'accepted']]
|
@machine_states = [['confirmed'], ['cancelled'], ['rejected'], ['withdrawn'], ['new', 'review'], ['unconfirmed', 'accepted']]
|
||||||
#Types distribution per state
|
# Types distribution per state
|
||||||
@type_state = {}
|
@type_state = {}
|
||||||
@machine_states.each do |state|
|
@machine_states.each do |state|
|
||||||
@type_state[state[0]] = var_state_func(@conference.event_types, "event_type", state)
|
@type_state[state[0]] = var_state_func(@conference.event_types, 'event_type', state)
|
||||||
end
|
|
||||||
|
|
||||||
#Tracks distribution per state
|
|
||||||
@no_track_all = @events.where(track_id: nil)
|
|
||||||
@no_track_new = @events.where(track_id: nil).where(state: ['new', 'review'])
|
|
||||||
@no_track_unconfirmed = @events.where(track_id: nil).where(state: "unconfirmed")
|
|
||||||
@no_track_confirmed = @events.where(track_id: nil).where(state: "confirmed")
|
|
||||||
@track_state = {}
|
|
||||||
@machine_states.each do |state|
|
|
||||||
@track_state[state[0]] = var_state_func(@conference.tracks, "track", state)
|
|
||||||
end
|
|
||||||
|
|
||||||
#Events_time chart
|
|
||||||
if @events.count > 0
|
|
||||||
start_date = @events.minimum("created_at").strftime("%Y-%m-%d")
|
|
||||||
end_date = @events.maximum("created_at").strftime("%Y-%m-%d")
|
|
||||||
if start_date != nil && end_date != nil
|
|
||||||
@events_time = var_time(start_date, end_date, @events, "created_at")
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
#Code for the table in events
|
# Tracks distribution per state
|
||||||
@mystates = []
|
@no_track_all = @events.where(track_id: nil)
|
||||||
@mytypes = []
|
@no_track_new = @events.where(track_id: nil).where(state: ['new', 'review'])
|
||||||
@eventstats = {}
|
@no_track_unconfirmed = @events.where(track_id: nil).where(state: 'unconfirmed')
|
||||||
statelength = 0
|
@no_track_confirmed = @events.where(track_id: nil).where(state: 'confirmed')
|
||||||
@totallength = 0
|
@track_state = {}
|
||||||
#Get totals per state
|
@machine_states.each do |state|
|
||||||
@events.state_machine.states.map.each do |mystate|
|
@track_state[state[0]] = var_state_func(@conference.tracks, 'track', state)
|
||||||
length = 0
|
end
|
||||||
events_mystate= @events.where("state" => mystate.name)
|
|
||||||
if events_mystate.count > 0
|
# Events_time chart
|
||||||
@mystates << mystate
|
if @events.count > 0
|
||||||
events_mystate.each do |myevent|
|
start_date = @events.minimum('created_at').strftime('%Y-%m-%d')
|
||||||
length += myevent.event_type.length
|
end_date = @events.maximum('created_at').strftime('%Y-%m-%d')
|
||||||
|
if start_date != nil && end_date != nil
|
||||||
|
@events_time = var_time(start_date, end_date, @events, 'created_at')
|
||||||
end
|
end
|
||||||
@eventstats["#{mystate.name}"] = {"count" => events_mystate.count, "length" => length}
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
@conference.event_types.each do |mytype|
|
# Code for the table in events
|
||||||
events_mytype = @events.where("event_type_id" => mytype.id)
|
@mystates = []
|
||||||
if events_mytype.count > 0
|
@mytypes = []
|
||||||
@mytypes << mytype
|
@eventstats = {}
|
||||||
end
|
@totallength = 0
|
||||||
end
|
# Get totals per state
|
||||||
@mytypes.each do |mytype|
|
@events.state_machine.states.map.each do |mystate|
|
||||||
@mystates.each do |mystate|
|
length = 0
|
||||||
events_mytype = @events.where("event_type_id" => mytype.id)
|
events_mystate = @events.where('state' => mystate.name)
|
||||||
events_mytype_mystate= events_mytype.where("state" => mystate.name)
|
if events_mystate.count > 0
|
||||||
typelength = 0
|
@mystates << mystate
|
||||||
if events_mytype_mystate.count > 0
|
events_mystate.each do |myevent|
|
||||||
events_mytype_mystate.each do |myevent|
|
length += myevent.event_type.length
|
||||||
typelength += myevent.event_type.length
|
|
||||||
@totallength += myevent.event_type.length
|
|
||||||
end
|
end
|
||||||
@eventstats[mytype.title] = {"count" => events_mytype.count, "length" => events_mytype.count * mytype.length} if @eventstats[mytype.title] == nil
|
@eventstats["#{mystate.name}"] = { 'count' => events_mystate.count, 'length' => length }
|
||||||
tmp = {"#{mystate.name}" => {"type_state_count" => events_mytype_mystate.count, "type_state_length" => typelength}}
|
|
||||||
@eventstats[mytype.title].merge!(tmp)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
@eventstats["totallength"] = @totallength
|
|
||||||
|
|
||||||
#SPEAKERS stats
|
@conference.event_types.each do |mytype|
|
||||||
@speakers = Person.joins(:events).where("events.conference_id = ? AND events.state LIKE ?", @conference.id, 'confirmed').uniq
|
events_mytype = @events.where('event_type_id' => mytype.id)
|
||||||
@speaker_fields_person = %w[name email affiliation]
|
if events_mytype.count > 0
|
||||||
@speaker_fields_reg = %w[arrival departure]
|
@mytypes << mytype
|
||||||
#TICKETS stats
|
end
|
||||||
@supporter_levels = @conference.supporter_levels
|
end
|
||||||
@tickets = @conference.registrations.joins(:supporter_registration => :supporter_level)
|
@mytypes.each do |mytype|
|
||||||
@tickets = @tickets.where("supporter_levels.title NOT LIKE ? ", "%Free%")
|
@mystates.each do |mystate|
|
||||||
|
events_mytype = @events.where('event_type_id' => mytype.id)
|
||||||
|
events_mytype_mystate = events_mytype.where('state' => mystate.name)
|
||||||
|
typelength = 0
|
||||||
|
if events_mytype_mystate.count > 0
|
||||||
|
events_mytype_mystate.each do |myevent|
|
||||||
|
typelength += myevent.event_type.length
|
||||||
|
@totallength += myevent.event_type.length
|
||||||
|
end
|
||||||
|
@eventstats[mytype.title] = { 'count' => events_mytype.count, 'length' => events_mytype.count * mytype.length } if @eventstats[mytype.title] == nil
|
||||||
|
tmp = { "#{mystate.name}" => { 'type_state_count' => events_mytype_mystate.count, 'type_state_length' => typelength } }
|
||||||
|
@eventstats[mytype.title].merge!(tmp)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@eventstats['totallength'] = @totallength
|
||||||
|
|
||||||
@tickets_time = []
|
# SPEAKERS stats
|
||||||
|
@speakers = User.joins(:events).where('events.conference_id = ? AND events.state LIKE ?', @conference.id, 'confirmed').uniq
|
||||||
|
@speaker_fields_user = %w(name email affiliation)
|
||||||
|
@speaker_fields_reg = %w(arrival departure)
|
||||||
|
# TICKETS stats
|
||||||
|
@supporter_levels = @conference.supporter_levels
|
||||||
|
@tickets = @conference.registrations.joins(supporter_registration: :supporter_level)
|
||||||
|
@tickets = @tickets.where('supporter_levels.title NOT LIKE ? ', '%Free%')
|
||||||
|
|
||||||
if @conference.registration_start_date and @conference.end_date and @registered > 0 and @supporter_levels
|
@tickets_time = []
|
||||||
start_date = @conference.registration_start_date
|
|
||||||
end_date = @conference.end_date
|
if @conference.registration_start_date and @conference.end_date and @registered > 0 and @supporter_levels
|
||||||
levels = [];
|
start_date = @conference.registration_start_date
|
||||||
@conference.supporter_levels.each do |level|
|
end_date = @conference.end_date
|
||||||
@tickets_time << {"key" => level.title, "values" => []}
|
levels = []
|
||||||
levels << ["#{level.title}"]
|
@conference.supporter_levels.each do |level|
|
||||||
|
@tickets_time << { 'key' => level.title, 'values' => [] }
|
||||||
|
levels << ["#{level.title}"]
|
||||||
|
end
|
||||||
|
|
||||||
|
(start_date..end_date).each do |day|
|
||||||
|
if @tickets.where('supporter_registrations.created_at LIKE ?', "%#{day}%").where('supporter_levels.title' => levels).count != 0
|
||||||
|
@conference.supporter_levels.each do |level|
|
||||||
|
|
||||||
|
day_ticket_count = @tickets.where('supporter_registrations.created_at LIKE ? AND supporter_levels.title LIKE ?', "%#{day}%", "%#{level.title}%").count
|
||||||
|
|
||||||
|
index = @tickets_time.index { |v| v['key'] == "#{level.title}" }
|
||||||
|
@tickets_time[index]['values'] << { 'label' => "#{day}", 'value' => day_ticket_count }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@tickets_distribution = []
|
||||||
|
@tickets_time.each do |ticket|
|
||||||
|
value = ticket['values'].map { |x| x['value'] }.sum
|
||||||
|
percent = (value.to_f / @tickets.count * 100).round(2)
|
||||||
|
@tickets_distribution << { 'status' => ticket['key'], 'value' => value, 'percent' => percent }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# OTHER_INFO chart / To be 'Questions'
|
||||||
|
@other_info = [
|
||||||
|
{ 'status' => 'with partner (registered)', 'value' => @registered_with_partner },
|
||||||
|
{ 'status' => 'with partner (attended)', 'value' => @attended_with_partner },
|
||||||
|
{ 'status' => 'handicapped (registered)', 'value' => @handicapped_access },
|
||||||
|
{ 'status' => 'handicapped (attended)', 'value' => @handicapped_access_attended },
|
||||||
|
{ 'status' => 'stay at suggested hotel', 'value' => @suggested_hotel_stay }
|
||||||
|
]
|
||||||
|
|
||||||
|
# REGISTRATIONS, registered_time
|
||||||
|
if @conference.registration_start_date and @conference.end_date and @registered > 0
|
||||||
|
start_date = @conference.registration_start_date
|
||||||
|
end_date = @conference.end_date
|
||||||
|
@registered_time = var_time(start_date, end_date, @registrations, 'created_at')
|
||||||
|
end
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
format.json { render json: @tickets_time.to_json }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
# FUNCTIONS
|
||||||
|
def var_time(start_date, end_date, var, field)
|
||||||
|
result = []
|
||||||
(start_date..end_date).each do |day|
|
(start_date..end_date).each do |day|
|
||||||
if @tickets.where("supporter_registrations.created_at LIKE ?", "%#{day}%").where("supporter_levels.title" => levels).count != 0
|
day_var_count = var.where("#{field} LIKE ?", "%#{day}%").count
|
||||||
@conference.supporter_levels.each do |level|
|
if day_var_count != 0
|
||||||
|
result << { 'status' => "#{day}", 'value' => day_var_count }
|
||||||
day_ticket_count = @tickets.where("supporter_registrations.created_at LIKE ? AND supporter_levels.title LIKE ?", "%#{day}%", "%#{level.title}%").count
|
|
||||||
|
|
||||||
index = @tickets_time.index {|v| v["key"] == "#{level.title}"}
|
|
||||||
@tickets_time[index]["values"] << {"label" => "#{day}", "value" => day_ticket_count}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
return result
|
||||||
@tickets_distribution = []
|
|
||||||
@tickets_time.each do |ticket|
|
|
||||||
value = ticket["values"].map{|x| x["value"]}.sum
|
|
||||||
percent = (value.to_f / @tickets.count * 100).round(2)
|
|
||||||
@tickets_distribution << {"status" => ticket["key"], "value" => value, "percent" => percent}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#OTHER_INFO chart / To be 'Questions'
|
def var_state_func(vars, field, mystate)
|
||||||
@other_info = [
|
result = []
|
||||||
{"status" => "with partner (registered)", "value" => @registered_with_partner},
|
|
||||||
{"status" => "with partner (attended)", "value" => @attended_with_partner},
|
|
||||||
{"status" => "handicapped (registered)", "value" => @handicapped_access},
|
|
||||||
{"status" => "handicapped (attended)", "value" => @handicapped_access_attended},
|
|
||||||
{"status" => "stay at suggested hotel", "value" => @suggested_hotel_stay}
|
|
||||||
]
|
|
||||||
|
|
||||||
# REGISTRATIONS, registered_time
|
for myvar in vars do
|
||||||
if @conference.registration_start_date and @conference.end_date and @registered > 0
|
# Find events per track and state
|
||||||
start_date = @conference.registration_start_date
|
value = @conference.events.where("#{field}_id" => myvar.id).where(state: mystate).count
|
||||||
end_date = @conference.end_date
|
# Find all events in that state
|
||||||
@registered_time = var_time(start_date, end_date, @registrations, "created_at")
|
total = @conference.events.where(state: mystate).count
|
||||||
end
|
status = "#{myvar.name}"
|
||||||
|
|
||||||
respond_to do |format|
|
if value != 0
|
||||||
format.html
|
percent = (value.to_f / total * 100).round(2)
|
||||||
format.json { render :json => @tickets_time.to_json }
|
result << { 'status' => status, 'value' => value, 'percent' => percent }
|
||||||
end
|
else
|
||||||
end
|
percent = 0
|
||||||
#FUNCTIONS
|
end
|
||||||
def var_time(start_date, end_date, var, field)
|
|
||||||
result = []
|
|
||||||
(start_date..end_date).each do |day|
|
|
||||||
day_var_count = var.where("#{field} LIKE ?", "%#{day}%").count
|
|
||||||
if day_var_count !=0
|
|
||||||
result << {"status" => "#{day}", "value" => day_var_count}
|
|
||||||
end
|
end
|
||||||
end
|
# Get no of events for which the field is not set (Needed so that the pie shows half piece for 50%)
|
||||||
return result
|
sum = result.inject(0) { |sum, hash| sum + hash['value'] }
|
||||||
end
|
value = total - sum if total and sum
|
||||||
|
if sum != 0 && value != 0
|
||||||
def var_state_func(vars, field, mystate)
|
|
||||||
result = []
|
|
||||||
|
|
||||||
for myvar in vars do
|
|
||||||
#Find events per track and state
|
|
||||||
value = @conference.events.where("#{field}_id" => myvar.id).where(state: mystate).count
|
|
||||||
#Find all events in that state
|
|
||||||
total = @conference.events.where(state: mystate).count
|
|
||||||
status = "#{myvar.name}"
|
|
||||||
|
|
||||||
if value != 0
|
|
||||||
percent = (value.to_f / total * 100).round(2)
|
percent = (value.to_f / total * 100).round(2)
|
||||||
result << {"status" => status, "value" => value, "percent" => percent}
|
result << { 'status' => "no #{field} set", 'value' => value, 'percent' => percent }
|
||||||
else
|
|
||||||
percent = 0
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
#Get no of events for which the field is not set (Needed so that the pie shows half piece for 50%)
|
return result
|
||||||
sum = result.inject(0) {|sum, hash| sum + hash["value"]}
|
|
||||||
value = total - sum if total and sum
|
|
||||||
if sum !=0 && value !=0
|
|
||||||
percent = (value.to_f / total * 100).round(2)
|
|
||||||
result << {"status" => "no #{field} set", "value" => value, "percent" => percent }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return result
|
def speaker_reg(speaker)
|
||||||
end
|
speaker.registrations.where('conference_id = ? AND user_id = ?', @conference.id, speaker.id).first
|
||||||
|
end
|
||||||
|
|
||||||
def speaker_reg(speaker)
|
def speaker_diet(reg)
|
||||||
speaker.registrations.where("conference_id = ? AND person_id = ?", @conference.id, speaker.id).first
|
@conference.dietary_choices.find(reg.dietary_choice_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def speaker_diet(reg)
|
def diet_count(diet)
|
||||||
@conference.dietary_choices.find(reg.dietary_choice_id)
|
@conference.registrations.where('dietary_choice_id = ?', diet)
|
||||||
end
|
end
|
||||||
|
|
||||||
def diet_count(diet)
|
def social_event_count(event)
|
||||||
@conference.registrations.where("dietary_choice_id = ?", diet)
|
@conference.registrations.joins(:social_events).where('registrations_social_events.social_event_id = ?', event).count
|
||||||
end
|
end
|
||||||
|
|
||||||
def social_event_count(event)
|
helper_method :speaker_reg
|
||||||
@conference.registrations.joins(:social_events).where("registrations_social_events.social_event_id = ?", event).count
|
helper_method :speaker_diet
|
||||||
|
helper_method :diet_count
|
||||||
|
helper_method :social_event_count
|
||||||
end
|
end
|
||||||
|
|
||||||
helper_method :speaker_reg
|
|
||||||
helper_method :speaker_diet
|
|
||||||
helper_method :diet_count
|
|
||||||
helper_method :social_event_count
|
|
||||||
end
|
end
|
||||||
|
|
@ -1,29 +1,40 @@
|
||||||
class Admin::UsersController < ApplicationController
|
module Admin
|
||||||
before_filter :verify_admin
|
class UsersController < ApplicationController
|
||||||
|
before_filter :verify_admin
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@users = User.joins(:person).order("people.last_name ASC").select("users.*,
|
@users = User.all
|
||||||
people.last_name AS last_name,
|
end
|
||||||
people.first_name AS first_name,
|
|
||||||
people.public_name AS public_name,
|
def show
|
||||||
people.email AS email")
|
@user = User.find(params[:id])
|
||||||
|
|
||||||
|
# Variable @show_attributes holds the attributes that are visible for the 'show' action
|
||||||
|
# If you want to change the attributes that are shown in the 'show' action of users
|
||||||
|
# add/remove the attributes in the following string array
|
||||||
|
@show_attributes = %w(name email affiliation biography registered attended created_at
|
||||||
|
updated_at sign_in_count current_sign_in_at last_sign_in_at
|
||||||
|
current_sign_in_ip last_sign_in_ip)
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
user = User.find(params[:id])
|
||||||
|
user.update_attributes!(params[:user])
|
||||||
|
redirect_to admin_users_path, notice: "Updated #{user.email}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@user = User.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def delete
|
||||||
|
@user = User.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@user = User.find(params[:id])
|
||||||
|
@user.destroy
|
||||||
|
redirect_to admin_users_path, notice: 'User got deleted'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
|
||||||
user = User.find(params[:id])
|
|
||||||
user.update_attributes!(params[:user])
|
|
||||||
redirect_to admin_users_path, :notice => "Updated #{user.email}"
|
|
||||||
end
|
|
||||||
|
|
||||||
def delete
|
|
||||||
@user = User.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
|
||||||
@user = User.find(params[:id])
|
|
||||||
@user.destroy
|
|
||||||
redirect_to admin_users_path, :notice => "User got deleted"
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ class Api::V1::EventsController < Api::BaseController
|
||||||
respond_to :json
|
respond_to :json
|
||||||
|
|
||||||
def index
|
def index
|
||||||
events = Event.includes(:conference, :track, :room, :event_type, {:event_people => :person})
|
events = Event.includes(:conference, :track, :room, :event_type, {:event_user => :user})
|
||||||
unless params[:conference_id].blank?
|
unless params[:conference_id].blank?
|
||||||
events = events.where("conferences.guid" => params[:conference_id])
|
events = events.where("conferences.guid" => params[:conference_id])
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,12 @@ class Api::V1::SpeakersController < Api::BaseController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
if params[:conference_id].blank?
|
if params[:conference_id].blank?
|
||||||
people = Person.joins(:event_people)
|
people = User.joins(:event_users)
|
||||||
else
|
else
|
||||||
people = Person.joins(:event_people => {:event => :conference})
|
people = User.joins(:event_users => {:event => :conference})
|
||||||
people = people.where("conferences.guid" => params[:conference_id])
|
people = people.where("conferences.guid" => params[:conference_id])
|
||||||
end
|
end
|
||||||
people = people.where("event_people.event_role" => "speaker")
|
people = people.where("event_users.event_role" => "speaker")
|
||||||
render :json => people, :each_serializer => SpeakerSerializer
|
render :json => users, :each_serializer => SpeakerSerializer
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,35 +5,32 @@ class ConferenceRegistrationController < ApplicationController
|
||||||
# TODO Figure out how to change the route's id from :id to :conference_id
|
# TODO Figure out how to change the route's id from :id to :conference_id
|
||||||
@conference = Conference.find_by(short_title: params[:id])
|
@conference = Conference.find_by(short_title: params[:id])
|
||||||
@workshops = @conference.events.where("require_registration = ? AND state LIKE ?", true, 'confirmed')
|
@workshops = @conference.events.where("require_registration = ? AND state LIKE ?", true, 'confirmed')
|
||||||
@person = current_user.person
|
@user = current_user
|
||||||
if @person.first_name.blank? || @person.last_name.blank?
|
|
||||||
redirect_to(edit_user_registration_path, :alert => "Please fill in your first and last name before registering.")
|
@registration = @user.registrations.where(:conference_id => @conference.id).first
|
||||||
return
|
|
||||||
end
|
|
||||||
@registration = @person.registrations.where(:conference_id => @conference.id).first
|
|
||||||
@registered = true
|
@registered = true
|
||||||
if @registration.nil?
|
if @registration.nil?
|
||||||
@registered = false
|
@registered = false
|
||||||
@registration = @person.registrations.new(:conference_id => @conference.id)
|
@registration = @user.registrations.new(:conference_id => @conference.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check if there's an existing SupporterRegistration for this email and link it when appropriate
|
# Check if there's an existing SupporterRegistration for this email and link it when appropriate
|
||||||
@registration.supporter_registration ||= @conference.supporter_registrations.where(:email => @person.email).first
|
@registration.supporter_registration ||= @conference.supporter_registrations.where(:email => @user.email).first
|
||||||
@registration.supporter_registration ||= SupporterRegistration.new(:conference_id => @conference.id)
|
@registration.supporter_registration ||= SupporterRegistration.new(:conference_id => @conference.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO this is ugly
|
# TODO this is ugly
|
||||||
def update
|
def update
|
||||||
conference = Conference.find_by(short_title: params[:id])
|
conference = Conference.find_by(short_title: params[:id])
|
||||||
person = current_user.person
|
user = current_user
|
||||||
registration = person.registrations.where(:conference_id => conference.id).first
|
registration = user.registrations.where(:conference_id => conference.id).first
|
||||||
update_registration = true
|
update_registration = true
|
||||||
# First verify that the supporter code is legit
|
# First verify that the supporter code is legit
|
||||||
if !params[:registration][:supporter_registration_attributes].nil? && !params[:registration][:supporter_registration_attributes][:code].empty?
|
if !params[:registration][:supporter_registration_attributes].nil? && !params[:registration][:supporter_registration_attributes][:code].empty?
|
||||||
regs = conference.supporter_registrations.where(:code => params[:registration][:supporter_registration_attributes][:code])
|
regs = conference.supporter_registrations.where(:code => params[:registration][:supporter_registration_attributes][:code])
|
||||||
|
|
||||||
if regs.count != 0
|
if regs.count != 0
|
||||||
if regs.where(:email => person.email).count == 0
|
if regs.where(:email => user.email).count == 0
|
||||||
redirect_to(register_conference_path(:id => conference.short_title), :alert => "This code is already in use. Please contact #{conference.contact_email} for assistance.")
|
redirect_to(register_conference_path(:id => conference.short_title), :alert => "This code is already in use. Please contact #{conference.contact_email} for assistance.")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
@ -42,16 +39,16 @@ class ConferenceRegistrationController < ApplicationController
|
||||||
begin
|
begin
|
||||||
if registration.nil?
|
if registration.nil?
|
||||||
update_registration = false
|
update_registration = false
|
||||||
person.update_attributes(registration_params[:person_attributes])
|
user.update_attributes(registration_params[:user_attributes])
|
||||||
params[:registration].delete :person_attributes
|
params[:registration].delete :user_attributes
|
||||||
supporter_reg = params[:registration][:supporter_registration_attributes]
|
supporter_reg = params[:registration][:supporter_registration_attributes]
|
||||||
params[:registration].delete :supporter_registration_attributes
|
params[:registration].delete :supporter_registration_attributes
|
||||||
registration = person.registrations.new(registration_params)
|
registration = user.registrations.new(registration_params)
|
||||||
if conference.use_supporter_levels? && !supporter_reg.nil?
|
if conference.use_supporter_levels? && !supporter_reg.nil?
|
||||||
if !supporter_reg[:id].blank?
|
if !supporter_reg[:id].blank?
|
||||||
# This means that their supporter registration was entered ahead of time, probably by an admin
|
# This means that their supporter registration was entered ahead of time, probably by an admin
|
||||||
registration.supporter_registration = SupporterRegistration.find(supporter_reg[:id])
|
registration.supporter_registration = SupporterRegistration.find(supporter_reg[:id])
|
||||||
if registration.supporter_registration.email != person.email
|
if registration.supporter_registration.email != user.email
|
||||||
raise "Invalid code"
|
raise "Invalid code"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
@ -78,7 +75,7 @@ class ConferenceRegistrationController < ApplicationController
|
||||||
# Track ahoy event
|
# Track ahoy event
|
||||||
ahoy.track 'Registered', title: 'New registration'
|
ahoy.track 'Registered', title: 'New registration'
|
||||||
if conference.email_settings.send_on_registration?
|
if conference.email_settings.send_on_registration?
|
||||||
Mailbot.registration_mail(conference, current_user.person).deliver
|
Mailbot.registration_mail(conference, current_user).deliver
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
redirect_to(register_conference_path(:id => conference.short_title), :notice => redirect_message)
|
redirect_to(register_conference_path(:id => conference.short_title), :notice => redirect_message)
|
||||||
|
|
@ -86,8 +83,8 @@ class ConferenceRegistrationController < ApplicationController
|
||||||
|
|
||||||
def unregister
|
def unregister
|
||||||
conference = Conference.find_by(short_title: params[:id])
|
conference = Conference.find_by(short_title: params[:id])
|
||||||
person = current_user.person
|
user = current_user
|
||||||
registration = person.registrations.where(:conference_id => conference.id).first
|
registration = user.registrations.where(:conference_id => conference.id).first
|
||||||
registration.destroy
|
registration.destroy
|
||||||
redirect_to :root
|
redirect_to :root
|
||||||
end
|
end
|
||||||
|
|
@ -106,9 +103,8 @@ class ConferenceRegistrationController < ApplicationController
|
||||||
vchoice_ids: [],
|
vchoice_ids: [],
|
||||||
qanswer_ids: [],
|
qanswer_ids: [],
|
||||||
qanswers_attributes: [],
|
qanswers_attributes: [],
|
||||||
person_attributes: [
|
user_attributes: [
|
||||||
:id, :public_name, :mobile, :tshirt, :languages,
|
:id, :name],
|
||||||
:volunteer_experience],
|
|
||||||
supporter_registration_attributes: [
|
supporter_registration_attributes: [
|
||||||
:id, :supporter_level_id, :code
|
:id, :supporter_level_id, :code
|
||||||
])
|
])
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ class EventAttachmentsController < ApplicationController
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if organizer_or_admin? || current_user.person == upload.event.submitter
|
if organizer_or_admin? || current_user == upload.event.submitter
|
||||||
send_file upload.attachment.path
|
send_file upload.attachment.path
|
||||||
else
|
else
|
||||||
raise ActionController::RoutingError.new('Not Found')
|
raise ActionController::RoutingError.new('Not Found')
|
||||||
|
|
@ -52,7 +52,7 @@ class EventAttachmentsController < ApplicationController
|
||||||
|
|
||||||
if !organizer_or_admin?
|
if !organizer_or_admin?
|
||||||
begin
|
begin
|
||||||
event = current_user.person.events.find(params[:proposal_id])
|
event = current_user.events.find(params[:proposal_id])
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
# They certainly aren't allowed to attach a file to someone else's proposal
|
# They certainly aren't allowed to attach a file to someone else's proposal
|
||||||
raise ActionController::RoutingError.new('Invalid proposal')
|
raise ActionController::RoutingError.new('Invalid proposal')
|
||||||
|
|
@ -81,7 +81,7 @@ class EventAttachmentsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@proposal = current_user.person.events.find(params[:proposal_id])
|
@proposal = current_user.events.find(params[:proposal_id])
|
||||||
@upload = @proposal.event_attachments.find(params[:proposal_id])
|
@upload = @proposal.event_attachments.find(params[:proposal_id])
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
@ -98,7 +98,7 @@ class EventAttachmentsController < ApplicationController
|
||||||
def destroy
|
def destroy
|
||||||
@proposal = Event.find(params[:proposal_id])
|
@proposal = Event.find(params[:proposal_id])
|
||||||
|
|
||||||
if organizer_or_admin? || current_user.person == @proposal.submitter
|
if organizer_or_admin? || current_user == @proposal.submitter
|
||||||
@upload = @proposal.event_attachments.find(params[:id])
|
@upload = @proposal.event_attachments.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
class ProposalController < ApplicationController
|
class ProposalController < ApplicationController
|
||||||
before_filter :verify_user, :except => [:show]
|
before_filter :verify_user, except: [:show]
|
||||||
before_filter :setup
|
before_filter :setup
|
||||||
before_filter :verify_access, only: [:edit, :update, :destroy, :confirm, :restart]
|
before_filter :verify_access, only: [:edit, :update, :destroy, :confirm, :restart]
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@person = current_user.person if current_user
|
@user = current_user if current_user
|
||||||
#FIXME: @conference also comes from verify_user, but we need setup also in show
|
# FIXME: @conference also comes from verify_user, but we need setup also in show
|
||||||
# which can be accessed anonymusly
|
# which can be accessed anonymusly
|
||||||
@conference = Conference.find_by(short_title: params[:conference_id])
|
@conference = Conference.find_by(short_title: params[:conference_id])
|
||||||
@url = conference_proposal_index_path(@conference.short_title)
|
@url = conference_proposal_index_path(@conference.short_title)
|
||||||
|
|
@ -19,22 +19,23 @@ class ProposalController < ApplicationController
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if !organizer_or_admin?
|
if !organizer_or_admin?
|
||||||
@event = @person.events.find(params[:id])
|
@event = @user.events.find(params[:id])
|
||||||
else
|
else
|
||||||
@event = Event.find(params[:id])
|
@event = Event.find(params[:id])
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
Rails.logger.debug("Proposal failure in verify_access: #{e.message}")
|
Rails.logger.debug("Proposal failure in verify_access: #{e.message}")
|
||||||
redirect_to(conference_proposal_index_path(:conference_id => @conference.short_title), :alert => 'Invalid or uneditable proposal.')
|
redirect_to(conference_proposal_index_path(conference_id: @conference.short_title),
|
||||||
|
alert: 'Invalid or uneditable proposal.')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@events = @person.proposals @conference
|
@events = @user.proposals @conference
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
proposal = @person.events.find_by_id(params[:id])
|
proposal = @user.events.find_by_id(params[:id])
|
||||||
if proposal
|
if proposal
|
||||||
proposal.withdraw
|
proposal.withdraw
|
||||||
proposal.save
|
proposal.save
|
||||||
|
|
@ -56,92 +57,99 @@ class ProposalController < ApplicationController
|
||||||
@attachments = @event.event_attachments
|
@attachments = @event.event_attachments
|
||||||
|
|
||||||
if @event.nil?
|
if @event.nil?
|
||||||
redirect_to(conference_proposal_index_path(:conference_id => @conference.short_title), :alert => 'Invalid or uneditable proposal.')
|
redirect_to(conference_proposal_index_path(conference_id: @conference.short_title),
|
||||||
|
alert: 'Invalid or uneditable proposal.')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
session[:return_to] ||= request.referer
|
session[:return_to] ||= request.referer
|
||||||
submitter = params[:person]
|
submitter = params[:user]
|
||||||
|
|
||||||
params[:event].delete :people_attributes
|
params[:event].delete :users_attributes
|
||||||
params[:event].delete :person
|
params[:event].delete :user
|
||||||
|
|
||||||
if submitter[:public_name].blank?
|
if submitter[:name].blank?
|
||||||
redirect_to edit_conference_proposal_path(@conference.short_title, @event), :alert => "Your public name cannot be blank"
|
redirect_to edit_conference_proposal_path(@conference.short_title, @event),
|
||||||
|
alert: 'Your name cannot be blank'
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if submitter[:biography].blank?
|
if submitter[:biography].blank?
|
||||||
redirect_to edit_conference_proposal_path(@conference.short_title, @event), :alert => "Your biography cannot be blank"
|
redirect_to edit_conference_proposal_path(@conference.short_title, @event),
|
||||||
|
alert: 'Your biography cannot be blank'
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if submitter[:public_name] != @person.public_name || submitter[:biography] != @person.biography
|
if submitter[:name] != @user.name || submitter[:biography] != @user.biography
|
||||||
@person.update_attributes(submitter)
|
@user.update_attributes(submitter)
|
||||||
end
|
end
|
||||||
|
|
||||||
event = Event.find_by_id(params[:id])
|
event = Event.find_by_id(params[:id])
|
||||||
|
|
||||||
begin
|
begin
|
||||||
event.update_attributes!(params[:event])
|
event.update_attributes!(params[:event])
|
||||||
redirect_to(conference_proposal_index_path(:conference_id => @conference.short_title), :notice => "'#{event.title}' was successfully updated.")
|
redirect_to(conference_proposal_index_path(conference_id: @conference.short_title),
|
||||||
|
notice: "'#{event.title}' was successfully updated.")
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
redirect_to edit_conference_proposal_path(@conference.short_title, @event), :alert => e.message
|
redirect_to edit_conference_proposal_path(@conference.short_title, @event), alert: e.message
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
person = current_user.person
|
user = current_user
|
||||||
session[:return_to] ||= request.referer
|
session[:return_to] ||= request.referer
|
||||||
|
|
||||||
event_params = params[:event]
|
event_params = params[:event]
|
||||||
submitter = params[:person]
|
submitter = params[:user]
|
||||||
params[:event].delete :person
|
params[:event].delete :user
|
||||||
|
|
||||||
@event = Event.new(event_params)
|
@event = Event.new(event_params)
|
||||||
@event.conference = @conference
|
@event.conference = @conference
|
||||||
|
|
||||||
if submitter[:public_name].blank?
|
if submitter[:name].blank?
|
||||||
flash[:error] = "Your public name cannot be blank."
|
flash[:error] = 'Your public name cannot be blank.'
|
||||||
render :action => "new"
|
render action: 'new'
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if submitter[:biography].blank?
|
if submitter[:biography].blank?
|
||||||
flash[:error] = "Your biography cannot be blank."
|
flash[:error] = 'Your biography cannot be blank.'
|
||||||
render :action => "new"
|
render action: 'new'
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
# First, update the submitter's info, if they've changed anything
|
# First, update the submitter's info, if they've changed anything
|
||||||
if submitter[:public_name] != person.public_name || submitter[:biography] != person.biography
|
if submitter[:name] != user.name || submitter[:biography] != user.biography
|
||||||
person.update_attributes(submitter)
|
user.update_attributes(submitter)
|
||||||
end
|
end
|
||||||
|
|
||||||
@event.event_people.new(:person => person,
|
@event.event_users.new(user: user,
|
||||||
:event_role => "submitter")
|
event_role: 'submitter')
|
||||||
@event.event_people.new(:person => person,
|
@event.event_users.new(user: user,
|
||||||
:event_role => "speaker")
|
event_role: 'speaker')
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@event.save!
|
@event.save!
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
@url = conference_proposal_index_path(@conference.short_title)
|
@url = conference_proposal_index_path(@conference.short_title)
|
||||||
@event_types = @conference.event_types
|
@event_types = @conference.event_types
|
||||||
@person = current_user.person
|
@user = current_user
|
||||||
|
|
||||||
flash[:error] = "Could not submit proposal: #{e.message}"
|
flash[:error] = "Could not submit proposal: #{e.message}"
|
||||||
render :action => 'new'
|
render action: 'new'
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
registration = person.registrations.where(:conference_id => @conference.id).first
|
registration = user.registrations.where(conference_id: @conference.id).first
|
||||||
ahoy.track 'Event submission', title: 'New submission'
|
ahoy.track 'Event submission', title: 'New submission'
|
||||||
if registration.nil?
|
if registration.nil?
|
||||||
redirect_to(register_conference_path(@conference.short_title), :notice => 'Event was successfully submitted. You probably want to register for the conference now!')
|
redirect_to(register_conference_path(@conference.short_title),
|
||||||
|
notice: 'Event was successfully submitted.\
|
||||||
|
You probably want to register for the conference now!')
|
||||||
else
|
else
|
||||||
redirect_to(conference_proposal_index_path(:conference_id => @conference.short_title), :notice => 'Event was successfully submitted.')
|
redirect_to(conference_proposal_index_path(conference_id: @conference.short_title),
|
||||||
|
notice: 'Event was successfully submitted.')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -155,17 +163,21 @@ class ProposalController < ApplicationController
|
||||||
begin
|
begin
|
||||||
@event.confirm!
|
@event.confirm!
|
||||||
rescue InvalidTransition => e
|
rescue InvalidTransition => e
|
||||||
redirect_to(conference_proposal_index_path(:conference_id => @conference.short_title), :alert => "Event was NOT confirmed: #{e.message}")
|
redirect_to(conference_proposal_index_path(conference_id: @conference.short_title),
|
||||||
|
alert: "Event was NOT confirmed: #{e.message}")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if !@conference.user_registered?(current_user)
|
if !@conference.user_registered?(current_user)
|
||||||
redirect_to(register_conference_path(@conference.short_title), :notice => "Event was confirmed. Please register to attend the conference.")
|
redirect_to(register_conference_path(@conference.short_title),
|
||||||
|
notice: 'Event was confirmed. Please register to attend the conference.')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
redirect_to(conference_proposal_index_path(:conference_id => @conference.short_title), :notice => 'Event was confirmed.')
|
redirect_to(conference_proposal_index_path(conference_id: @conference.short_title),
|
||||||
|
notice: 'Event was confirmed.')
|
||||||
else
|
else
|
||||||
redirect_to(conference_proposal_index_path(:conference_id => @conference.short_title), :alert => 'Event was NOT confirmed!')
|
redirect_to(conference_proposal_index_path(conference_id: @conference.short_title),
|
||||||
|
alert: 'Event was NOT confirmed!')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,15 +36,15 @@ class RegistrationsController < Devise::RegistrationsController
|
||||||
|
|
||||||
if successfully_updated
|
if successfully_updated
|
||||||
if email_changed
|
if email_changed
|
||||||
if !@user.person.nil?
|
if !@user.nil?
|
||||||
@user.person.update_attribute("email", params[:user][:email])
|
@user.update_attribute('email', params[:user][:email])
|
||||||
end
|
end
|
||||||
set_flash_message :notice, :update_needs_confirmation
|
set_flash_message :notice, :update_needs_confirmation
|
||||||
else
|
else
|
||||||
set_flash_message :notice, :updated
|
set_flash_message :notice, :updated
|
||||||
end
|
end
|
||||||
# Sign in the user bypassing validation in case his password changed
|
# Sign in the user bypassing validation in case his password changed
|
||||||
sign_in @user, :bypass => true
|
sign_in @user, bypass: true
|
||||||
redirect_to after_update_path_for(@user)
|
redirect_to after_update_path_for(@user)
|
||||||
else
|
else
|
||||||
flash[:alert] = 'Updating account failed. ' \
|
flash[:alert] = 'Updating account failed. ' \
|
||||||
|
|
@ -66,11 +66,11 @@ class RegistrationsController < Devise::RegistrationsController
|
||||||
def configure_permitted_parameters
|
def configure_permitted_parameters
|
||||||
devise_parameter_sanitizer.for(:account_update) do |u|
|
devise_parameter_sanitizer.for(:account_update) do |u|
|
||||||
u.
|
u.
|
||||||
permit(:email, :password, :password_confirmation, :current_password,
|
permit(:email, :password, :password_confirmation, :current_password, :name, :biography)
|
||||||
person_attributes: [:id, :email, :first_name, :last_name,
|
end
|
||||||
:public_name, :biography, :company, :avatar,
|
devise_parameter_sanitizer.for(:sign_up) do |u|
|
||||||
:irc_nickname, :mobile, :tshirt, :languages,
|
u.
|
||||||
:volunteer_experience])
|
permit(:email, :password, :password_confirmation, :name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ module ApplicationHelper
|
||||||
result = ""
|
result = ""
|
||||||
result += "<div style='padding-left:#{padding}px'>"
|
result += "<div style='padding-left:#{padding}px'>"
|
||||||
result += "<div class='well'>"
|
result += "<div class='well'>"
|
||||||
result += "<b>#{comment.user.person.public_name}</b> <i>#{comment.created_at}</i><br><br>"
|
result += "<b>#{comment.user.name}</b> <i>#{comment.created_at}</i><br><br>"
|
||||||
result += comment.body
|
result += comment.body
|
||||||
result += "<br><div><a href='#' class='pull-right comment-reply-link'>Reply</a><br><br>"
|
result += "<br><div><a href='#' class='pull-right comment-reply-link'>Reply</a><br><br>"
|
||||||
result += "<div class='comment-reply'>"
|
result += "<div class='comment-reply'>"
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ class Conference < ActiveRecord::Base
|
||||||
:start_date, :end_date, :rooms_attributes, :tracks_attributes, :dietary_choices_attributes,
|
:start_date, :end_date, :rooms_attributes, :tracks_attributes, :dietary_choices_attributes,
|
||||||
:use_dietary_choices, :use_supporter_levels, :supporter_levels_attributes, :social_events_attributes,
|
:use_dietary_choices, :use_supporter_levels, :supporter_levels_attributes, :social_events_attributes,
|
||||||
:event_types_attributes, :registration_start_date, :registration_end_date, :logo,
|
:event_types_attributes, :registration_start_date, :registration_end_date, :logo,
|
||||||
:questions_attributes, :question_ids, :answers_attributes, :answer_ids,
|
:questions_attributes, :question_ids, :answers_attributes, :answer_ids,
|
||||||
:difficulty_levels_attributes, :use_difficulty_levels,
|
:difficulty_levels_attributes, :use_difficulty_levels,
|
||||||
:use_vpositions, :use_vdays, :vdays_attributes, :vpositions_attributes, :use_volunteers,
|
:use_vpositions, :use_vdays, :vdays_attributes, :vpositions_attributes, :use_volunteers,
|
||||||
:media_id, :media_type, :color, :description,
|
:media_id, :media_type, :color, :description,
|
||||||
|
|
@ -114,9 +114,8 @@ class Conference < ActiveRecord::Base
|
||||||
# * +true+ - If the user isn't registered
|
# * +true+ - If the user isn't registered
|
||||||
def user_registered? user
|
def user_registered? user
|
||||||
return nil if user.nil?
|
return nil if user.nil?
|
||||||
return nil if user.person.nil?
|
|
||||||
|
|
||||||
if self.registrations.where(:person_id => user.person.id).count == 0
|
if self.registrations.where(:user_id => user.id).count == 0
|
||||||
logger.debug("User #{user.email} isn't registered to self.title")
|
logger.debug("User #{user.email} isn't registered to self.title")
|
||||||
return false
|
return false
|
||||||
else
|
else
|
||||||
|
|
@ -303,28 +302,27 @@ class Conference < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Returns a hash with person => submissions ordered by submissions for all conferences
|
# Returns a hash with user => submissions ordered by submissions for all conferences
|
||||||
#
|
#
|
||||||
# ====Returns
|
# ====Returns
|
||||||
# * +hash+ -> person: submissions
|
# * +hash+ -> user: submissions
|
||||||
def self.get_top_submitter(limit = 5)
|
def self.get_top_submitter(limit = 5)
|
||||||
submitter = EventPerson.where('event_role = ?', 'submitter').limit(limit).group(:person_id)
|
submitter = EventUser.where('event_role = ?', 'submitter').limit(limit).group(:user_id)
|
||||||
counter = submitter.order('count_all desc').count
|
counter = submitter.order('count_all desc').count
|
||||||
calculate_person_submission_hash(submitter, counter)
|
calculate_user_submission_hash(submitter, counter)
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Returns a hash with person => submissions ordered by submissions
|
# Returns a hash with user => submissions ordered by submissions
|
||||||
#
|
#
|
||||||
# ====Returns
|
# ====Returns
|
||||||
# * +hash+ -> person: submissions
|
# * +hash+ -> user: submissions
|
||||||
def get_top_submitter(limit = 5)
|
def get_top_submitter(limit = 5)
|
||||||
submitter = EventPerson.joins(:event).
|
submitter = EventUser.joins(:event).
|
||||||
where('event_role = ? and conference_id = ?', 'submitter', id).
|
where('event_role = ? and conference_id = ?', 'submitter', id).
|
||||||
limit(limit).group(:person_id)
|
limit(limit).group(:user_id)
|
||||||
|
|
||||||
counter = submitter.order('count_all desc').count
|
counter = submitter.order('count_all desc').count
|
||||||
Conference.calculate_person_submission_hash(submitter, counter)
|
Conference.calculate_user_submission_hash(submitter, counter)
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
@ -685,16 +683,16 @@ class Conference < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Returns a hash with person => submissions ordered by submissions for all conferences
|
# Returns a hash with user => submissions ordered by submissions for all conferences
|
||||||
#
|
#
|
||||||
# ====Returns
|
# ====Returns
|
||||||
# * +hash+ -> person: submissions
|
# * +hash+ -> user: submissions
|
||||||
def self.calculate_person_submission_hash(submitters, counter)
|
def self.calculate_user_submission_hash(submitters, counter)
|
||||||
result = ActiveSupport::OrderedHash.new
|
result = ActiveSupport::OrderedHash.new
|
||||||
counter.each do |key, value|
|
counter.each do |key, value|
|
||||||
submitter = submitters.where(person_id: key).first
|
submitter = submitters.where(user_id: key).first
|
||||||
if submitter
|
if submitter
|
||||||
result[submitter.person] = value
|
result[submitter.user] = value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
result
|
result
|
||||||
|
|
@ -720,9 +718,10 @@ class Conference < ActiveRecord::Base
|
||||||
# Creates a UID for the conference. Used as before_create.
|
# Creates a UID for the conference. Used as before_create.
|
||||||
#
|
#
|
||||||
def generate_guid
|
def generate_guid
|
||||||
begin
|
guid = SecureRandom.urlsafe_base64
|
||||||
guid = SecureRandom.urlsafe_base64
|
# begin
|
||||||
end while Person.where(:guid => guid).exists?
|
# guid = SecureRandom.urlsafe_base64
|
||||||
|
# end # while User.where(:guid => guid).exists?
|
||||||
self.guid = guid
|
self.guid = guid
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ class DatatableSupporters < Datatable
|
||||||
items.each do |i|
|
items.each do |i|
|
||||||
item = []
|
item = []
|
||||||
if i.name.blank?
|
if i.name.blank?
|
||||||
if !i.registration.nil? && !i.registration.person.nil?
|
if !i.registration.nil? && !i.registration.user.nil?
|
||||||
item << i.registration.person.public_name
|
item << i.registration.user.name
|
||||||
else
|
else
|
||||||
item << "Unknown"
|
item << "Unknown"
|
||||||
end
|
end
|
||||||
|
|
@ -15,8 +15,8 @@ class DatatableSupporters < Datatable
|
||||||
end
|
end
|
||||||
|
|
||||||
if i.email.blank?
|
if i.email.blank?
|
||||||
if !i.registration.nil? && !i.registration.person.nil?
|
if !i.registration.nil? && !i.registration.user.nil?
|
||||||
item << i.registration.person.email
|
item << i.registration.user.email
|
||||||
else
|
else
|
||||||
item << "Unknown"
|
item << "Unknown"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ class EmailSettings < ActiveRecord::Base
|
||||||
:registration_email_template, :accepted_email_template, :rejected_email_template, :confirmed_email_template,
|
:registration_email_template, :accepted_email_template, :rejected_email_template, :confirmed_email_template,
|
||||||
:registration_subject, :accepted_subject, :rejected_subject, :confirmed_without_registration_subject
|
:registration_subject, :accepted_subject, :rejected_subject, :confirmed_without_registration_subject
|
||||||
|
|
||||||
def get_values(conference, person, event = nil)
|
def get_values(conference, user, event = nil)
|
||||||
h = {
|
h = {
|
||||||
"email" => person.email,
|
"email" => user.email,
|
||||||
"name" => person.public_name,
|
"name" => user.name,
|
||||||
"conference" => conference.title,
|
"conference" => conference.title,
|
||||||
"registrationlink" => Rails.application.routes.url_helpers.register_conference_url(conference.short_title, :host => CONFIG["url_for_emails"])
|
"registrationlink" => Rails.application.routes.url_helpers.register_conference_url(conference.short_title, :host => CONFIG["url_for_emails"])
|
||||||
}
|
}
|
||||||
|
|
@ -18,8 +18,8 @@ class EmailSettings < ActiveRecord::Base
|
||||||
h
|
h
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_registration_email(conference, person)
|
def generate_registration_email(conference, user)
|
||||||
values = get_values(conference, person)
|
values = get_values(conference, user)
|
||||||
template = self.registration_email_template
|
template = self.registration_email_template
|
||||||
parse_template(template, values)
|
parse_template(template, values)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
class Event < ActiveRecord::Base
|
class Event < ActiveRecord::Base
|
||||||
include ActiveRecord::Transitions
|
include ActiveRecord::Transitions
|
||||||
has_paper_trail
|
has_paper_trail
|
||||||
attr_accessible :title, :subtitle, :abstract, :description, :event_type_id, :people_attributes, :person, :proposal_additional_speakers, :track_id, :media_id, :media_type, :require_registration, :difficulty_level_id
|
attr_accessible :title, :subtitle, :abstract, :description, :event_type_id, :users_attributes, :user, :proposal_additional_speakers, :track_id, :media_id, :media_type, :require_registration, :difficulty_level_id
|
||||||
|
|
||||||
acts_as_commentable
|
acts_as_commentable
|
||||||
|
|
||||||
after_create :set_week
|
after_create :set_week
|
||||||
|
|
||||||
has_many :event_people, :dependent => :destroy
|
has_many :event_users, :dependent => :destroy
|
||||||
has_many :event_attachments, :dependent => :destroy
|
has_many :event_attachments, :dependent => :destroy
|
||||||
has_many :people, :through => :event_people
|
has_many :users, :through => :event_users
|
||||||
has_many :speakers, :through => :event_people, :source => :person
|
has_many :speakers, :through => :event_users, :source => :user
|
||||||
has_many :votes
|
has_many :votes
|
||||||
has_many :voters, :through => :votes, :source => :person
|
has_many :voters, :through => :votes, :source => :user
|
||||||
belongs_to :event_type
|
belongs_to :event_type
|
||||||
|
|
||||||
has_and_belongs_to_many :registrations
|
has_and_belongs_to_many :registrations
|
||||||
|
|
@ -22,9 +22,9 @@ class Event < ActiveRecord::Base
|
||||||
belongs_to :difficulty_level
|
belongs_to :difficulty_level
|
||||||
belongs_to :conference
|
belongs_to :conference
|
||||||
|
|
||||||
accepts_nested_attributes_for :event_people, :allow_destroy => true
|
accepts_nested_attributes_for :event_users, :allow_destroy => true
|
||||||
accepts_nested_attributes_for :event_attachments, :allow_destroy => true, :reject_if => :all_blank
|
accepts_nested_attributes_for :event_attachments, :allow_destroy => true, :reject_if => :all_blank
|
||||||
accepts_nested_attributes_for :people
|
accepts_nested_attributes_for :users
|
||||||
before_create :generate_guid
|
before_create :generate_guid
|
||||||
|
|
||||||
validate :abstract_limit
|
validate :abstract_limit
|
||||||
|
|
@ -63,8 +63,8 @@ class Event < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def voted?(event, person)
|
def voted?(event, user)
|
||||||
event.votes.where("person_id = ?", person).first
|
event.votes.where("user_id = ?", user).first
|
||||||
end
|
end
|
||||||
|
|
||||||
def average_rating
|
def average_rating
|
||||||
|
|
@ -77,18 +77,18 @@ class Event < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def submitter
|
def submitter
|
||||||
result = self.event_people.where(:event_role => "submitter").first
|
result = self.event_users.where(:event_role => "submitter").first
|
||||||
if !result.nil?
|
if !result.nil?
|
||||||
result.person
|
result.user
|
||||||
else
|
else
|
||||||
person = nil
|
user = nil
|
||||||
# Perhaps the event_people haven't been saved, if this is a new proposal
|
# Perhaps the event_users haven't been saved, if this is a new proposal
|
||||||
self.event_people.each do |p|
|
self.event_users.each do |p|
|
||||||
if p.event_role == "submitter"
|
if p.event_role == "submitter"
|
||||||
person = p.person
|
user = p.user
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
person
|
user
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -122,7 +122,7 @@ class Event < ActiveRecord::Base
|
||||||
|
|
||||||
def process_confirmation
|
def process_confirmation
|
||||||
if self.conference.email_settings.send_on_confirmed_without_registration?
|
if self.conference.email_settings.send_on_confirmed_without_registration?
|
||||||
if self.conference.registrations.where(:person_id => self.submitter.id).first.nil?
|
if self.conference.registrations.where(:user_id => self.submitter.id).first.nil?
|
||||||
Mailbot.confirm_reminder_mail(self).deliver
|
Mailbot.confirm_reminder_mail(self).deliver
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -194,7 +194,7 @@ class Event < ActiveRecord::Base
|
||||||
|
|
||||||
def biography_exists
|
def biography_exists
|
||||||
if self.submitter.biography_word_count == 0
|
if self.submitter.biography_word_count == 0
|
||||||
errors.add(:person_biography, "must be filled out")
|
errors.add(:user_biography, "must be filled out")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
class EventPerson < ActiveRecord::Base
|
class EventUser < ActiveRecord::Base
|
||||||
attr_accessible :event, :person, :person_id, :event_role
|
attr_accessible :event, :user, :user_id, :event_role
|
||||||
# TODO Do we need these roles?
|
# TODO Do we need these roles?
|
||||||
ROLES = [["Speaker","speaker"], ["Submitter","submitter"], ["Moderator","moderator"]]
|
ROLES = [["Speaker","speaker"], ["Submitter","submitter"], ["Moderator","moderator"]]
|
||||||
|
|
||||||
belongs_to :event
|
belongs_to :event
|
||||||
belongs_to :person
|
belongs_to :user
|
||||||
end
|
end
|
||||||
|
|
@ -1,97 +0,0 @@
|
||||||
class Person < ActiveRecord::Base
|
|
||||||
include Gravtastic
|
|
||||||
gravtastic :size => 32
|
|
||||||
|
|
||||||
attr_accessible :email, :first_name, :last_name, :public_name, :biography, :company, :avatar, :irc_nickname, :mobile, :tshirt, :languages, :volunteer_experience
|
|
||||||
|
|
||||||
belongs_to :user, :inverse_of => :person
|
|
||||||
has_many :event_people, :dependent => :destroy
|
|
||||||
has_many :events, -> { uniq }, :through => :event_people
|
|
||||||
has_many :registrations, :dependent => :destroy
|
|
||||||
has_many :votes, :dependent => :destroy
|
|
||||||
has_many :voted_events, :through => :votes, :source => :events
|
|
||||||
|
|
||||||
validates :first_name, :presence => true
|
|
||||||
validates :last_name, :presence => true
|
|
||||||
validates :email, :presence => true
|
|
||||||
validate :biography_limit
|
|
||||||
|
|
||||||
before_create :generate_guid
|
|
||||||
before_save :set_public_name
|
|
||||||
|
|
||||||
has_attached_file :avatar,
|
|
||||||
:styles => {:tiny => "16x16>", :small => "32x32>", :large => "128x128>"},
|
|
||||||
:default_url => "person_:style.png"
|
|
||||||
validates_attachment_content_type :avatar, :content_type => [/jpg/, /jpeg/, /png/, /gif/]
|
|
||||||
|
|
||||||
alias_attribute :affiliation, :company
|
|
||||||
|
|
||||||
def to_s
|
|
||||||
if self.public_name.empty?
|
|
||||||
self.first_name + " " + self.last_name
|
|
||||||
else
|
|
||||||
self.public_name
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def attending_conference? conference
|
|
||||||
Registration.where(:conference_id => conference.id,
|
|
||||||
:person_id => self.id).count
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
def proposals conference
|
|
||||||
events.where('conference_id = ? AND event_people.event_role=?', conference.id, 'submitter')
|
|
||||||
end
|
|
||||||
|
|
||||||
def proposal_count conference
|
|
||||||
proposals(conference).count
|
|
||||||
end
|
|
||||||
|
|
||||||
def biography_word_count
|
|
||||||
if self.biography.nil?
|
|
||||||
0
|
|
||||||
else
|
|
||||||
self.biography.split.size
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.find_person_by_user_id user_id
|
|
||||||
Person.where(:user_id => user_id).first
|
|
||||||
end
|
|
||||||
|
|
||||||
def confirmed?
|
|
||||||
if User.exists?(self.user_id)
|
|
||||||
user = User.find(self.user_id)
|
|
||||||
if user.confirmed?
|
|
||||||
true
|
|
||||||
else
|
|
||||||
false
|
|
||||||
end
|
|
||||||
else
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
def biography_limit
|
|
||||||
if !self.biography.nil? && self.biography.split.size > 150
|
|
||||||
errors.add(:abstract, "cannot have more than 150 words")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_public_name
|
|
||||||
if public_name.blank?
|
|
||||||
self.public_name = ""
|
|
||||||
self.public_name = "#{first_name} #{last_name}" if !first_name.blank? && !last_name.blank?
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def generate_guid
|
|
||||||
begin
|
|
||||||
guid = SecureRandom.urlsafe_base64
|
|
||||||
end while Person.where(:guid => guid).exists?
|
|
||||||
self.guid = guid
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
class Registration < ActiveRecord::Base
|
class Registration < ActiveRecord::Base
|
||||||
belongs_to :person
|
belongs_to :user
|
||||||
belongs_to :conference
|
belongs_to :conference
|
||||||
belongs_to :dietary_choice
|
belongs_to :dietary_choice
|
||||||
|
|
||||||
|
|
@ -10,27 +10,21 @@ class Registration < ActiveRecord::Base
|
||||||
has_and_belongs_to_many :qanswers
|
has_and_belongs_to_many :qanswers
|
||||||
has_and_belongs_to_many :vchoices
|
has_and_belongs_to_many :vchoices
|
||||||
|
|
||||||
attr_accessible :person_id, :conference_id, :attending_social_events, :attending_with_partner,
|
attr_accessible :user_id, :conference_id, :attending_social_events, :attending_with_partner,
|
||||||
:using_affiliated_lodging, :arrival, :departure, :person_attributes, :other_dietary_choice, :dietary_choice_id,
|
:using_affiliated_lodging, :arrival, :departure, :user_attributes, :other_dietary_choice, :dietary_choice_id,
|
||||||
:handicapped_access_required, :supporter_registration_attributes, :social_event_ids, :other_special_needs,
|
:handicapped_access_required, :supporter_registration_attributes, :social_event_ids, :other_special_needs,
|
||||||
:event_ids, :attended, :volunteer, :vchoice_ids,
|
:event_ids, :attended, :volunteer, :vchoice_ids,
|
||||||
:qanswer_ids, :qanswers_attributes
|
:qanswer_ids, :qanswers_attributes
|
||||||
|
|
||||||
accepts_nested_attributes_for :person
|
accepts_nested_attributes_for :user
|
||||||
accepts_nested_attributes_for :supporter_registration
|
accepts_nested_attributes_for :supporter_registration
|
||||||
accepts_nested_attributes_for :social_events
|
accepts_nested_attributes_for :social_events
|
||||||
accepts_nested_attributes_for :qanswers
|
accepts_nested_attributes_for :qanswers
|
||||||
|
|
||||||
delegate :first_name, :to => :person
|
delegate :name, :to => :user
|
||||||
delegate :last_name, :to => :person
|
delegate :email, :to => :user
|
||||||
delegate :public_name, :to => :person
|
delegate :nickname, :to => :user
|
||||||
delegate :email, :to => :person
|
delegate :affiliation, :to => :user
|
||||||
delegate :irc_nickname, :to => :person
|
|
||||||
delegate :company, :to => :person
|
|
||||||
delegate :mobile, :to => :person
|
|
||||||
delegate :languages, :to => :person
|
|
||||||
delegate :volunteer_experience, :to => :person
|
|
||||||
delegate :tshirt, :to => :person
|
|
||||||
|
|
||||||
alias_attribute :other_needs, :other_special_needs
|
alias_attribute :other_needs, :other_special_needs
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,10 @@ class Room < ActiveRecord::Base
|
||||||
private
|
private
|
||||||
|
|
||||||
def generate_guid
|
def generate_guid
|
||||||
begin
|
guid = SecureRandom.urlsafe_base64
|
||||||
guid = SecureRandom.urlsafe_base64
|
# begin
|
||||||
end while Person.where(:guid => guid).exists?
|
# guid = SecureRandom.urlsafe_base64
|
||||||
|
# end while Person.where(:guid => guid).exists?
|
||||||
self.guid = guid
|
self.guid = guid
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
class SupporterRegistration < ActiveRecord::Base
|
class SupporterRegistration < ActiveRecord::Base
|
||||||
belongs_to :supporter_level
|
belongs_to :supporter_level
|
||||||
belongs_to :registration
|
belongs_to :registration
|
||||||
before_save :set_attributes_from_person
|
before_save :set_attributes_from_user
|
||||||
|
|
||||||
attr_accessible :registration, :supporter_level_id, :name, :email, :supporter_level, :code, :code_is_valid, :conference_id
|
attr_accessible :registration, :supporter_level_id, :name, :email, :supporter_level, :code, :code_is_valid, :conference_id
|
||||||
|
|
||||||
def set_attributes_from_person
|
def set_attributes_from_user
|
||||||
self.name ||= registration.try(:person).try(:public_name)
|
self.name ||= registration.try(:user).try(:name)
|
||||||
self.email ||= registration.try(:person).try(:email)
|
self.email ||= registration.try(:user).try(:email)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,10 @@ class Track < ActiveRecord::Base
|
||||||
private
|
private
|
||||||
|
|
||||||
def generate_guid
|
def generate_guid
|
||||||
begin
|
guid = SecureRandom.urlsafe_base64
|
||||||
guid = SecureRandom.urlsafe_base64
|
# begin
|
||||||
end while Person.where(:guid => guid).exists?
|
# guid = SecureRandom.urlsafe_base64
|
||||||
|
# end while Person.where(:guid => guid).exists?
|
||||||
self.guid = guid
|
self.guid = guid
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
class User < ActiveRecord::Base
|
class User < ActiveRecord::Base
|
||||||
|
include Gravtastic
|
||||||
|
gravtastic :size => 32
|
||||||
|
|
||||||
|
|
||||||
# Include default devise modules. Others available are:
|
# Include default devise modules. Others available are:
|
||||||
# :token_authenticatable, :confirmable,
|
# :token_authenticatable, :confirmable,
|
||||||
|
|
@ -8,18 +11,22 @@ class User < ActiveRecord::Base
|
||||||
:omniauthable, omniauth_providers: [:novell, :google, :facebook]
|
:omniauthable, omniauth_providers: [:novell, :google, :facebook]
|
||||||
|
|
||||||
has_and_belongs_to_many :roles
|
has_and_belongs_to_many :roles
|
||||||
has_one :person, :inverse_of => :user
|
|
||||||
has_many :openids
|
has_many :openids
|
||||||
|
|
||||||
attr_accessible :email, :password, :password_confirmation, :remember_me, :role_id, :role_ids,
|
attr_accessible :email, :password, :password_confirmation, :remember_me, :role_id, :role_ids,
|
||||||
:person_attributes
|
:name, :email_public, :biography, :nickname, :affiliation
|
||||||
accepts_nested_attributes_for :person
|
|
||||||
|
has_many :event_users, :dependent => :destroy
|
||||||
|
has_many :events, -> { uniq }, :through => :event_users
|
||||||
|
has_many :registrations, :dependent => :destroy
|
||||||
|
has_many :votes, :dependent => :destroy
|
||||||
|
has_many :voted_events, :through => :votes, :source => :events
|
||||||
|
|
||||||
accepts_nested_attributes_for :roles
|
accepts_nested_attributes_for :roles
|
||||||
|
|
||||||
before_create :setup_role
|
before_create :setup_role
|
||||||
before_create :create_person
|
|
||||||
|
|
||||||
delegate :last_name, :first_name, :public_name, to: :person
|
validates :name, presence: true
|
||||||
|
|
||||||
# Searches for user based on email. Returns found user or new user.
|
# Searches for user based on email. Returns found user or new user.
|
||||||
# ====Returns
|
# ====Returns
|
||||||
|
|
@ -33,6 +40,7 @@ class User < ActiveRecord::Base
|
||||||
|
|
||||||
if user.new_record?
|
if user.new_record?
|
||||||
user.email = auth.info.email
|
user.email = auth.info.email
|
||||||
|
user.name = auth.info.name
|
||||||
user.password = Devise.friendly_token[0, 20]
|
user.password = Devise.friendly_token[0, 20]
|
||||||
user.skip_confirmation!
|
user.skip_confirmation!
|
||||||
end
|
end
|
||||||
|
|
@ -50,33 +58,70 @@ class User < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup_role
|
def setup_role
|
||||||
roles << Role.find_by(name: 'Admin') if User.count == 0
|
roles << Role.where(name: 'Admin') if User.count == 0
|
||||||
roles << Role.find_by(name: 'Participant') if roles.empty?
|
roles << Role.where(name: 'Participant') if roles.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def popup_details
|
def self.prepare(params)
|
||||||
details = "<b>Sign-in Count</b><br>"
|
email = params['email']
|
||||||
details += "#{self.sign_in_count}<br>"
|
user = User.where(email: email).first_or_initialize
|
||||||
details += "<b>Current Sign-in</b><br>"
|
|
||||||
details += "#{self.current_sign_in_at}<br>"
|
# If there is a new user, add the necessary attributes
|
||||||
details += "<b>Last Sign-in</b><br>"
|
if user.new_record?
|
||||||
details += "#{self.last_sign_in_at}<br>"
|
user.password = Devise.friendly_token[0,20]
|
||||||
details += "<b>Current Sign-in IP</b><br>"
|
user.skip_confirmation!
|
||||||
details += "#{self.current_sign_in_ip}<br>"
|
user.attributes = params
|
||||||
details += "<b>Last Sign-in IP</b><br>"
|
end
|
||||||
details += "#{self.last_sign_in_ip}<br>"
|
|
||||||
details += "<b>Created at</b><br>"
|
user
|
||||||
details += "#{self.created_at}<br>"
|
end
|
||||||
|
|
||||||
|
def registered
|
||||||
|
registrations = self.registrations
|
||||||
|
if registrations.count == 0
|
||||||
|
'None'
|
||||||
|
else
|
||||||
|
registrations.map { |r| r.conference.title }.join ', '
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def attended
|
||||||
|
registrations_attended = self.registrations.where(attended: true)
|
||||||
|
if registrations_attended.count == 0
|
||||||
|
'None'
|
||||||
|
else
|
||||||
|
registrations_attended.map { |r| r.conference.title }.join ', '
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def confirmed?
|
def confirmed?
|
||||||
!confirmed_at.nil?
|
!confirmed_at.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
def attending_conference? conference
|
||||||
def create_person
|
Registration.where(:conference_id => conference.id,
|
||||||
# TODO Search people for existing email address, add to their account
|
:user_id => self.id).count
|
||||||
build_person(email: email) if person.nil?
|
|
||||||
true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def proposals conference
|
||||||
|
events.where('conference_id = ? AND event_users.event_role=?', conference.id, 'submitter')
|
||||||
|
end
|
||||||
|
|
||||||
|
def proposal_count conference
|
||||||
|
proposals(conference).count
|
||||||
|
end
|
||||||
|
|
||||||
|
def biography_word_count
|
||||||
|
if self.biography.nil?
|
||||||
|
0
|
||||||
|
else
|
||||||
|
self.biography.split.size
|
||||||
|
end
|
||||||
|
end
|
||||||
|
private
|
||||||
|
def biography_limit
|
||||||
|
if !self.biography.nil? && self.biography.split.size > 150
|
||||||
|
errors.add(:abstract, "cannot have more than 150 words")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
class Vote < ActiveRecord::Base
|
class Vote < ActiveRecord::Base
|
||||||
attr_accessible :rating
|
attr_accessible :rating
|
||||||
|
|
||||||
belongs_to :person
|
belongs_to :user
|
||||||
belongs_to :event
|
belongs_to :event
|
||||||
|
|
||||||
delegate :first_name, :to => :person
|
delegate :name, :to => :user
|
||||||
delegate :last_name, :to => :person
|
|
||||||
delegate :public_name, :to => :person
|
|
||||||
end
|
end
|
||||||
|
|
@ -10,8 +10,8 @@ class EventSerializer < ActiveModel::Serializer
|
||||||
end
|
end
|
||||||
|
|
||||||
def speaker_ids
|
def speaker_ids
|
||||||
speakers = object.event_people.select {|i| i.event_role == "speaker" }
|
speakers = object.event_users.select {|i| i.event_role == "speaker" }
|
||||||
speakers.map {|i| i.person.guid}
|
speakers.map {|i| i.user.id}
|
||||||
end
|
end
|
||||||
|
|
||||||
def type
|
def type
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,10 @@
|
||||||
class SpeakerSerializer < ActiveModel::Serializer
|
class SpeakerSerializer < ActiveModel::Serializer
|
||||||
include ActionView::Helpers::TextHelper
|
include ActionView::Helpers::TextHelper
|
||||||
|
|
||||||
attributes :guid, :name, :full_name, :company, :biography
|
attributes :guid, :name, :affiliation, :biography
|
||||||
|
|
||||||
def name
|
def name
|
||||||
object.public_name
|
object.name
|
||||||
end
|
|
||||||
|
|
||||||
def full_name
|
|
||||||
[object.first_name, object.last_name].join(" ")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def biography
|
def biography
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
%tbody
|
%tbody
|
||||||
%tr
|
%tr
|
||||||
%td #{index + 1}
|
%td #{index + 1}
|
||||||
%td #{registration.public_name}
|
%td #{registration.name}
|
||||||
%td #{registration.conference.title}
|
%td #{registration.conference.title}
|
||||||
%td #{registration.created_at.strftime('%m/%d/%Y')}
|
%td #{registration.created_at.strftime('%m/%d/%Y')}
|
||||||
- else
|
- else
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
%tbody
|
%tbody
|
||||||
%tr
|
%tr
|
||||||
%td #{index + 1}
|
%td #{index + 1}
|
||||||
%td #{event.submitter}
|
%td #{event.submitter.name}
|
||||||
%td #{event.title}
|
%td #{event.title}
|
||||||
%td #{event.conference.title}
|
%td #{event.conference.title}
|
||||||
%td
|
%td
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
- @top_submitter.each do |key, value|
|
- @top_submitter.each do |key, value|
|
||||||
.row.top-submitter
|
.row.top-submitter
|
||||||
.col-md-2
|
.col-md-2
|
||||||
= image_tag(key.gravatar_url(size: '25'), title: "Yo #{key.public_name}!", :alt => '', 'class'=>'img-circle img-responsive text-center')
|
= image_tag(key.gravatar_url(size: '25'), title: "Yo #{key.name}!", :alt => '', 'class'=>'img-circle img-responsive text-center')
|
||||||
.col-md-10
|
.col-md-10
|
||||||
%h4
|
%h4
|
||||||
#{key}
|
#{key.name}
|
||||||
%div
|
%div
|
||||||
%small
|
%small
|
||||||
#{pluralize(value, 'submission')}
|
#{pluralize(value, 'submission')}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
.nested-fields
|
|
||||||
= f.inputs do
|
|
||||||
= f.input :email
|
|
||||||
= f.input :public_name
|
|
||||||
= remove_association_link :person, f
|
|
||||||
|
|
||||||
|
|
@ -81,7 +81,7 @@
|
||||||
%td
|
%td
|
||||||
%b Submitter
|
%b Submitter
|
||||||
%td
|
%td
|
||||||
= link_to @event.submitter.public_name, admin_person_path(@event.submitter)
|
= link_to @event.submitter.name, admin_user_path(@event.submitter)
|
||||||
(
|
(
|
||||||
= link_to @event.submitter.email, "mailto: #{@event.submitter.email}"
|
= link_to @event.submitter.email, "mailto: #{@event.submitter.email}"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
6
app/views/admin/events/_user_fields.html.haml
Normal file
6
app/views/admin/events/_user_fields.html.haml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
.nested-fields
|
||||||
|
= f.inputs do
|
||||||
|
= f.input :email
|
||||||
|
= f.input :name
|
||||||
|
= remove_association_link :user, f
|
||||||
|
|
||||||
|
|
@ -21,14 +21,14 @@
|
||||||
= @event.voters.length
|
= @event.voters.length
|
||||||
- if @event.voters.length > 0
|
- if @event.voters.length > 0
|
||||||
(
|
(
|
||||||
= @ratings.map {|x| "#{x.first_name} #{x.last_name}"}.join ', '
|
= @ratings.map {|x| "#{x.name}"}.join ', '
|
||||||
)
|
)
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
%b Your vote
|
%b Your vote
|
||||||
%td
|
%td
|
||||||
- @conference.call_for_papers.rating.times do |counter|
|
- @conference.call_for_papers.rating.times do |counter|
|
||||||
- voted = @event.voted?(@event, current_user.person)
|
- voted = @event.voted?(@event, current_user)
|
||||||
- if voted && voted.rating == counter+1
|
- if voted && voted.rating == counter+1
|
||||||
= link_to "", vote_admin_conference_event_path(@conference.short_title, @event, :rating => counter+1), :remote => true, :id =>"label#{counter+1}", :class => "myrating", :voted => true
|
= link_to "", vote_admin_conference_event_path(@conference.short_title, @event, :rating => counter+1), :remote => true, :id =>"label#{counter+1}", :class => "myrating", :voted => true
|
||||||
- else
|
- else
|
||||||
|
|
@ -37,14 +37,14 @@
|
||||||
|
|
||||||
- if @ratings.length > 0
|
- if @ratings.length > 0
|
||||||
- @ratings.each do |rate|
|
- @ratings.each do |rate|
|
||||||
- unless rate.person_id == current_user.person.id
|
- unless rate.user_id == current_user.id
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
= rate.first_name
|
= rate.first_name
|
||||||
= rate.last_name
|
= rate.last_name
|
||||||
%td
|
%td
|
||||||
- @conference.call_for_papers.rating.times do |counter|
|
- @conference.call_for_papers.rating.times do |counter|
|
||||||
- voted = @event.voted?(@event, rate.person)
|
- voted = @event.voted?(@event, rate.user)
|
||||||
- if voted && voted.rating == counter+1
|
- if voted && voted.rating == counter+1
|
||||||
= label_tag "label#{counter+1}", "", :class => "othersrating", :voted => true
|
= label_tag "label#{counter+1}", "", :class => "othersrating", :voted => true
|
||||||
= javascript_tag "$('label[voted=true]').prevAll().andSelf().addClass('bright');"
|
= javascript_tag "$('label[voted=true]').prevAll().andSelf().addClass('bright');"
|
||||||
|
|
|
||||||
|
|
@ -58,14 +58,14 @@
|
||||||
- bgcolor=""
|
- bgcolor=""
|
||||||
%td{:style=>"background-color: #{bgcolor}"}
|
%td{:style=>"background-color: #{bgcolor}"}
|
||||||
- if !event.submitter.nil?
|
- if !event.submitter.nil?
|
||||||
=link_to event.submitter.public_name, admin_person_path(event.submitter)
|
=link_to event.submitter.name, admin_user_path(event.submitter)
|
||||||
- if event.submitter.registrations.count < 1
|
- if event.submitter.registrations.count < 1
|
||||||
(Unregistered!)
|
(Unregistered!)
|
||||||
- else
|
- else
|
||||||
Unknown submitter
|
Unknown submitter
|
||||||
%td
|
%td
|
||||||
- if speaker = event.speakers.first
|
- if speaker = event.speakers.first
|
||||||
= link_to speaker.public_name, admin_person_path(speaker)
|
= link_to speaker.name, admin_user_path(speaker)
|
||||||
- else
|
- else
|
||||||
Unknown speaker
|
Unknown speaker
|
||||||
- l = link_to "Change", edit_admin_conference_event_speaker_path(@conference.short_title, event), :remote => true
|
- l = link_to "Change", edit_admin_conference_event_speaker_path(@conference.short_title, event), :remote => true
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
- if !version.whodunnit.nil?
|
- if !version.whodunnit.nil?
|
||||||
= Person.find_person_by_user_id(version.whodunnit).public_name
|
= User.find(version.whodunnit).name
|
||||||
- else
|
- else
|
||||||
No user (probably via the console)
|
No user (probably via the console)
|
||||||
%td
|
%td
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
= semantic_form_for [:admin, @person] do |f|
|
|
||||||
= f.inputs "Basic Information" do
|
|
||||||
= f.input :first_name, :as => :string
|
|
||||||
= f.input :last_name, :as => :string
|
|
||||||
= f.input :public_name, :as => :string
|
|
||||||
= f.input :email
|
|
||||||
= f.input :company, :as => :string
|
|
||||||
= f.input :biography, :input_html => {:rows => 10}
|
|
||||||
= f.actions do
|
|
||||||
= f.action :submit, :button_html => {:class => "btn primary"}
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
.row
|
|
||||||
.col-md-12
|
|
||||||
.page-header
|
|
||||||
%h1
|
|
||||||
People
|
|
||||||
- if @people
|
|
||||||
= "(#{@people.length})"
|
|
||||||
= link_to "New person", new_admin_person_path, :class => "btn btn-success pull-right"
|
|
||||||
|
|
||||||
.row
|
|
||||||
.col-md-12
|
|
||||||
.well
|
|
||||||
%table.table.table-striped.table-bordered.table-hover#people
|
|
||||||
%thead
|
|
||||||
%th
|
|
||||||
%b Email
|
|
||||||
%th
|
|
||||||
%b Last Name
|
|
||||||
%th
|
|
||||||
%b First Name
|
|
||||||
%th
|
|
||||||
%b Public Name
|
|
||||||
%th
|
|
||||||
%b # of Conference Registrations
|
|
||||||
%th
|
|
||||||
%th
|
|
||||||
- @people.each do |person|
|
|
||||||
%tr
|
|
||||||
%td= person.email
|
|
||||||
%td= person.last_name
|
|
||||||
%td= person.first_name
|
|
||||||
%td= person.public_name
|
|
||||||
%td= person.registrations.count
|
|
||||||
%td= link_to "Edit", edit_admin_person_path(person)
|
|
||||||
%td= link_to "View", admin_person_path(person)
|
|
||||||
|
|
||||||
:javascript
|
|
||||||
$(document).ready(function() {
|
|
||||||
$('#people').dataTable( {
|
|
||||||
"bPaginate": false,
|
|
||||||
"bLengthChange": false
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
%table.table
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%b First Name
|
|
||||||
%td
|
|
||||||
= @person.first_name
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%b Last Name
|
|
||||||
%td
|
|
||||||
= @person.last_name
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%b Public Name
|
|
||||||
%td
|
|
||||||
= @person.public_name
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%b Company
|
|
||||||
%td
|
|
||||||
= @person.company
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%b Email
|
|
||||||
%td
|
|
||||||
= @person.email
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%b Created At
|
|
||||||
%td
|
|
||||||
= @person.created_at
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%b Updated At
|
|
||||||
%td
|
|
||||||
= @person.updated_at
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%b Biography
|
|
||||||
%td
|
|
||||||
= @person.biography
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%b Registered to attend
|
|
||||||
%td
|
|
||||||
- if @person.registrations.count == 0
|
|
||||||
None
|
|
||||||
- else
|
|
||||||
= @person.registrations.map { |r| r.conference.title }.join ','
|
|
||||||
|
|
@ -1,19 +1,15 @@
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
%h3
|
%h3
|
||||||
Edit registration of #{@person.public_name} (#{@person.email}) for #{@conference.title}
|
Edit registration of #{@user.name} (#{@user.email}) for #{@conference.title}
|
||||||
%br
|
%br
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
= semantic_form_for(@registration, :url => admin_conference_registration_path(@conference.short_title, @registration)) do |f|
|
= semantic_form_for(@registration, :url => admin_conference_registration_path(@conference.short_title, @registration)) do |f|
|
||||||
= f.inputs "Personal Information" do
|
= f.inputs "Personal Information" do
|
||||||
= f.fields_for :person do |p|
|
= f.fields_for :user do |u|
|
||||||
= p.input :first_name, :as => :string
|
= u.input :nickname, :as => :string
|
||||||
= p.input :last_name, :as => :string
|
= u.input :affiliation, :placeholder => "Company/User Group/nothing", :as => :string
|
||||||
= p.label :Nickname, :as => :string
|
|
||||||
= p.text_field :irc_nickname, :as => :string
|
|
||||||
= p.label :Affiliation
|
|
||||||
= p.text_field :company, :placeholder => "Company/User Group/nothing", :as => :string
|
|
||||||
= f.inputs "Registration Information" do
|
= f.inputs "Registration Information" do
|
||||||
- if @conference.use_supporter_levels? and @conference.supporter_levels.length > 0
|
- if @conference.use_supporter_levels? and @conference.supporter_levels.length > 0
|
||||||
= f.semantic_fields_for :supporter_registration do |reg|
|
= f.semantic_fields_for :supporter_registration do |reg|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
- @headers.each do |field|
|
- @headers.each do |field|
|
||||||
%td
|
%td
|
||||||
- if field == "name"
|
- if field == "name"
|
||||||
#{registration.last_name} #{registration.first_name} (#{registration.irc_nickname}) #{registration.company}
|
#{registration.name} #{registration.nickname} #{registration.affiliation}
|
||||||
- if registration.supporter_level && registration.supporter_level.title != 'Free'
|
- if registration.supporter_level && registration.supporter_level.title != 'Free'
|
||||||
%p{:style => "color:red"}
|
%p{:style => "color:red"}
|
||||||
= registration.supporter_level.title
|
= registration.supporter_level.title
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
= link_to "Edit", edit_admin_conference_registration_path(@conference.short_title, :id => registration), :method => :get, :class => "btn btn-primary"
|
= link_to "Edit", edit_admin_conference_registration_path(@conference.short_title, :id => registration), :method => :get, :class => "btn btn-primary"
|
||||||
|
|
||||||
%td
|
%td
|
||||||
= link_to "Delete", admin_conference_registration_path(@conference.short_title, registration), :method => :delete, :class => "btn btn-danger", data: {confirm: "Really delete registration for #{registration.public_name} #{registration.email}?"}
|
= link_to "Delete", admin_conference_registration_path(@conference.short_title, registration), :method => :delete, :class => "btn btn-danger", data: {confirm: "Really delete registration for #{registration.name} #{registration.email}?"}
|
||||||
%tr{:id => "row#{counter}", :style=>"display:none;"}
|
%tr{:id => "row#{counter}", :style=>"display:none;"}
|
||||||
%td{:colspan=>13}
|
%td{:colspan=>13}
|
||||||
= render :partial => "questions", :locals => {:registration => registration}
|
= render :partial => "questions", :locals => {:registration => registration}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
prawn_document(:force_download=>true, :filename => @pdf_filename) do |pdf|
|
prawn_document(:force_download=>true, :filename => @pdf_filename) do |pdf|
|
||||||
table_array = []
|
table_array = []
|
||||||
header_array = [" ",
|
header_array = [" ",
|
||||||
"Last Name",
|
"Name",
|
||||||
"First Name",
|
|
||||||
"Public Name",
|
|
||||||
"Email",
|
"Email",
|
||||||
"Attending Social Events",
|
"Attending Social Events",
|
||||||
"Attending With Partner",
|
"Attending With Partner",
|
||||||
|
|
@ -13,9 +11,7 @@ prawn_document(:force_download=>true, :filename => @pdf_filename) do |pdf|
|
||||||
@registrations.each do |registration|
|
@registrations.each do |registration|
|
||||||
row = []
|
row = []
|
||||||
row << ""
|
row << ""
|
||||||
row << registration.last_name
|
row << registration.name
|
||||||
row << registration.first_name
|
|
||||||
row << registration.public_name
|
|
||||||
row << registration.email
|
row << registration.email
|
||||||
if registration.attending_social_events
|
if registration.attending_social_events
|
||||||
row << "X"
|
row << "X"
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,9 @@ wb.add_worksheet(:name => "registrations") do |sheet|
|
||||||
@registrations.each do |reg|
|
@registrations.each do |reg|
|
||||||
row = []
|
row = []
|
||||||
row << reg.attended
|
row << reg.attended
|
||||||
row << "#{reg.last_name} #{reg.first_name} (#{reg.public_name})"
|
row << reg.name
|
||||||
row << reg.irc_nickname
|
row << reg.nickname
|
||||||
row << reg.company
|
row << reg.affiliation
|
||||||
row << reg.email
|
row << reg.email
|
||||||
row << reg.attending_social_events
|
row << reg.attending_social_events
|
||||||
row << reg.attending_with_partner
|
row << reg.attending_with_partner
|
||||||
|
|
|
||||||
|
|
@ -7,16 +7,11 @@
|
||||||
= semantic_form_for(@registration, :url => admin_conference_registrations_path(@conference.short_title)) do |f|
|
= semantic_form_for(@registration, :url => admin_conference_registrations_path(@conference.short_title)) do |f|
|
||||||
|
|
||||||
= f.inputs "Your details" do
|
= f.inputs "Your details" do
|
||||||
= f.fields_for @person do |p|
|
= f.fields_for @user do |u|
|
||||||
= p.fields_for @user do |u|
|
= u.input :email, :as => :string, :hint => "Please enter a valid email address. You will need it to log in to OSEM later."
|
||||||
= u.input :email, :as => :string, :hint => "Please enter a valid email address. You will need it to log in to OSEM later."
|
= u.input :name, as: :string
|
||||||
= p.input :first_name, :as => :string
|
= u.input :nickname, :as => :string
|
||||||
= p.input :last_name, :as => :string
|
= u.input :affiliation, :placeholder => "Company/User Group/nothing", :as => :string
|
||||||
= p.input :public_name, :as => :string
|
|
||||||
= p.label :Nickname
|
|
||||||
= p.text_field :irc_nickname, :as => :string
|
|
||||||
= p.label :Affiliation
|
|
||||||
= p.text_field :company, :placeholder => "Company/User Group/nothing", :as => :string
|
|
||||||
|
|
||||||
= f.inputs "Registration Information" do
|
= f.inputs "Registration Information" do
|
||||||
- if @conference.use_supporter_levels? and @conference.supporter_levels.length > 0
|
- if @conference.use_supporter_levels? and @conference.supporter_levels.length > 0
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
Assign speaker
|
Assign speaker
|
||||||
= semantic_form_for @speaker, :as => :speaker, :url => admin_conference_event_speaker_path(@conference.short_title, @event), :method => :put do |f|
|
= semantic_form_for @speaker, :as => :speaker, :url => admin_conference_event_speaker_path(@conference.short_title, @event), :method => :put do |f|
|
||||||
.form-inputs.form-horizontal.modal-body
|
.form-inputs.form-horizontal.modal-body
|
||||||
= f.collection_select(:person_id, Person.order(:public_name), :id, :public_name)
|
= f.collection_select(:user_id, User.order(:name), :id, :name)
|
||||||
|
|
||||||
.modal-footer
|
.modal-footer
|
||||||
= link_to "Close", "#", :data => {:dismiss => "modal"}, :class => 'btn'
|
= link_to "Close", "#", :data => {:dismiss => "modal"}, :class => 'btn'
|
||||||
|
|
|
||||||
|
|
@ -5,22 +5,16 @@
|
||||||
%thead
|
%thead
|
||||||
%th
|
%th
|
||||||
ID
|
ID
|
||||||
- (@speaker_fields_person + @speaker_fields_reg).each do |field|
|
- (@speaker_fields_user + @speaker_fields_reg).each do |field|
|
||||||
%th
|
%th
|
||||||
= field.capitalize
|
= field.capitalize
|
||||||
- @speakers.each do |speaker|
|
- @speakers.each do |speaker|
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
= count +=1
|
= count +=1
|
||||||
- @speaker_fields_person.each do |field|
|
- @speaker_fields_user.each do |field|
|
||||||
%td
|
%td
|
||||||
- if field == 'name'
|
= speaker.send(field.to_sym)
|
||||||
= speaker.first_name
|
|
||||||
= speaker.last_name
|
|
||||||
%br
|
|
||||||
(#{speaker.public_name})
|
|
||||||
- else
|
|
||||||
= speaker.send(field.to_sym)
|
|
||||||
- @speaker_fields_reg.each do |field|
|
- @speaker_fields_reg.each do |field|
|
||||||
%td
|
%td
|
||||||
- reg = speaker_reg(speaker)
|
- reg = speaker_reg(speaker)
|
||||||
|
|
|
||||||
8
app/views/admin/users/_form.html.haml
Normal file
8
app/views/admin/users/_form.html.haml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
= semantic_form_for [:admin, @user] do |f|
|
||||||
|
= f.inputs "Basic Information" do
|
||||||
|
= f.input :name, :as => :string
|
||||||
|
= f.input :email
|
||||||
|
= f.input :affiliation, :as => :string
|
||||||
|
= f.input :biography, :input_html => {:rows => 10}
|
||||||
|
= f.actions do
|
||||||
|
= f.action :submit, :button_html => {:class => "btn btn-primary"}
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
Users
|
Users
|
||||||
- if @users
|
- if @users
|
||||||
= "(#{@users.length})"
|
= "(#{@users.length})"
|
||||||
|
|
||||||
|
= link_to "New User", new_admin_user_path, :class => "btn btn-success pull-right"
|
||||||
.well
|
.well
|
||||||
%table.table.table-striped.table-bordered.table-hover#users
|
%table.table.table-striped.table-bordered.table-hover#users
|
||||||
%thead
|
%thead
|
||||||
|
|
@ -14,18 +16,15 @@
|
||||||
%th
|
%th
|
||||||
%b Email
|
%b Email
|
||||||
%th
|
%th
|
||||||
%b Last Name
|
%b Name
|
||||||
%th
|
%th
|
||||||
%b First Name
|
%b # of Conference Registrations
|
||||||
%th
|
|
||||||
%b Public Name
|
|
||||||
%th
|
%th
|
||||||
%b Roles
|
%b Roles
|
||||||
%th
|
%th
|
||||||
%th
|
%th
|
||||||
%th
|
%th
|
||||||
- @users.each do |user|
|
- @users.each do |user|
|
||||||
- person = Person.find_person_by_user_id(user.id)
|
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
= user.id
|
= user.id
|
||||||
|
|
@ -37,13 +36,9 @@
|
||||||
%td
|
%td
|
||||||
= user.email
|
= user.email
|
||||||
%td
|
%td
|
||||||
= user.last_name
|
= user.name
|
||||||
%td
|
%td
|
||||||
= user.first_name
|
= user.registrations.count
|
||||||
%td
|
|
||||||
= user.public_name
|
|
||||||
%td
|
|
||||||
= user.roles.map { |role| role.name }.join ','
|
|
||||||
%td
|
%td
|
||||||
.modal.fade{:id => "user-role-selection-#{user.id}", "role" => "dialog", "aria-hidden" => "true"}
|
.modal.fade{:id => "user-role-selection-#{user.id}", "role" => "dialog", "aria-hidden" => "true"}
|
||||||
.modal-dialog
|
.modal-dialog
|
||||||
|
|
@ -60,18 +55,17 @@
|
||||||
%button{:class=> "btn btn-danger", "data-dismiss"=> "modal", "aria-hidden"=>"true"}
|
%button{:class=> "btn btn-danger", "data-dismiss"=> "modal", "aria-hidden"=>"true"}
|
||||||
Cancel
|
Cancel
|
||||||
- else
|
- else
|
||||||
= "Give #{user.public_name} (#{user.email}) the following roles:"
|
= "Give #{user.name} (#{user.email}) the following roles:"
|
||||||
= semantic_form_for(user, :url => admin_user_path(user), :method => :put) do |f|
|
= semantic_form_for(user, :url => admin_user_path(user), :method => :put) do |f|
|
||||||
= f.input :roles, :label => false
|
= f.input :roles, :label => false
|
||||||
%button{:class=> "btn btn-danger", "data-dismiss"=> "modal", "aria-hidden"=>"true"}
|
%button{:class=> "btn btn-danger", "data-dismiss"=> "modal", "aria-hidden"=>"true"}
|
||||||
Cancel
|
Cancel
|
||||||
= f.action :submit, :as => :button, :button_html => {:value => "Save", :class => "btn btn-primary"}
|
= f.action :submit, :as => :button, :button_html => {:value => "Save", :class => "btn btn-primary"}
|
||||||
=link_to "Modify Roles", "#", "data-toggle" => "modal", "data-target" => "#user-role-selection-#{user.id}",id: "user-modify-role-#{user.id}"
|
=link_to "#{user.roles.map { |role| role.name }.join ', '}", "#", "data-toggle" => "modal", "data-target" => "#user-role-selection-#{user.id}",id: "user-modify-role-#{user.id}"
|
||||||
%td
|
%td
|
||||||
=link_to "Details", "javascript: void(0)", :class => "user-details-popover", "data-trigger" => "click", "data-placement" => "bottom",
|
= link_to "Edit", edit_admin_user_path(user)
|
||||||
"data-html" => "true",
|
%td
|
||||||
"data-content" => user.popup_details,
|
= link_to "View", admin_user_path(user)
|
||||||
"data-original-title" => ""
|
|
||||||
%td
|
%td
|
||||||
- if current_user.id == user.id or user.role_ids.include? 3
|
- if current_user.id == user.id or user.role_ids.include? 3
|
||||||
=link_to 'Delete',admin_user_path(user), :method => :delete , :data => {:confirm => 'Are you sure ?'}, :disabled => true,:class => "btn btn-primary disabled btn-danger",:role => "button"
|
=link_to 'Delete',admin_user_path(user), :method => :delete , :data => {:confirm => 'Are you sure ?'}, :disabled => true,:class => "btn btn-primary disabled btn-danger",:role => "button"
|
||||||
|
|
|
||||||
7
app/views/admin/users/show.html.haml
Normal file
7
app/views/admin/users/show.html.haml
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
%table.table
|
||||||
|
- @show_attributes.each do |attr|
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
%b
|
||||||
|
= attr.capitalize.gsub('_', ' ')
|
||||||
|
%td= @user.send(attr)
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
%h3
|
%h3
|
||||||
Registration for
|
Registration for
|
||||||
= @conference.title
|
= @conference.title
|
||||||
- if @person.proposal_count(@conference) > 0
|
- if @user.proposal_count(@conference) > 0
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
%i
|
%i
|
||||||
|
|
@ -14,8 +14,8 @@
|
||||||
%br
|
%br
|
||||||
Your public name (required)
|
Your public name (required)
|
||||||
%br
|
%br
|
||||||
= f.fields_for :person do |p|
|
= f.fields_for :user do |p|
|
||||||
= p.text_field :public_name, :for => :person
|
= p.input :name
|
||||||
|
|
||||||
- if @conference.questions
|
- if @conference.questions
|
||||||
= render :partial => "questions", :locals => {:f => f}
|
= render :partial => "questions", :locals => {:f => f}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
= f.input :volunteer, :label => "Click here if you want to become a volunteer at #{@conference.short_title}", :input_html => {:maxlength => 15, :size => 40}
|
= f.input :volunteer, :label => "Click here if you want to become a volunteer at #{@conference.short_title}", :input_html => {:maxlength => 15, :size => 40}
|
||||||
= f.fields_for :person do |p|
|
= f.fields_for :user do |u|
|
||||||
= render :partial => 'devise/registrations/volunteerperson', :locals => {:p => p}
|
= render :partial => 'devise/registrations/volunteeruser', :locals => {:u => u}
|
||||||
|
|
||||||
%br
|
%br
|
||||||
- if @conference.vpositions.count > 0
|
- if @conference.vpositions.count > 0
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
=p.input :mobile, :label => "Mobile No (Include country code)", :input_html => {:placeholder => "Eg. +336812345679"}, :hint => "Only visible to org team & volunteer coordinator"
|
|
||||||
|
|
||||||
=p.input :tshirt, :label => "Tshirt Size", :collection => [["Choose", nil],["XS","XS"],["S","S"],["M", "M"], ["L", "L"], ["XL", "XL"], ["XXL", "XXL"], ["XXXL", "XXXL"], ["Girl-S","Girl-s"], ["Girl-M","Girl-M"], ["Girl-L","Girl-L"], ["Girl-XL","Girl-XL"]]
|
|
||||||
|
|
||||||
=p.input :languages, :label => "Which languages do you speak", :hint => "Start from the one you speak best and use 2 letter symbolization, eg. EN, GR, DE"
|
|
||||||
|
|
||||||
= p.input :volunteer_experience, :label => "Do you have any past experience?", :input_html => {:rows => 3, :class => "span6"}
|
|
||||||
7
app/views/devise/registrations/_volunteeruser.html.haml
Normal file
7
app/views/devise/registrations/_volunteeruser.html.haml
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
= u.input :mobile, :label => "Mobile No (Include country code)", :input_html => {:placeholder => "Eg. +336812345679"}, :hint => "Only visible to org team & volunteer coordinator"
|
||||||
|
|
||||||
|
= u.input :tshirt, :label => "Tshirt Size", :collection => [["Choose", nil],["XS","XS"],["S","S"],["M", "M"], ["L", "L"], ["XL", "XL"], ["XXL", "XXL"], ["XXXL", "XXXL"], ["Girl-S","Girl-s"], ["Girl-M","Girl-M"], ["Girl-L","Girl-L"], ["Girl-XL","Girl-XL"]]
|
||||||
|
|
||||||
|
= u.input :languages, :label => "Which languages do you speak", :hint => "Start from the one you speak best and use 2 letter symbolization, eg. EN, GR, DE"
|
||||||
|
|
||||||
|
= u.input :volunteer_experience, :label => "Do you have any past experience?", :input_html => {:rows => 3, :class => "span6"}
|
||||||
|
|
@ -2,19 +2,17 @@
|
||||||
.col-md-12
|
.col-md-12
|
||||||
= semantic_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f|
|
= semantic_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f|
|
||||||
= f.inputs :name => "Profile" do
|
= f.inputs :name => "Profile" do
|
||||||
= f.fields_for :person do |p|
|
= f.fields_for :user do |u|
|
||||||
= p.input :first_name, :as => :string
|
= u.input :name, :as => :string
|
||||||
= p.input :last_name, :as => :string
|
= u.input :nickname, :as => :string
|
||||||
= p.input :public_name, :as => :string
|
= u.input :affiliation, :as => :string, :hint => "This could be a company, a user group, or nothing at all."
|
||||||
= p.input :irc_nickname, :label => "IRC nick:", :as => :string
|
= u.input :biography, :input_html => {:rows => 5, "onkeyup" => "word_count(this, 'biography-count', 150)"}
|
||||||
= p.input :company, :label => "Affiliation", :as => :string, :hint => "This could be a company, a user group, or nothing at all."
|
|
||||||
= p.input :biography, :input_html => {:rows => 5, "onkeyup" => "word_count(this, 'biography-count', 150)"}, :for => :person
|
|
||||||
You have used
|
You have used
|
||||||
%span#biography-count #{current_user.person.biography_word_count}
|
%span#biography-count #{current_user.biography_word_count}
|
||||||
words. Biographies are limited to 150 words.
|
words. Biographies are limited to 150 words.
|
||||||
%br
|
%br
|
||||||
%br
|
%br
|
||||||
= render :partial => 'devise/registrations/volunteerperson', :locals => {:p => p}
|
= render :partial => 'devise/registrations/volunteeruser', :locals => {:u => u}
|
||||||
= f.inputs :name => 'OpenID' do
|
= f.inputs :name => 'OpenID' do
|
||||||
%h4
|
%h4
|
||||||
Currently using the following openIDs:
|
Currently using the following openIDs:
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
.well
|
.well
|
||||||
= semantic_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
|
= semantic_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
|
||||||
= f.input :email
|
= f.input :email
|
||||||
|
= f.input :name, required: true
|
||||||
= f.input :password
|
= f.input :password
|
||||||
= f.input :password_confirmation
|
= f.input :password_confirmation
|
||||||
= f.action :submit, as: :button, label: 'Sign Up', button_html: {class: 'btn btn-primary'}
|
= f.action :submit, as: :button, label: 'Sign Up', button_html: {class: 'btn btn-primary'}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
- else
|
- else
|
||||||
= link_to "Register", register_conference_path(conference.short_title), :class =>"btn btn-success"
|
= link_to "Register", register_conference_path(conference.short_title), :class =>"btn btn-success"
|
||||||
= link_to "Schedule", conference_schedule_path(conference.short_title), :class =>"btn btn-default" if conference.call_for_papers and conference.call_for_papers.schedule_public
|
= link_to "Schedule", conference_schedule_path(conference.short_title), :class =>"btn btn-default" if conference.call_for_papers and conference.call_for_papers.schedule_public
|
||||||
- if !current_user.nil? && current_user.person.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 "View 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"
|
||||||
|
|
@ -24,7 +24,3 @@
|
||||||
= link_to(admin_users_path) do
|
= link_to(admin_users_path) do
|
||||||
%span.glyphicon.glyphicon-user
|
%span.glyphicon.glyphicon-user
|
||||||
Users
|
Users
|
||||||
%li
|
|
||||||
= link_to(admin_people_path) do
|
|
||||||
%span.glyphicon.glyphicon-star-empty
|
|
||||||
People
|
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,11 @@
|
||||||
%ul.nav.navbar-nav.navbar-right
|
%ul.nav.navbar-nav.navbar-right
|
||||||
%li.dropdown
|
%li.dropdown
|
||||||
%a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#", id: "current-user-detail"}
|
%a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#", id: "current-user-detail"}
|
||||||
- if not current_user.person.public_name.empty?
|
- if not current_user.name.empty?
|
||||||
#{current_user.person.public_name}
|
#{current_user.name}
|
||||||
-else
|
-else
|
||||||
#{current_user.email}
|
#{current_user.email}
|
||||||
= image_tag(current_user.person.gravatar_url(size: '18'), title: "Yo #{current_user.person.public_name}!", :alt => '')
|
= image_tag(current_user.gravatar_url(size: '18'), title: "Yo #{current_user.name}!", :alt => '')
|
||||||
%b.caret
|
%b.caret
|
||||||
%ul.dropdown-menu
|
%ul.dropdown-menu
|
||||||
= render 'layouts/user_menu'
|
= render 'layouts/user_menu'
|
||||||
|
|
|
||||||
|
|
@ -42,12 +42,12 @@
|
||||||
|
|
||||||
%section#information
|
%section#information
|
||||||
= f.inputs :name => "Your Information" do
|
= f.inputs :name => "Your Information" do
|
||||||
= semantic_fields_for @person do |p|
|
= semantic_fields_for @user do |u|
|
||||||
= p.input :public_name, :as => :string, :required => true
|
= u.input :name, :as => :string, :required => true
|
||||||
= p.input :company, :as => :string, :label => "Affiliation", :hint => "This could be a company, a user group, or nothing at all."
|
= u.input :affiliation, :as => :string, :hint => "This could be a company, a user group, or nothing at all."
|
||||||
= p.input :biography, :required => true, :input_html => {:rows => 5, :class => 'span11', "onkeyup" => "word_count(this, 'biography-count', 150)"}
|
= u.input :biography, :required => true, :input_html => {:rows => 5, :class => 'span11', "onkeyup" => "word_count(this, 'biography-count', 150)"}
|
||||||
You have used
|
You have used
|
||||||
%span#biography-count #{@person.biography_word_count}
|
%span#biography-count #{@user.biography_word_count}
|
||||||
words. Biographies are limited to 150 words.
|
words. Biographies are limited to 150 words.
|
||||||
%br
|
%br
|
||||||
%br
|
%br
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
= "My Proposals for #{@conference.title}"
|
= "My Proposals for #{@conference.title}"
|
||||||
- if @conference.cfp_open? || organizer_or_admin?
|
- if @conference.cfp_open? || organizer_or_admin?
|
||||||
= link_to "New Proposal", new_conference_proposal_path(@conference.short_title), :class => "btn btn-primary pull-right"
|
= link_to "New Proposal", new_conference_proposal_path(@conference.short_title), :class => "btn btn-primary pull-right"
|
||||||
- if @person.proposal_count(@conference) > 0
|
- if @user.proposal_count(@conference) > 0
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
%table.table.table-bordered.table-striped
|
%table.table.table-bordered.table-striped
|
||||||
|
|
|
||||||
|
|
@ -57,15 +57,15 @@
|
||||||
.col-md-8
|
.col-md-8
|
||||||
%h3
|
%h3
|
||||||
by
|
by
|
||||||
= @speaker.public_name
|
= @speaker.name
|
||||||
(
|
(
|
||||||
= @speaker.email
|
= @speaker.email
|
||||||
)
|
)
|
||||||
- if @speaker.company?
|
- if @speaker.affiliation?
|
||||||
%br
|
%br
|
||||||
%span.muted
|
%span.muted
|
||||||
from
|
from
|
||||||
= @speaker.company
|
= @speaker.affiliation
|
||||||
-if @speaker.biography?
|
-if @speaker.biography?
|
||||||
= simple_format(@speaker.biography)
|
= simple_format(@speaker.biography)
|
||||||
.col-md-4
|
.col-md-4
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,8 @@
|
||||||
data-href="<%= url_for(conference_proposal_path(@conference.short_title, event[0].id)) %>">
|
data-href="<%= url_for(conference_proposal_path(@conference.short_title, event[0].id)) %>">
|
||||||
<%- if speaker = event[0].speakers.first %>
|
<%- if speaker = event[0].speakers.first %>
|
||||||
<%= image_tag speaker.gravatar_url, :class => "img-circle pull-right",
|
<%= image_tag speaker.gravatar_url, :class => "img-circle pull-right",
|
||||||
:alt => speaker.public_name,
|
:alt => speaker.name,
|
||||||
:title => speaker.public_name,
|
:title => speaker.name,
|
||||||
:style => "padding:8px;" %>
|
:style => "padding:8px;" %>
|
||||||
<%- end %>
|
<%- end %>
|
||||||
<h5>
|
<h5>
|
||||||
|
|
@ -65,7 +65,7 @@
|
||||||
</span>
|
</span>
|
||||||
<span class="schedule-speaker">
|
<span class="schedule-speaker">
|
||||||
<span class="glyphicon glyphicon-user"></span>
|
<span class="glyphicon glyphicon-user"></span>
|
||||||
<%= "#{speaker.first_name} #{speaker.last_name}" %>
|
<%= "#{speaker.name}" %>
|
||||||
</span>
|
</span>
|
||||||
<% if event[0].track%>
|
<% if event[0].track%>
|
||||||
<span class="schedule-track">
|
<span class="schedule-track">
|
||||||
|
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
||||||
= f.inputs :name => "Your Details" do
|
|
||||||
%br
|
|
||||||
Your public name (required)
|
|
||||||
%br
|
|
||||||
= f.fields_for :person do |p|
|
|
||||||
= p.text_field :public_name, :for => :person
|
|
||||||
- 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
|
|
||||||
= reg.input :code, :label => "Confirmation or registration code (if applicable)"
|
|
||||||
%span#supporter-link.help-block
|
|
||||||
|
|
||||||
= f.input :attending_with_partner, :label => false
|
|
||||||
= f.input :using_affiliated_lodging, :label => false
|
|
||||||
= f.input :handicapped_access_required, :label => false
|
|
||||||
= f.input :other_special_needs, :label => "Any other special needs?", :input_html => {:rows => 2, :class => "span6"}
|
|
||||||
= 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" }
|
|
||||||
- if @conference.social_events.count > 0
|
|
||||||
= f.inputs "Are you planning to attend any of the parties?" do
|
|
||||||
%br Yes, I'll be attending...
|
|
||||||
%br
|
|
||||||
= f.input :social_events, :as => :check_boxes, :label => false, :collection => @conference.social_events
|
|
||||||
|
|
||||||
:javascript
|
|
||||||
$("#registration_supporter_registration_attributes_supporter_level_id").change(function () {
|
|
||||||
var str = "";
|
|
||||||
#{generate_supporter_level_js @conference}
|
|
||||||
$("#supporter-link").html(str);
|
|
||||||
})
|
|
||||||
.trigger('change');
|
|
||||||
|
|
||||||
$("#registration-arrival-datepicker").datetimepicker({
|
|
||||||
dateFormat: "yy-mm-dd",
|
|
||||||
timeFormat: "HH:mm",
|
|
||||||
showSecond: false,
|
|
||||||
numberOfMonths: 1,
|
|
||||||
defaultDate: '#{@conference.start_date.yesterday.strftime('%Y-%m-%d')}',
|
|
||||||
onSelect: function(selected) {
|
|
||||||
$("#registration-departure-datepicker").datepicker("option","minDate", selected)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#registration-departure-datepicker").datetimepicker({
|
|
||||||
dateFormat: "yy-mm-dd",
|
|
||||||
timeFormat: "HH:mm",
|
|
||||||
showSecond: false,
|
|
||||||
numberOfMonths: 1,
|
|
||||||
defaultDate: '#{@conference.end_date.tomorrow.strftime('%Y-%m-%d')}',
|
|
||||||
onSelect: function(selected) {
|
|
||||||
$("#registration-arrival-datepicker").datepicker("option","maxDate", selected)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
13
db/migrate/20140609172219_add_person_attributes_to_user.rb
Normal file
13
db/migrate/20140609172219_add_person_attributes_to_user.rb
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
class AddPersonAttributesToUser < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :users, :name, :string
|
||||||
|
add_column :users, :email_public, :boolean
|
||||||
|
add_column :users, :biography, :string
|
||||||
|
add_column :users, :nickname, :string
|
||||||
|
add_column :users, :affiliation, :string
|
||||||
|
add_column :users, :avatar_file_name, :string
|
||||||
|
add_column :users, :avatar_content_type, :string
|
||||||
|
add_column :users, :avatar_file_size, :integer
|
||||||
|
add_column :users, :avatar_updated_at, :datetime
|
||||||
|
end
|
||||||
|
end
|
||||||
35
db/migrate/20140610163947_create_event_users.rb
Normal file
35
db/migrate/20140610163947_create_event_users.rb
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
class CreateEventUsers < ActiveRecord::Migration
|
||||||
|
class TempPerson < ActiveRecord::Base
|
||||||
|
self.table_name = 'people'
|
||||||
|
end
|
||||||
|
|
||||||
|
class TempEventPerson < ActiveRecord::Base
|
||||||
|
self.table_name = 'event_people'
|
||||||
|
end
|
||||||
|
|
||||||
|
class TempEventUser < ActiveRecord::Base
|
||||||
|
self.table_name = 'event_users'
|
||||||
|
end
|
||||||
|
|
||||||
|
def change
|
||||||
|
create_table :event_users do |t|
|
||||||
|
t.references :user
|
||||||
|
t.references :event
|
||||||
|
t.string :event_role, null: false, default: 'participant'
|
||||||
|
t.string :comment
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
|
||||||
|
TempEventPerson.all.each do |ep|
|
||||||
|
record = TempEventUser.new
|
||||||
|
record.event_id = ep.event_id
|
||||||
|
person = TempPerson.where(id: ep.person_id).first
|
||||||
|
record.user_id = person.user_id
|
||||||
|
record.event_role = ep.event_role
|
||||||
|
record.comment = ep.comment
|
||||||
|
record.save!
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
28
db/migrate/20140610165551_migrate_data_person_to_user.rb
Normal file
28
db/migrate/20140610165551_migrate_data_person_to_user.rb
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
class MigrateDataPersonToUser < ActiveRecord::Migration
|
||||||
|
class TempPerson < ActiveRecord::Base
|
||||||
|
self.table_name = 'people'
|
||||||
|
end
|
||||||
|
|
||||||
|
class TempUser < ActiveRecord::Base
|
||||||
|
self.table_name = 'users'
|
||||||
|
end
|
||||||
|
|
||||||
|
def change
|
||||||
|
TempPerson.all.each do |p|
|
||||||
|
user = TempUser.find(p.user_id)
|
||||||
|
if p.public_name.empty?
|
||||||
|
user.name = p.email
|
||||||
|
else
|
||||||
|
user.name = p.public_name
|
||||||
|
end
|
||||||
|
user.biography = p.biography
|
||||||
|
user.nickname = p.irc_nickname
|
||||||
|
user.affiliation = p.company
|
||||||
|
user.avatar_file_name = p.avatar_file_name
|
||||||
|
user.avatar_content_type = p.avatar_content_type
|
||||||
|
user.avatar_file_size = p.avatar_file_size
|
||||||
|
user.avatar_updated_at = p.avatar_updated_at
|
||||||
|
user.save!
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
class ChangePersonIdToUserIdInRegistrations < ActiveRecord::Migration
|
||||||
|
class TempPerson < ActiveRecord::Base
|
||||||
|
self.table_name = 'people'
|
||||||
|
end
|
||||||
|
|
||||||
|
class TempRegistration < ActiveRecord::Base
|
||||||
|
self.table_name = 'registrations'
|
||||||
|
end
|
||||||
|
|
||||||
|
def change
|
||||||
|
add_column :registrations, :user_id, :integer
|
||||||
|
|
||||||
|
TempPerson.all.each do |t|
|
||||||
|
registrations = TempRegistration.where(person_id: t.id)
|
||||||
|
|
||||||
|
unless registrations.empty?
|
||||||
|
registrations.each do |r|
|
||||||
|
r.user_id = t.user_id
|
||||||
|
r.save!
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
remove_column :registrations, :person_id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
class ChangePersonIdToUserIdInVotes < ActiveRecord::Migration
|
||||||
|
class TempPerson < ActiveRecord::Base
|
||||||
|
self.table_name = 'people'
|
||||||
|
end
|
||||||
|
|
||||||
|
class TempVote < ActiveRecord::Base
|
||||||
|
self.table_name = 'votes'
|
||||||
|
end
|
||||||
|
|
||||||
|
def change
|
||||||
|
add_column :votes, :user_id, :integer
|
||||||
|
|
||||||
|
TempPerson.all.each do |t|
|
||||||
|
votes = TempVote.where(person_id: t.id)
|
||||||
|
|
||||||
|
unless votes.empty?
|
||||||
|
votes.each do |v|
|
||||||
|
v.user_id = t.user_id
|
||||||
|
v.save!
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
remove_column :votes, :person_id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
class DropPersonAndEventPersonTables < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
drop_table :people
|
||||||
|
drop_table :event_people
|
||||||
|
end
|
||||||
|
end
|
||||||
61
db/schema.rb
61
db/schema.rb
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20140625114813) do
|
ActiveRecord::Schema.define(version: 20140626123837) do
|
||||||
|
|
||||||
create_table "ahoy_events", force: true do |t|
|
create_table "ahoy_events", force: true do |t|
|
||||||
t.uuid "visit_id"
|
t.uuid "visit_id"
|
||||||
|
|
@ -21,7 +21,7 @@ ActiveRecord::Schema.define(version: 20140625114813) do
|
||||||
t.datetime "time"
|
t.datetime "time"
|
||||||
end
|
end
|
||||||
|
|
||||||
#add_index "ahoy_events", ["id"], name: "sqlite_autoindex_ahoy_events_1", unique: true
|
# add_index "ahoy_events", ["id"], name: "sqlite_autoindex_ahoy_events_1", unique: true
|
||||||
add_index "ahoy_events", ["time"], name: "index_ahoy_events_on_time"
|
add_index "ahoy_events", ["time"], name: "index_ahoy_events_on_time"
|
||||||
add_index "ahoy_events", ["user_id"], name: "index_ahoy_events_on_user_id"
|
add_index "ahoy_events", ["user_id"], name: "index_ahoy_events_on_user_id"
|
||||||
add_index "ahoy_events", ["visit_id"], name: "index_ahoy_events_on_visit_id"
|
add_index "ahoy_events", ["visit_id"], name: "index_ahoy_events_on_visit_id"
|
||||||
|
|
@ -178,16 +178,6 @@ ActiveRecord::Schema.define(version: 20140625114813) do
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "event_people", force: true do |t|
|
|
||||||
t.integer "proposal_id"
|
|
||||||
t.integer "person_id"
|
|
||||||
t.integer "event_id"
|
|
||||||
t.string "event_role", default: "participant", null: false
|
|
||||||
t.string "comment"
|
|
||||||
t.datetime "created_at"
|
|
||||||
t.datetime "updated_at"
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "event_types", force: true do |t|
|
create_table "event_types", force: true do |t|
|
||||||
t.integer "conference_id"
|
t.integer "conference_id"
|
||||||
t.string "title", null: false
|
t.string "title", null: false
|
||||||
|
|
@ -197,6 +187,15 @@ ActiveRecord::Schema.define(version: 20140625114813) do
|
||||||
t.string "color"
|
t.string "color"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "event_users", force: true do |t|
|
||||||
|
t.integer "user_id"
|
||||||
|
t.integer "event_id"
|
||||||
|
t.string "event_role", default: "participant", null: false
|
||||||
|
t.string "comment"
|
||||||
|
t.datetime "created_at"
|
||||||
|
t.datetime "updated_at"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "events", force: true do |t|
|
create_table "events", force: true do |t|
|
||||||
t.string "guid", null: false
|
t.string "guid", null: false
|
||||||
t.integer "conference_id"
|
t.integer "conference_id"
|
||||||
|
|
@ -254,29 +253,6 @@ ActiveRecord::Schema.define(version: 20140625114813) do
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "people", force: true do |t|
|
|
||||||
t.string "guid", null: false
|
|
||||||
t.string "first_name", default: ""
|
|
||||||
t.string "last_name", default: ""
|
|
||||||
t.string "public_name", default: ""
|
|
||||||
t.string "company", default: ""
|
|
||||||
t.string "email", null: false
|
|
||||||
t.boolean "email_public"
|
|
||||||
t.string "avatar_file_name"
|
|
||||||
t.string "avatar_content_type"
|
|
||||||
t.integer "avatar_file_size"
|
|
||||||
t.datetime "avatar_updated_at"
|
|
||||||
t.text "biography"
|
|
||||||
t.integer "user_id"
|
|
||||||
t.datetime "created_at"
|
|
||||||
t.datetime "updated_at"
|
|
||||||
t.string "irc_nickname"
|
|
||||||
t.text "volunteer_experience"
|
|
||||||
t.string "tshirt"
|
|
||||||
t.string "mobile"
|
|
||||||
t.string "languages"
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "photos", force: true do |t|
|
create_table "photos", force: true do |t|
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.string "picture_file_name"
|
t.string "picture_file_name"
|
||||||
|
|
@ -314,7 +290,6 @@ ActiveRecord::Schema.define(version: 20140625114813) do
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "registrations", force: true do |t|
|
create_table "registrations", force: true do |t|
|
||||||
t.integer "person_id"
|
|
||||||
t.integer "conference_id"
|
t.integer "conference_id"
|
||||||
t.boolean "attending_social_events", default: true
|
t.boolean "attending_social_events", default: true
|
||||||
t.boolean "attending_with_partner", default: false
|
t.boolean "attending_with_partner", default: false
|
||||||
|
|
@ -330,6 +305,7 @@ ActiveRecord::Schema.define(version: 20140625114813) do
|
||||||
t.boolean "attended", default: false
|
t.boolean "attended", default: false
|
||||||
t.boolean "volunteer"
|
t.boolean "volunteer"
|
||||||
t.integer "week"
|
t.integer "week"
|
||||||
|
t.integer "user_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "registrations_social_events", id: false, force: true do |t|
|
create_table "registrations_social_events", id: false, force: true do |t|
|
||||||
|
|
@ -445,6 +421,15 @@ ActiveRecord::Schema.define(version: 20140625114813) do
|
||||||
t.string "unconfirmed_email"
|
t.string "unconfirmed_email"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
|
t.string "name"
|
||||||
|
t.boolean "email_public"
|
||||||
|
t.text "biography"
|
||||||
|
t.string "nickname"
|
||||||
|
t.string "affiliation"
|
||||||
|
t.string "avatar_file_name"
|
||||||
|
t.string "avatar_content_type"
|
||||||
|
t.integer "avatar_file_size"
|
||||||
|
t.datetime "avatar_updated_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
|
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
|
||||||
|
|
@ -517,15 +502,15 @@ ActiveRecord::Schema.define(version: 20140625114813) do
|
||||||
t.datetime "started_at"
|
t.datetime "started_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
#add_index "visits", ["id"], name: "sqlite_autoindex_visits_1", unique: true
|
# add_index "visits", ["id"], name: "sqlite_autoindex_visits_1", unique: true
|
||||||
add_index "visits", ["user_id"], name: "index_visits_on_user_id"
|
add_index "visits", ["user_id"], name: "index_visits_on_user_id"
|
||||||
|
|
||||||
create_table "votes", force: true do |t|
|
create_table "votes", force: true do |t|
|
||||||
t.integer "person_id"
|
|
||||||
t.integer "event_id"
|
t.integer "event_id"
|
||||||
t.integer "rating"
|
t.integer "rating"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
|
t.integer "user_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "vpositions", force: true do |t|
|
create_table "vpositions", force: true do |t|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||||
|
|
||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
factory :event_person do
|
factory :event_user do
|
||||||
person
|
user
|
||||||
|
|
||||||
Hash[EventPerson::ROLES].values.each do |role|
|
Hash[EventUser::ROLES].values.each do |role|
|
||||||
factory role do
|
factory role do
|
||||||
event_role role
|
event_role role
|
||||||
end
|
end
|
||||||
|
|
@ -33,7 +33,7 @@ FactoryGirl.define do
|
||||||
libero quis porta ultricies. Fusce pulvinar accumsan lobortis.
|
libero quis porta ultricies. Fusce pulvinar accumsan lobortis.
|
||||||
EOS
|
EOS
|
||||||
after(:build) do |event|
|
after(:build) do |event|
|
||||||
event.event_people << build(:submitter, event: event)
|
event.event_users << build(:submitter, event: event)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
|
||||||
|
|
||||||
FactoryGirl.define do
|
|
||||||
factory :person do
|
|
||||||
first_name 'Pat'
|
|
||||||
last_name 'Jones'
|
|
||||||
email 'pjones@nowhere.net'
|
|
||||||
biography <<-EOS
|
|
||||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus enim
|
|
||||||
nunc, venenatis non sapien convallis, dictum suscipit purus. Vestibulum
|
|
||||||
sed tincidunt tortor. Fusce viverra nisi nisi, quis congue dui faucibus
|
|
||||||
nec. Sed sodales suscipit nulla, accumsan porttitor augue ultrices vel.
|
|
||||||
Quisque cursus facilisis consequat. Etiam volutpat ligula turpis, at
|
|
||||||
gravida.
|
|
||||||
EOS
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
factory :registration do
|
factory :registration do
|
||||||
person
|
user
|
||||||
conference
|
conference
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,18 @@
|
||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
factory :user do
|
factory :user do
|
||||||
sequence(:email) { |n| "example#{n}@example.com" }
|
sequence(:email) { |n| "example#{n}@example.com" }
|
||||||
|
sequence(:name) { |n| "name#{n}" }
|
||||||
password 'changeme'
|
password 'changeme'
|
||||||
password_confirmation 'changeme'
|
password_confirmation 'changeme'
|
||||||
confirmed_at Time.now
|
confirmed_at Time.now
|
||||||
|
biography <<-EOS
|
||||||
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus enim
|
||||||
|
nunc, venenatis non sapien convallis, dictum suscipit purus. Vestibulum
|
||||||
|
sed tincidunt tortor. Fusce viverra nisi nisi, quis congue dui faucibus
|
||||||
|
nec. Sed sodales suscipit nulla, accumsan porttitor augue ultrices vel.
|
||||||
|
Quisque cursus facilisis consequat. Etiam volutpat ligula turpis, at
|
||||||
|
gravida.
|
||||||
|
EOS
|
||||||
|
|
||||||
factory :participant do
|
factory :participant do
|
||||||
after(:create) { |user| user.role_ids = create(:participant_role).id }
|
after(:create) { |user| user.role_ids = create(:participant_role).id }
|
||||||
|
|
|
||||||
|
|
@ -36,20 +36,11 @@ feature Event do
|
||||||
select('YouTube', from: 'event[media_type]')
|
select('YouTube', from: 'event[media_type]')
|
||||||
fill_in 'event_media_id', with: '123456'
|
fill_in 'event_media_id', with: '123456'
|
||||||
|
|
||||||
fill_in 'person_biography', with: 'Lorem ipsum biography'
|
fill_in 'user_biography', with: 'Lorem ipsum biography'
|
||||||
fill_in 'person_public_name', with: 'Example User'
|
fill_in 'user_name', with: 'Example User'
|
||||||
|
|
||||||
click_button 'Submit Session'
|
click_button 'Submit Session'
|
||||||
expect(current_path).to eq(edit_user_registration_path)
|
expect(current_path).to eq(register_conference_path(conference.short_title))
|
||||||
|
|
||||||
fill_in 'user_person_attributes_first_name', with: 'Example'
|
|
||||||
fill_in 'user_person_attributes_last_name', with: 'User'
|
|
||||||
fill_in 'user_person_attributes_biography', with: 'Lorem ipsum biography'
|
|
||||||
|
|
||||||
click_button 'Update'
|
|
||||||
|
|
||||||
expect(flash).
|
|
||||||
to eq('You updated your account successfully.')
|
|
||||||
|
|
||||||
expect(Event.count).to eq(expected_count)
|
expect(Event.count).to eq(expected_count)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@ describe Conference do
|
||||||
e3 = create(:event, conference: subject)
|
e3 = create(:event, conference: subject)
|
||||||
e4 = create(:event, conference: subject)
|
e4 = create(:event, conference: subject)
|
||||||
|
|
||||||
e3.event_people = [create(:event_person, person: e2.submitter, event_role: 'submitter')]
|
e3.event_users = [create(:event_user, user: e2.submitter, event_role: 'submitter')]
|
||||||
e4.event_people = [create(:event_person, person: e2.submitter, event_role: 'submitter')]
|
e4.event_users = [create(:event_user, user: e2.submitter, event_role: 'submitter')]
|
||||||
|
|
||||||
expect(subject.get_top_submitter.values).to eq([3, 1])
|
expect(subject.get_top_submitter.values).to eq([3, 1])
|
||||||
expect(subject.get_top_submitter.keys).to eq([e2.submitter, e1.submitter])
|
expect(subject.get_top_submitter.keys).to eq([e2.submitter, e1.submitter])
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ module OmniauthMacros
|
||||||
provider: 'google',
|
provider: 'google',
|
||||||
uid: 'google-test-uid-1',
|
uid: 'google-test-uid-1',
|
||||||
info: {
|
info: {
|
||||||
|
name: 'new user name',
|
||||||
email: 'test-1@gmail.com'
|
email: 'test-1@gmail.com'
|
||||||
},
|
},
|
||||||
credentials: {
|
credentials: {
|
||||||
|
|
@ -28,6 +29,7 @@ module OmniauthMacros
|
||||||
provider: 'google',
|
provider: 'google',
|
||||||
uid: 'facebook-test-uid-1',
|
uid: 'facebook-test-uid-1',
|
||||||
info: {
|
info: {
|
||||||
|
name: 'new user fb name',
|
||||||
email: 'test-1@gmail.com'
|
email: 'test-1@gmail.com'
|
||||||
},
|
},
|
||||||
credentials: {
|
credentials: {
|
||||||
|
|
@ -45,6 +47,7 @@ module OmniauthMacros
|
||||||
provider: 'google',
|
provider: 'google',
|
||||||
uid: 'google-test-uid-participant-1',
|
uid: 'google-test-uid-participant-1',
|
||||||
info: {
|
info: {
|
||||||
|
name: 'existing user participant name',
|
||||||
email: 'test-participant-1@google.com'
|
email: 'test-participant-1@google.com'
|
||||||
},
|
},
|
||||||
credentials: {
|
credentials: {
|
||||||
|
|
@ -62,6 +65,7 @@ module OmniauthMacros
|
||||||
provider: 'google',
|
provider: 'google',
|
||||||
uid: 'google-test-uid-admin-1',
|
uid: 'google-test-uid-admin-1',
|
||||||
info: {
|
info: {
|
||||||
|
name: 'existing user admin name',
|
||||||
email: 'test-admin-1@google.com'
|
email: 'test-admin-1@google.com'
|
||||||
},
|
},
|
||||||
credentials: {
|
credentials: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue