mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
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
|
||||
before_filter :verify_organizer
|
||||
module Admin
|
||||
class EventsController < ApplicationController
|
||||
before_filter :verify_organizer
|
||||
|
||||
# FIXME: The timezome should only be applied on output, otherwise
|
||||
# you get lost in timezone conversions...
|
||||
# around_filter :set_timezone_for_this_request
|
||||
# FIXME: The timezome should only be applied on output, otherwise
|
||||
# you get lost in timezone conversions...
|
||||
# around_filter :set_timezone_for_this_request
|
||||
|
||||
def set_timezone_for_this_request(&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
|
||||
def set_timezone_for_this_request(&block)
|
||||
Time.use_zone(@conference.timezone, &block)
|
||||
end
|
||||
|
||||
@event_types.each do |mytype|
|
||||
events_mytype = @events.where("event_type_id" => mytype.id)
|
||||
if events_mytype.count > 0
|
||||
@mytypes << mytype
|
||||
end
|
||||
end
|
||||
@mytypes.each do |mytype|
|
||||
@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
|
||||
|
||||
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
|
||||
@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[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)
|
||||
@eventstats["#{mystate.name}"] = { 'count' => events_mystate.count, 'length' => length }
|
||||
end
|
||||
end
|
||||
end
|
||||
@eventstats["totallength"] = @totallength
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
# Explicity call #to_json to avoid the use of EventSerializer
|
||||
format.json { render :json => Event.where(:state => :confirmed).to_json }
|
||||
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)
|
||||
@event_types.each do |mytype|
|
||||
events_mytype = @events.where('event_type_id' => mytype.id)
|
||||
if events_mytype.count > 0
|
||||
@mytypes << mytype
|
||||
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
|
||||
@mytypes.each do |mytype|
|
||||
@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
|
||||
|
||||
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
|
||||
respond_to do |format|
|
||||
format.html
|
||||
# Explicity call #to_json to avoid the use of EventSerializer
|
||||
format.json { render json: Event.where(state: :confirmed).to_json }
|
||||
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(: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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
before_filter :verify_organizer
|
||||
module Admin
|
||||
class RegistrationsController < ApplicationController
|
||||
before_filter :verify_organizer
|
||||
|
||||
def index
|
||||
session[:return_to] ||= request.referer
|
||||
@pdf_filename = "#{@conference.title}.pdf"
|
||||
@registrations = @conference.registrations.includes(:person).order("registrations.created_at ASC")
|
||||
@attended = @conference.registrations.where("attended = ?", true).count
|
||||
@headers = %w[first_name last_name email irc_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
|
||||
def index
|
||||
session[:return_to] ||= request.referer
|
||||
@pdf_filename = "#{@conference.title}.pdf"
|
||||
@registrations = @conference.registrations.includes(:user).order("registrations.created_at ASC")
|
||||
@attended = @conference.registrations.where("attended = ?", true).count
|
||||
@headers = %w[name email nickname other_needs arrival departure attended]
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@user = User.new
|
||||
@person = Person.new
|
||||
@registration = @person.registrations.new
|
||||
@supporter_registration = @conference.supporter_registrations.new
|
||||
@conference = Conference.find_by(short_title: params[:conference_id])
|
||||
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
|
||||
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] = "#{@person.email} is already registred!"
|
||||
return
|
||||
end
|
||||
else
|
||||
@person = Person.new params[:registration][:person]
|
||||
flash[:notice] = "Updated '#{params[:view_field]}' => #{@registration.attended} for
|
||||
#{(User.where("id = ?", @registration.user_id).first).email}"
|
||||
end
|
||||
@person.email = email
|
||||
|
||||
@user = @person.user
|
||||
if @user.nil?
|
||||
@user = @person.build_user
|
||||
@user.password = rand(36**6).to_s(36)
|
||||
@user.skip_confirmation!
|
||||
def edit
|
||||
@registration = @conference.registrations.where("id = ?", params[:id]).first
|
||||
@user = User.where("id = ?", @registration.user_id).first
|
||||
end
|
||||
@user.email = @person.email
|
||||
|
||||
@registration = @person.registrations.build
|
||||
if params[:registration][:supporter_registration]
|
||||
@supporter_registration = @registration.build_supporter_registration
|
||||
@supporter_registration.attributes = params[:registration][:supporter_registration]
|
||||
@supporter_registration.conference_id = @conference.id
|
||||
else
|
||||
@supporter_registration = @conference.supporter_registrations.new
|
||||
end
|
||||
params[:registration].delete :person
|
||||
params[:registration].delete :user
|
||||
params[:registration].delete :supporter_registration
|
||||
@registration.attributes = params[:registration]
|
||||
@registration.conference_id = @conference.id
|
||||
@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}"
|
||||
def update
|
||||
@registration = @conference.registrations.where("id = ?", params[:id]).first
|
||||
@user = User.where("id = ?", @registration.user_id).first
|
||||
begin
|
||||
@user.update_attributes!(params[:registration][:user_attributes])
|
||||
params[:registration].delete :user_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[:success] = "Successfully updated registration for #{@user.name} #{@user.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 delete registration:' + e.message)
|
||||
alert: 'Failed to update 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
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,17 +1,19 @@
|
|||
class Admin::SpeakersController < ApplicationController
|
||||
before_filter :verify_organizer
|
||||
respond_to :js, :html
|
||||
module Admin
|
||||
class SpeakersController < ApplicationController
|
||||
before_filter :verify_organizer
|
||||
respond_to :js, :html
|
||||
|
||||
def edit
|
||||
@event = @conference.events.find(params[:event_id])
|
||||
@speaker = @event.event_people.where(:event_role => "speaker").first
|
||||
end
|
||||
def edit
|
||||
@event = @conference.events.find(params[:event_id])
|
||||
@speaker = @event.event_users.where(event_role: 'speaker').first
|
||||
end
|
||||
|
||||
def update
|
||||
@event = @conference.events.find(params[:event_id])
|
||||
@speaker = @event.event_people.where(:event_role => "speaker").first
|
||||
@speaker.person_id = params[:speaker][:person_id]
|
||||
@speaker.save
|
||||
respond_with @speaker, :location => admin_conference_events_path(@conference.short_title)
|
||||
def update
|
||||
@event = @conference.events.find(params[:event_id])
|
||||
@speaker = @event.event_users.where(event_role: 'speaker').first
|
||||
@speaker.user_id = params[:speaker][:user_id]
|
||||
@speaker.save
|
||||
respond_with @speaker, location: admin_conference_events_path(@conference.short_title)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,210 +1,211 @@
|
|||
class Admin::StatsController < ApplicationController
|
||||
before_filter :verify_organizer
|
||||
|
||||
def index
|
||||
@registrations = @conference.registrations.includes(:person).order("registrations.created_at ASC")
|
||||
@registered = @conference.registrations.count
|
||||
@attendees = @conference.registrations.where("attended = ?", true).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
|
||||
module Admin
|
||||
class StatsController < ApplicationController
|
||||
before_filter :verify_organizer
|
||||
|
||||
@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
|
||||
def index
|
||||
@registrations = @conference.registrations.includes(:user).order('registrations.created_at ASC')
|
||||
@registered = @conference.registrations.count
|
||||
@attendees = @conference.registrations.where('attended = ?', true).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
|
||||
|
||||
@handicapped_access = @conference.registrations.where(handicapped_access_required: true).count
|
||||
@handicapped_access_attended = @conference.registrations.where(handicapped_access_required: true)
|
||||
@handicapped_access_attended = @handicapped_access_attended.where(attended: true).count
|
||||
@suggested_hotel_stay = @conference.registrations.where("using_affiliated_lodging = ?", true).count
|
||||
|
||||
@events = @conference.events
|
||||
#Events charts
|
||||
@machine_states = [['confirmed'], ['cancelled'], ['rejected'], ['withdrawn'], ['new', 'review'], ['unconfirmed', 'accepted']]
|
||||
#Types distribution per state
|
||||
@type_state = {}
|
||||
@machine_states.each do |state|
|
||||
@type_state[state[0]] = var_state_func(@conference.event_types, "event_type", state)
|
||||
end
|
||||
@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
|
||||
|
||||
#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
|
||||
@handicapped_access = @conference.registrations.where(handicapped_access_required: true).count
|
||||
@handicapped_access_attended = @conference.registrations.where(handicapped_access_required: true)
|
||||
@handicapped_access_attended = @handicapped_access_attended.where(attended: true).count
|
||||
@suggested_hotel_stay = @conference.registrations.where('using_affiliated_lodging = ?', true).count
|
||||
|
||||
#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")
|
||||
@events = @conference.events
|
||||
# Events charts
|
||||
@machine_states = [['confirmed'], ['cancelled'], ['rejected'], ['withdrawn'], ['new', 'review'], ['unconfirmed', 'accepted']]
|
||||
# Types distribution per state
|
||||
@type_state = {}
|
||||
@machine_states.each do |state|
|
||||
@type_state[state[0]] = var_state_func(@conference.event_types, 'event_type', state)
|
||||
end
|
||||
end
|
||||
|
||||
#Code for the table in events
|
||||
@mystates = []
|
||||
@mytypes = []
|
||||
@eventstats = {}
|
||||
statelength = 0
|
||||
@totallength = 0
|
||||
#Get totals per state
|
||||
@events.state_machine.states.map.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
|
||||
|
||||
# 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
|
||||
@eventstats["#{mystate.name}"] = {"count" => events_mystate.count, "length" => length}
|
||||
end
|
||||
end
|
||||
|
||||
@conference.event_types.each do |mytype|
|
||||
events_mytype = @events.where("event_type_id" => mytype.id)
|
||||
if events_mytype.count > 0
|
||||
@mytypes << mytype
|
||||
end
|
||||
end
|
||||
@mytypes.each do |mytype|
|
||||
@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
|
||||
|
||||
# Code for the table in events
|
||||
@mystates = []
|
||||
@mytypes = []
|
||||
@eventstats = {}
|
||||
@totallength = 0
|
||||
# Get totals per state
|
||||
@events.state_machine.states.map.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[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)
|
||||
@eventstats["#{mystate.name}"] = { 'count' => events_mystate.count, 'length' => length }
|
||||
end
|
||||
end
|
||||
end
|
||||
@eventstats["totallength"] = @totallength
|
||||
|
||||
#SPEAKERS stats
|
||||
@speakers = Person.joins(:events).where("events.conference_id = ? AND events.state LIKE ?", @conference.id, 'confirmed').uniq
|
||||
@speaker_fields_person = %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%")
|
||||
@conference.event_types.each do |mytype|
|
||||
events_mytype = @events.where('event_type_id' => mytype.id)
|
||||
if events_mytype.count > 0
|
||||
@mytypes << mytype
|
||||
end
|
||||
end
|
||||
@mytypes.each do |mytype|
|
||||
@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
|
||||
start_date = @conference.registration_start_date
|
||||
end_date = @conference.end_date
|
||||
levels = [];
|
||||
@conference.supporter_levels.each do |level|
|
||||
@tickets_time << {"key" => level.title, "values" => []}
|
||||
levels << ["#{level.title}"]
|
||||
@tickets_time = []
|
||||
|
||||
if @conference.registration_start_date and @conference.end_date and @registered > 0 and @supporter_levels
|
||||
start_date = @conference.registration_start_date
|
||||
end_date = @conference.end_date
|
||||
levels = []
|
||||
@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
|
||||
|
||||
# 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|
|
||||
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
|
||||
day_var_count = var.where("#{field} LIKE ?", "%#{day}%").count
|
||||
if day_var_count != 0
|
||||
result << { 'status' => "#{day}", 'value' => day_var_count }
|
||||
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}
|
||||
return result
|
||||
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}
|
||||
]
|
||||
def var_state_func(vars, field, mystate)
|
||||
result = []
|
||||
|
||||
# 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|
|
||||
day_var_count = var.where("#{field} LIKE ?", "%#{day}%").count
|
||||
if day_var_count !=0
|
||||
result << {"status" => "#{day}", "value" => day_var_count}
|
||||
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)
|
||||
result << { 'status' => status, 'value' => value, 'percent' => percent }
|
||||
else
|
||||
percent = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
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
|
||||
# Get no of events for which the field is not set (Needed so that the pie shows half piece for 50%)
|
||||
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" => status, "value" => value, "percent" => percent}
|
||||
else
|
||||
percent = 0
|
||||
result << { 'status' => "no #{field} set", 'value' => value, 'percent' => percent }
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
#Get no of events for which the field is not set (Needed so that the pie shows half piece for 50%)
|
||||
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 }
|
||||
|
||||
def speaker_reg(speaker)
|
||||
speaker.registrations.where('conference_id = ? AND user_id = ?', @conference.id, speaker.id).first
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
def speaker_reg(speaker)
|
||||
speaker.registrations.where("conference_id = ? AND person_id = ?", @conference.id, speaker.id).first
|
||||
end
|
||||
|
||||
def speaker_diet(reg)
|
||||
@conference.dietary_choices.find(reg.dietary_choice_id)
|
||||
end
|
||||
def speaker_diet(reg)
|
||||
@conference.dietary_choices.find(reg.dietary_choice_id)
|
||||
end
|
||||
|
||||
def diet_count(diet)
|
||||
@conference.registrations.where("dietary_choice_id = ?", diet)
|
||||
end
|
||||
def diet_count(diet)
|
||||
@conference.registrations.where('dietary_choice_id = ?', diet)
|
||||
end
|
||||
|
||||
def social_event_count(event)
|
||||
@conference.registrations.joins(:social_events).where("registrations_social_events.social_event_id = ?", event).count
|
||||
end
|
||||
def social_event_count(event)
|
||||
@conference.registrations.joins(:social_events).where('registrations_social_events.social_event_id = ?', event).count
|
||||
end
|
||||
|
||||
helper_method :speaker_reg
|
||||
helper_method :speaker_diet
|
||||
helper_method :diet_count
|
||||
helper_method :social_event_count
|
||||
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
|
||||
before_filter :verify_admin
|
||||
module Admin
|
||||
class UsersController < ApplicationController
|
||||
before_filter :verify_admin
|
||||
|
||||
def index
|
||||
@users = User.joins(:person).order("people.last_name ASC").select("users.*,
|
||||
people.last_name AS last_name,
|
||||
people.first_name AS first_name,
|
||||
people.public_name AS public_name,
|
||||
people.email AS email")
|
||||
def index
|
||||
@users = User.all
|
||||
end
|
||||
|
||||
def show
|
||||
@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
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ class Api::V1::EventsController < Api::BaseController
|
|||
respond_to :json
|
||||
|
||||
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?
|
||||
events = events.where("conferences.guid" => params[:conference_id])
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ class Api::V1::SpeakersController < Api::BaseController
|
|||
|
||||
def index
|
||||
if params[:conference_id].blank?
|
||||
people = Person.joins(:event_people)
|
||||
people = User.joins(:event_users)
|
||||
else
|
||||
people = Person.joins(:event_people => {:event => :conference})
|
||||
people = User.joins(:event_users => {:event => :conference})
|
||||
people = people.where("conferences.guid" => params[:conference_id])
|
||||
end
|
||||
people = people.where("event_people.event_role" => "speaker")
|
||||
render :json => people, :each_serializer => SpeakerSerializer
|
||||
people = people.where("event_users.event_role" => "speaker")
|
||||
render :json => users, :each_serializer => SpeakerSerializer
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,35 +5,32 @@ class ConferenceRegistrationController < ApplicationController
|
|||
# TODO Figure out how to change the route's id from :id to :conference_id
|
||||
@conference = Conference.find_by(short_title: params[:id])
|
||||
@workshops = @conference.events.where("require_registration = ? AND state LIKE ?", true, 'confirmed')
|
||||
@person = current_user.person
|
||||
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.")
|
||||
return
|
||||
end
|
||||
@registration = @person.registrations.where(:conference_id => @conference.id).first
|
||||
@user = current_user
|
||||
|
||||
@registration = @user.registrations.where(:conference_id => @conference.id).first
|
||||
@registered = true
|
||||
if @registration.nil?
|
||||
@registered = false
|
||||
@registration = @person.registrations.new(:conference_id => @conference.id)
|
||||
@registration = @user.registrations.new(:conference_id => @conference.id)
|
||||
end
|
||||
|
||||
# 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)
|
||||
end
|
||||
|
||||
# TODO this is ugly
|
||||
def update
|
||||
conference = Conference.find_by(short_title: params[:id])
|
||||
person = current_user.person
|
||||
registration = person.registrations.where(:conference_id => conference.id).first
|
||||
user = current_user
|
||||
registration = user.registrations.where(:conference_id => conference.id).first
|
||||
update_registration = true
|
||||
# First verify that the supporter code is legit
|
||||
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])
|
||||
|
||||
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.")
|
||||
return
|
||||
end
|
||||
|
|
@ -42,16 +39,16 @@ class ConferenceRegistrationController < ApplicationController
|
|||
begin
|
||||
if registration.nil?
|
||||
update_registration = false
|
||||
person.update_attributes(registration_params[:person_attributes])
|
||||
params[:registration].delete :person_attributes
|
||||
user.update_attributes(registration_params[:user_attributes])
|
||||
params[:registration].delete :user_attributes
|
||||
supporter_reg = params[:registration][: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 !supporter_reg[:id].blank?
|
||||
# This means that their supporter registration was entered ahead of time, probably by an admin
|
||||
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"
|
||||
end
|
||||
else
|
||||
|
|
@ -78,7 +75,7 @@ class ConferenceRegistrationController < ApplicationController
|
|||
# Track ahoy event
|
||||
ahoy.track 'Registered', title: 'New 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
|
||||
redirect_to(register_conference_path(:id => conference.short_title), :notice => redirect_message)
|
||||
|
|
@ -86,8 +83,8 @@ class ConferenceRegistrationController < ApplicationController
|
|||
|
||||
def unregister
|
||||
conference = Conference.find_by(short_title: params[:id])
|
||||
person = current_user.person
|
||||
registration = person.registrations.where(:conference_id => conference.id).first
|
||||
user = current_user
|
||||
registration = user.registrations.where(:conference_id => conference.id).first
|
||||
registration.destroy
|
||||
redirect_to :root
|
||||
end
|
||||
|
|
@ -106,9 +103,8 @@ class ConferenceRegistrationController < ApplicationController
|
|||
vchoice_ids: [],
|
||||
qanswer_ids: [],
|
||||
qanswers_attributes: [],
|
||||
person_attributes: [
|
||||
:id, :public_name, :mobile, :tshirt, :languages,
|
||||
:volunteer_experience],
|
||||
user_attributes: [
|
||||
:id, :name],
|
||||
supporter_registration_attributes: [
|
||||
:id, :supporter_level_id, :code
|
||||
])
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class EventAttachmentsController < ApplicationController
|
|||
return
|
||||
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
|
||||
else
|
||||
raise ActionController::RoutingError.new('Not Found')
|
||||
|
|
@ -52,7 +52,7 @@ class EventAttachmentsController < ApplicationController
|
|||
|
||||
if !organizer_or_admin?
|
||||
begin
|
||||
event = current_user.person.events.find(params[:proposal_id])
|
||||
event = current_user.events.find(params[:proposal_id])
|
||||
rescue Exception => e
|
||||
# They certainly aren't allowed to attach a file to someone else's proposal
|
||||
raise ActionController::RoutingError.new('Invalid proposal')
|
||||
|
|
@ -81,7 +81,7 @@ class EventAttachmentsController < ApplicationController
|
|||
end
|
||||
|
||||
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])
|
||||
|
||||
respond_to do |format|
|
||||
|
|
@ -98,7 +98,7 @@ class EventAttachmentsController < ApplicationController
|
|||
def destroy
|
||||
@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])
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
class ProposalController < ApplicationController
|
||||
before_filter :verify_user, :except => [:show]
|
||||
before_filter :verify_user, except: [:show]
|
||||
before_filter :setup
|
||||
before_filter :verify_access, only: [:edit, :update, :destroy, :confirm, :restart]
|
||||
|
||||
def setup
|
||||
@person = current_user.person if current_user
|
||||
#FIXME: @conference also comes from verify_user, but we need setup also in show
|
||||
@user = current_user if current_user
|
||||
# FIXME: @conference also comes from verify_user, but we need setup also in show
|
||||
# which can be accessed anonymusly
|
||||
@conference = Conference.find_by(short_title: params[:conference_id])
|
||||
@url = conference_proposal_index_path(@conference.short_title)
|
||||
|
|
@ -19,22 +19,23 @@ class ProposalController < ApplicationController
|
|||
|
||||
begin
|
||||
if !organizer_or_admin?
|
||||
@event = @person.events.find(params[:id])
|
||||
@event = @user.events.find(params[:id])
|
||||
else
|
||||
@event = Event.find(params[:id])
|
||||
end
|
||||
rescue Exception => e
|
||||
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
|
||||
|
||||
def index
|
||||
@events = @person.proposals @conference
|
||||
@events = @user.proposals @conference
|
||||
end
|
||||
|
||||
def destroy
|
||||
proposal = @person.events.find_by_id(params[:id])
|
||||
proposal = @user.events.find_by_id(params[:id])
|
||||
if proposal
|
||||
proposal.withdraw
|
||||
proposal.save
|
||||
|
|
@ -56,92 +57,99 @@ class ProposalController < ApplicationController
|
|||
@attachments = @event.event_attachments
|
||||
|
||||
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
|
||||
|
||||
def update
|
||||
session[:return_to] ||= request.referer
|
||||
submitter = params[:person]
|
||||
submitter = params[:user]
|
||||
|
||||
params[:event].delete :people_attributes
|
||||
params[:event].delete :person
|
||||
params[:event].delete :users_attributes
|
||||
params[:event].delete :user
|
||||
|
||||
if submitter[:public_name].blank?
|
||||
redirect_to edit_conference_proposal_path(@conference.short_title, @event), :alert => "Your public name cannot be blank"
|
||||
if submitter[:name].blank?
|
||||
redirect_to edit_conference_proposal_path(@conference.short_title, @event),
|
||||
alert: 'Your name cannot be blank'
|
||||
return
|
||||
end
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
if submitter[:public_name] != @person.public_name || submitter[:biography] != @person.biography
|
||||
@person.update_attributes(submitter)
|
||||
if submitter[:name] != @user.name || submitter[:biography] != @user.biography
|
||||
@user.update_attributes(submitter)
|
||||
end
|
||||
|
||||
event = Event.find_by_id(params[:id])
|
||||
|
||||
begin
|
||||
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
|
||||
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
|
||||
|
||||
def create
|
||||
person = current_user.person
|
||||
user = current_user
|
||||
session[:return_to] ||= request.referer
|
||||
|
||||
event_params = params[:event]
|
||||
submitter = params[:person]
|
||||
params[:event].delete :person
|
||||
submitter = params[:user]
|
||||
params[:event].delete :user
|
||||
|
||||
@event = Event.new(event_params)
|
||||
@event.conference = @conference
|
||||
|
||||
if submitter[:public_name].blank?
|
||||
flash[:error] = "Your public name cannot be blank."
|
||||
render :action => "new"
|
||||
if submitter[:name].blank?
|
||||
flash[:error] = 'Your public name cannot be blank.'
|
||||
render action: 'new'
|
||||
return
|
||||
end
|
||||
|
||||
if submitter[:biography].blank?
|
||||
flash[:error] = "Your biography cannot be blank."
|
||||
render :action => "new"
|
||||
flash[:error] = 'Your biography cannot be blank.'
|
||||
render action: 'new'
|
||||
return
|
||||
end
|
||||
|
||||
# First, update the submitter's info, if they've changed anything
|
||||
if submitter[:public_name] != person.public_name || submitter[:biography] != person.biography
|
||||
person.update_attributes(submitter)
|
||||
if submitter[:name] != user.name || submitter[:biography] != user.biography
|
||||
user.update_attributes(submitter)
|
||||
end
|
||||
|
||||
@event.event_people.new(:person => person,
|
||||
:event_role => "submitter")
|
||||
@event.event_people.new(:person => person,
|
||||
:event_role => "speaker")
|
||||
@event.event_users.new(user: user,
|
||||
event_role: 'submitter')
|
||||
@event.event_users.new(user: user,
|
||||
event_role: 'speaker')
|
||||
|
||||
begin
|
||||
@event.save!
|
||||
rescue Exception => e
|
||||
@url = conference_proposal_index_path(@conference.short_title)
|
||||
@event_types = @conference.event_types
|
||||
@person = current_user.person
|
||||
@user = current_user
|
||||
|
||||
flash[:error] = "Could not submit proposal: #{e.message}"
|
||||
render :action => 'new'
|
||||
render action: 'new'
|
||||
return
|
||||
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'
|
||||
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
|
||||
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
|
||||
|
||||
|
|
@ -155,17 +163,21 @@ class ProposalController < ApplicationController
|
|||
begin
|
||||
@event.confirm!
|
||||
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
|
||||
end
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -36,15 +36,15 @@ class RegistrationsController < Devise::RegistrationsController
|
|||
|
||||
if successfully_updated
|
||||
if email_changed
|
||||
if !@user.person.nil?
|
||||
@user.person.update_attribute("email", params[:user][:email])
|
||||
if !@user.nil?
|
||||
@user.update_attribute('email', params[:user][:email])
|
||||
end
|
||||
set_flash_message :notice, :update_needs_confirmation
|
||||
else
|
||||
set_flash_message :notice, :updated
|
||||
end
|
||||
# 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)
|
||||
else
|
||||
flash[:alert] = 'Updating account failed. ' \
|
||||
|
|
@ -66,11 +66,11 @@ class RegistrationsController < Devise::RegistrationsController
|
|||
def configure_permitted_parameters
|
||||
devise_parameter_sanitizer.for(:account_update) do |u|
|
||||
u.
|
||||
permit(:email, :password, :password_confirmation, :current_password,
|
||||
person_attributes: [:id, :email, :first_name, :last_name,
|
||||
:public_name, :biography, :company, :avatar,
|
||||
:irc_nickname, :mobile, :tshirt, :languages,
|
||||
:volunteer_experience])
|
||||
permit(:email, :password, :password_confirmation, :current_password, :name, :biography)
|
||||
end
|
||||
devise_parameter_sanitizer.for(:sign_up) do |u|
|
||||
u.
|
||||
permit(:email, :password, :password_confirmation, :name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ module ApplicationHelper
|
|||
result = ""
|
||||
result += "<div style='padding-left:#{padding}px'>"
|
||||
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 += "<br><div><a href='#' class='pull-right comment-reply-link'>Reply</a><br><br>"
|
||||
result += "<div class='comment-reply'>"
|
||||
|
|
|
|||
|
|
@ -45,4 +45,4 @@ class Comment < ActiveRecord::Base
|
|||
def self.find_commentable(commentable_str, commentable_id)
|
||||
commentable_str.constantize.find(commentable_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class Conference < ActiveRecord::Base
|
|||
:start_date, :end_date, :rooms_attributes, :tracks_attributes, :dietary_choices_attributes,
|
||||
:use_dietary_choices, :use_supporter_levels, :supporter_levels_attributes, :social_events_attributes,
|
||||
: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,
|
||||
:use_vpositions, :use_vdays, :vdays_attributes, :vpositions_attributes, :use_volunteers,
|
||||
:media_id, :media_type, :color, :description,
|
||||
|
|
@ -114,9 +114,8 @@ class Conference < ActiveRecord::Base
|
|||
# * +true+ - If the user isn't registered
|
||||
def user_registered? user
|
||||
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")
|
||||
return false
|
||||
else
|
||||
|
|
@ -303,28 +302,27 @@ class Conference < ActiveRecord::Base
|
|||
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
|
||||
# * +hash+ -> person: submissions
|
||||
# * +hash+ -> user: submissions
|
||||
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
|
||||
calculate_person_submission_hash(submitter, counter)
|
||||
calculate_user_submission_hash(submitter, counter)
|
||||
end
|
||||
|
||||
##
|
||||
# Returns a hash with person => submissions ordered by submissions
|
||||
# Returns a hash with user => submissions ordered by submissions
|
||||
#
|
||||
# ====Returns
|
||||
# * +hash+ -> person: submissions
|
||||
# * +hash+ -> user: submissions
|
||||
def get_top_submitter(limit = 5)
|
||||
submitter = EventPerson.joins(:event).
|
||||
submitter = EventUser.joins(:event).
|
||||
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
|
||||
Conference.calculate_person_submission_hash(submitter, counter)
|
||||
Conference.calculate_user_submission_hash(submitter, counter)
|
||||
end
|
||||
|
||||
##
|
||||
|
|
@ -685,16 +683,16 @@ class Conference < ActiveRecord::Base
|
|||
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
|
||||
# * +hash+ -> person: submissions
|
||||
def self.calculate_person_submission_hash(submitters, counter)
|
||||
# * +hash+ -> user: submissions
|
||||
def self.calculate_user_submission_hash(submitters, counter)
|
||||
result = ActiveSupport::OrderedHash.new
|
||||
counter.each do |key, value|
|
||||
submitter = submitters.where(person_id: key).first
|
||||
submitter = submitters.where(user_id: key).first
|
||||
if submitter
|
||||
result[submitter.person] = value
|
||||
result[submitter.user] = value
|
||||
end
|
||||
end
|
||||
result
|
||||
|
|
@ -720,9 +718,10 @@ class Conference < ActiveRecord::Base
|
|||
# Creates a UID for the conference. Used as before_create.
|
||||
#
|
||||
def generate_guid
|
||||
begin
|
||||
guid = SecureRandom.urlsafe_base64
|
||||
end while Person.where(:guid => guid).exists?
|
||||
guid = SecureRandom.urlsafe_base64
|
||||
# begin
|
||||
# guid = SecureRandom.urlsafe_base64
|
||||
# end # while User.where(:guid => guid).exists?
|
||||
self.guid = guid
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ class DatatableSupporters < Datatable
|
|||
items.each do |i|
|
||||
item = []
|
||||
if i.name.blank?
|
||||
if !i.registration.nil? && !i.registration.person.nil?
|
||||
item << i.registration.person.public_name
|
||||
if !i.registration.nil? && !i.registration.user.nil?
|
||||
item << i.registration.user.name
|
||||
else
|
||||
item << "Unknown"
|
||||
end
|
||||
|
|
@ -15,8 +15,8 @@ class DatatableSupporters < Datatable
|
|||
end
|
||||
|
||||
if i.email.blank?
|
||||
if !i.registration.nil? && !i.registration.person.nil?
|
||||
item << i.registration.person.email
|
||||
if !i.registration.nil? && !i.registration.user.nil?
|
||||
item << i.registration.user.email
|
||||
else
|
||||
item << "Unknown"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ class EmailSettings < ActiveRecord::Base
|
|||
:registration_email_template, :accepted_email_template, :rejected_email_template, :confirmed_email_template,
|
||||
: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 = {
|
||||
"email" => person.email,
|
||||
"name" => person.public_name,
|
||||
"email" => user.email,
|
||||
"name" => user.name,
|
||||
"conference" => conference.title,
|
||||
"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
|
||||
end
|
||||
|
||||
def generate_registration_email(conference, person)
|
||||
values = get_values(conference, person)
|
||||
def generate_registration_email(conference, user)
|
||||
values = get_values(conference, user)
|
||||
template = self.registration_email_template
|
||||
parse_template(template, values)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
class Event < ActiveRecord::Base
|
||||
include ActiveRecord::Transitions
|
||||
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
|
||||
|
||||
after_create :set_week
|
||||
|
||||
has_many :event_people, :dependent => :destroy
|
||||
has_many :event_users, :dependent => :destroy
|
||||
has_many :event_attachments, :dependent => :destroy
|
||||
has_many :people, :through => :event_people
|
||||
has_many :speakers, :through => :event_people, :source => :person
|
||||
has_many :users, :through => :event_users
|
||||
has_many :speakers, :through => :event_users, :source => :user
|
||||
has_many :votes
|
||||
has_many :voters, :through => :votes, :source => :person
|
||||
has_many :voters, :through => :votes, :source => :user
|
||||
belongs_to :event_type
|
||||
|
||||
has_and_belongs_to_many :registrations
|
||||
|
|
@ -22,9 +22,9 @@ class Event < ActiveRecord::Base
|
|||
belongs_to :difficulty_level
|
||||
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 :people
|
||||
accepts_nested_attributes_for :users
|
||||
before_create :generate_guid
|
||||
|
||||
validate :abstract_limit
|
||||
|
|
@ -63,10 +63,10 @@ class Event < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def voted?(event, person)
|
||||
event.votes.where("person_id = ?", person).first
|
||||
def voted?(event, user)
|
||||
event.votes.where("user_id = ?", user).first
|
||||
end
|
||||
|
||||
|
||||
def average_rating
|
||||
@total_rating = 0
|
||||
self.votes.each do |vote|
|
||||
|
|
@ -77,18 +77,18 @@ class Event < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def submitter
|
||||
result = self.event_people.where(:event_role => "submitter").first
|
||||
result = self.event_users.where(:event_role => "submitter").first
|
||||
if !result.nil?
|
||||
result.person
|
||||
result.user
|
||||
else
|
||||
person = nil
|
||||
# Perhaps the event_people haven't been saved, if this is a new proposal
|
||||
self.event_people.each do |p|
|
||||
user = nil
|
||||
# Perhaps the event_users haven't been saved, if this is a new proposal
|
||||
self.event_users.each do |p|
|
||||
if p.event_role == "submitter"
|
||||
person = p.person
|
||||
user = p.user
|
||||
end
|
||||
end
|
||||
person
|
||||
user
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ class Event < ActiveRecord::Base
|
|||
|
||||
def process_confirmation
|
||||
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
|
||||
end
|
||||
end
|
||||
|
|
@ -194,7 +194,7 @@ class Event < ActiveRecord::Base
|
|||
|
||||
def biography_exists
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
class EventPerson < ActiveRecord::Base
|
||||
attr_accessible :event, :person, :person_id, :event_role
|
||||
class EventUser < ActiveRecord::Base
|
||||
attr_accessible :event, :user, :user_id, :event_role
|
||||
# TODO Do we need these roles?
|
||||
ROLES = [["Speaker","speaker"], ["Submitter","submitter"], ["Moderator","moderator"]]
|
||||
|
||||
belongs_to :event
|
||||
belongs_to :person
|
||||
belongs_to :user
|
||||
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
|
||||
belongs_to :person
|
||||
belongs_to :user
|
||||
belongs_to :conference
|
||||
belongs_to :dietary_choice
|
||||
|
||||
|
|
@ -10,27 +10,21 @@ class Registration < ActiveRecord::Base
|
|||
has_and_belongs_to_many :qanswers
|
||||
has_and_belongs_to_many :vchoices
|
||||
|
||||
attr_accessible :person_id, :conference_id, :attending_social_events, :attending_with_partner,
|
||||
:using_affiliated_lodging, :arrival, :departure, :person_attributes, :other_dietary_choice, :dietary_choice_id,
|
||||
attr_accessible :user_id, :conference_id, :attending_social_events, :attending_with_partner,
|
||||
: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,
|
||||
:event_ids, :attended, :volunteer, :vchoice_ids,
|
||||
:qanswer_ids, :qanswers_attributes
|
||||
|
||||
accepts_nested_attributes_for :person
|
||||
accepts_nested_attributes_for :user
|
||||
accepts_nested_attributes_for :supporter_registration
|
||||
accepts_nested_attributes_for :social_events
|
||||
accepts_nested_attributes_for :qanswers
|
||||
|
||||
delegate :first_name, :to => :person
|
||||
delegate :last_name, :to => :person
|
||||
delegate :public_name, :to => :person
|
||||
delegate :email, :to => :person
|
||||
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
|
||||
delegate :name, :to => :user
|
||||
delegate :email, :to => :user
|
||||
delegate :nickname, :to => :user
|
||||
delegate :affiliation, :to => :user
|
||||
|
||||
alias_attribute :other_needs, :other_special_needs
|
||||
|
||||
|
|
|
|||
|
|
@ -9,9 +9,10 @@ class Room < ActiveRecord::Base
|
|||
private
|
||||
|
||||
def generate_guid
|
||||
begin
|
||||
guid = SecureRandom.urlsafe_base64
|
||||
end while Person.where(:guid => guid).exists?
|
||||
guid = SecureRandom.urlsafe_base64
|
||||
# begin
|
||||
# guid = SecureRandom.urlsafe_base64
|
||||
# end while Person.where(:guid => guid).exists?
|
||||
self.guid = guid
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
class SupporterRegistration < ActiveRecord::Base
|
||||
belongs_to :supporter_level
|
||||
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
|
||||
|
||||
def set_attributes_from_person
|
||||
self.name ||= registration.try(:person).try(:public_name)
|
||||
self.email ||= registration.try(:person).try(:email)
|
||||
def set_attributes_from_user
|
||||
self.name ||= registration.try(:user).try(:name)
|
||||
self.email ||= registration.try(:user).try(:email)
|
||||
true
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@ class Track < ActiveRecord::Base
|
|||
private
|
||||
|
||||
def generate_guid
|
||||
begin
|
||||
guid = SecureRandom.urlsafe_base64
|
||||
end while Person.where(:guid => guid).exists?
|
||||
guid = SecureRandom.urlsafe_base64
|
||||
# begin
|
||||
# guid = SecureRandom.urlsafe_base64
|
||||
# end while Person.where(:guid => guid).exists?
|
||||
self.guid = guid
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
class User < ActiveRecord::Base
|
||||
include Gravtastic
|
||||
gravtastic :size => 32
|
||||
|
||||
|
||||
# Include default devise modules. Others available are:
|
||||
# :token_authenticatable, :confirmable,
|
||||
|
|
@ -8,18 +11,22 @@ class User < ActiveRecord::Base
|
|||
:omniauthable, omniauth_providers: [:novell, :google, :facebook]
|
||||
|
||||
has_and_belongs_to_many :roles
|
||||
has_one :person, :inverse_of => :user
|
||||
has_many :openids
|
||||
|
||||
attr_accessible :email, :password, :password_confirmation, :remember_me, :role_id, :role_ids,
|
||||
:person_attributes
|
||||
accepts_nested_attributes_for :person
|
||||
:name, :email_public, :biography, :nickname, :affiliation
|
||||
|
||||
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
|
||||
|
||||
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.
|
||||
# ====Returns
|
||||
|
|
@ -33,6 +40,7 @@ class User < ActiveRecord::Base
|
|||
|
||||
if user.new_record?
|
||||
user.email = auth.info.email
|
||||
user.name = auth.info.name
|
||||
user.password = Devise.friendly_token[0, 20]
|
||||
user.skip_confirmation!
|
||||
end
|
||||
|
|
@ -50,33 +58,70 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def setup_role
|
||||
roles << Role.find_by(name: 'Admin') if User.count == 0
|
||||
roles << Role.find_by(name: 'Participant') if roles.empty?
|
||||
roles << Role.where(name: 'Admin') if User.count == 0
|
||||
roles << Role.where(name: 'Participant') if roles.empty?
|
||||
end
|
||||
|
||||
def popup_details
|
||||
details = "<b>Sign-in Count</b><br>"
|
||||
details += "#{self.sign_in_count}<br>"
|
||||
details += "<b>Current Sign-in</b><br>"
|
||||
details += "#{self.current_sign_in_at}<br>"
|
||||
details += "<b>Last Sign-in</b><br>"
|
||||
details += "#{self.last_sign_in_at}<br>"
|
||||
details += "<b>Current Sign-in IP</b><br>"
|
||||
details += "#{self.current_sign_in_ip}<br>"
|
||||
details += "<b>Last Sign-in IP</b><br>"
|
||||
details += "#{self.last_sign_in_ip}<br>"
|
||||
details += "<b>Created at</b><br>"
|
||||
details += "#{self.created_at}<br>"
|
||||
def self.prepare(params)
|
||||
email = params['email']
|
||||
user = User.where(email: email).first_or_initialize
|
||||
|
||||
# If there is a new user, add the necessary attributes
|
||||
if user.new_record?
|
||||
user.password = Devise.friendly_token[0,20]
|
||||
user.skip_confirmation!
|
||||
user.attributes = params
|
||||
end
|
||||
|
||||
user
|
||||
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
|
||||
|
||||
def confirmed?
|
||||
!confirmed_at.nil?
|
||||
end
|
||||
|
||||
private
|
||||
def create_person
|
||||
# TODO Search people for existing email address, add to their account
|
||||
build_person(email: email) if person.nil?
|
||||
true
|
||||
def attending_conference? conference
|
||||
Registration.where(:conference_id => conference.id,
|
||||
:user_id => self.id).count
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
class Vote < ActiveRecord::Base
|
||||
attr_accessible :rating
|
||||
|
||||
belongs_to :person
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :event
|
||||
|
||||
delegate :first_name, :to => :person
|
||||
delegate :last_name, :to => :person
|
||||
delegate :public_name, :to => :person
|
||||
end
|
||||
|
||||
delegate :name, :to => :user
|
||||
end
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ class EventSerializer < ActiveModel::Serializer
|
|||
end
|
||||
|
||||
def speaker_ids
|
||||
speakers = object.event_people.select {|i| i.event_role == "speaker" }
|
||||
speakers.map {|i| i.person.guid}
|
||||
speakers = object.event_users.select {|i| i.event_role == "speaker" }
|
||||
speakers.map {|i| i.user.id}
|
||||
end
|
||||
|
||||
def type
|
||||
|
|
|
|||
|
|
@ -1,14 +1,10 @@
|
|||
class SpeakerSerializer < ActiveModel::Serializer
|
||||
include ActionView::Helpers::TextHelper
|
||||
|
||||
attributes :guid, :name, :full_name, :company, :biography
|
||||
attributes :guid, :name, :affiliation, :biography
|
||||
|
||||
def name
|
||||
object.public_name
|
||||
end
|
||||
|
||||
def full_name
|
||||
[object.first_name, object.last_name].join(" ")
|
||||
object.name
|
||||
end
|
||||
|
||||
def biography
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@
|
|||
%tbody
|
||||
%tr
|
||||
%td #{index + 1}
|
||||
%td #{registration.public_name}
|
||||
%td #{registration.name}
|
||||
%td #{registration.conference.title}
|
||||
%td #{registration.created_at.strftime('%m/%d/%Y')}
|
||||
- else
|
||||
%h5.text-warning.text-center
|
||||
No registrations!
|
||||
No registrations!
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@
|
|||
%tbody
|
||||
%tr
|
||||
%td #{index + 1}
|
||||
%td #{event.submitter}
|
||||
%td #{event.submitter.name}
|
||||
%td #{event.title}
|
||||
%td #{event.conference.title}
|
||||
%td
|
||||
.span{'class'=>label_for(event.state)} #{event.state.humanize}
|
||||
- else
|
||||
%h5.text-warning.text-center
|
||||
No submissions!
|
||||
No submissions!
|
||||
|
|
|
|||
|
|
@ -20,4 +20,4 @@
|
|||
%span.label.label-danger Unconfirmed
|
||||
- else
|
||||
%h5.text-warning.text-center
|
||||
No sign ups!
|
||||
No sign ups!
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@
|
|||
- @top_submitter.each do |key, value|
|
||||
.row.top-submitter
|
||||
.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
|
||||
%h4
|
||||
#{key}
|
||||
#{key.name}
|
||||
%div
|
||||
%small
|
||||
#{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
|
||||
%b Submitter
|
||||
%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}"
|
||||
)
|
||||
|
|
|
|||
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
|
||||
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
%td{:style => "width:15%"}
|
||||
%b Rating
|
||||
%td
|
||||
- if @event.average_rating.to_f > 0
|
||||
- if @event.average_rating.to_f > 0
|
||||
#{@event.average_rating}/#{@conference.call_for_papers.rating}
|
||||
- else
|
||||
Rating: 0/#{@conference.call_for_papers.rating}
|
||||
|
|
@ -15,20 +15,20 @@
|
|||
- else
|
||||
= label_tag "label_rating", "", :class => "avgrating"
|
||||
%tr
|
||||
%td
|
||||
%td
|
||||
%b Voters
|
||||
%td
|
||||
= @event.voters.length
|
||||
- if @event.voters.length > 0
|
||||
(
|
||||
= @ratings.map {|x| "#{x.first_name} #{x.last_name}"}.join ', '
|
||||
= @ratings.map {|x| "#{x.name}"}.join ', '
|
||||
)
|
||||
%tr
|
||||
%td
|
||||
%td
|
||||
%b Your vote
|
||||
%td
|
||||
- @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
|
||||
= 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
|
||||
|
|
@ -37,20 +37,20 @@
|
|||
|
||||
- if @ratings.length > 0
|
||||
- @ratings.each do |rate|
|
||||
- unless rate.person_id == current_user.person.id
|
||||
- unless rate.user_id == current_user.id
|
||||
%tr
|
||||
%td
|
||||
= rate.first_name
|
||||
= rate.last_name
|
||||
%td
|
||||
- @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
|
||||
= label_tag "label#{counter+1}", "", :class => "othersrating", :voted => true
|
||||
= javascript_tag "$('label[voted=true]').prevAll().andSelf().addClass('bright');"
|
||||
- else
|
||||
= label_tag "label#{counter+1}", "", :class => "othersrating"
|
||||
:javascript
|
||||
:javascript
|
||||
$(function () {
|
||||
var checkedId = $("a[voted='true']").attr('id');
|
||||
$('a[id=' + checkedId + ']').prevAll().andSelf().addClass('bright');
|
||||
|
|
@ -68,4 +68,4 @@
|
|||
$(".myrating").click(function() {
|
||||
$(this).siblings().removeClass("bright");
|
||||
$(this).prevAll().andSelf().addClass("bright");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -58,14 +58,14 @@
|
|||
- bgcolor=""
|
||||
%td{:style=>"background-color: #{bgcolor}"}
|
||||
- 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
|
||||
(Unregistered!)
|
||||
- else
|
||||
Unknown submitter
|
||||
%td
|
||||
- if speaker = event.speakers.first
|
||||
= link_to speaker.public_name, admin_person_path(speaker)
|
||||
= link_to speaker.name, admin_user_path(speaker)
|
||||
- else
|
||||
Unknown speaker
|
||||
- l = link_to "Change", edit_admin_conference_event_speaker_path(@conference.short_title, event), :remote => true
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
%tr
|
||||
%td
|
||||
- if !version.whodunnit.nil?
|
||||
= Person.find_person_by_user_id(version.whodunnit).public_name
|
||||
= User.find(version.whodunnit).name
|
||||
- else
|
||||
No user (probably via the console)
|
||||
%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
|
||||
.col-md-12
|
||||
%h3
|
||||
Edit registration of #{@person.public_name} (#{@person.email}) for #{@conference.title}
|
||||
Edit registration of #{@user.name} (#{@user.email}) for #{@conference.title}
|
||||
%br
|
||||
.row
|
||||
.col-md-12
|
||||
= semantic_form_for(@registration, :url => admin_conference_registration_path(@conference.short_title, @registration)) do |f|
|
||||
= f.inputs "Personal Information" do
|
||||
= f.fields_for :person do |p|
|
||||
= p.input :first_name, :as => :string
|
||||
= p.input :last_name, :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.fields_for :user do |u|
|
||||
= u.input :nickname, :as => :string
|
||||
= u.input :affiliation, :placeholder => "Company/User Group/nothing", :as => :string
|
||||
= f.inputs "Registration Information" do
|
||||
- if @conference.use_supporter_levels? and @conference.supporter_levels.length > 0
|
||||
= f.semantic_fields_for :supporter_registration do |reg|
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
- @headers.each do |field|
|
||||
%td
|
||||
- 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'
|
||||
%p{:style => "color:red"}
|
||||
= 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"
|
||||
|
||||
%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;"}
|
||||
%td{:colspan=>13}
|
||||
= render :partial => "questions", :locals => {:registration => registration}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
prawn_document(:force_download=>true, :filename => @pdf_filename) do |pdf|
|
||||
table_array = []
|
||||
header_array = [" ",
|
||||
"Last Name",
|
||||
"First Name",
|
||||
"Public Name",
|
||||
"Name",
|
||||
"Email",
|
||||
"Attending Social Events",
|
||||
"Attending With Partner",
|
||||
|
|
@ -13,9 +11,7 @@ prawn_document(:force_download=>true, :filename => @pdf_filename) do |pdf|
|
|||
@registrations.each do |registration|
|
||||
row = []
|
||||
row << ""
|
||||
row << registration.last_name
|
||||
row << registration.first_name
|
||||
row << registration.public_name
|
||||
row << registration.name
|
||||
row << registration.email
|
||||
if registration.attending_social_events
|
||||
row << "X"
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ wb.add_worksheet(:name => "registrations") do |sheet|
|
|||
@registrations.each do |reg|
|
||||
row = []
|
||||
row << reg.attended
|
||||
row << "#{reg.last_name} #{reg.first_name} (#{reg.public_name})"
|
||||
row << reg.irc_nickname
|
||||
row << reg.company
|
||||
row << reg.name
|
||||
row << reg.nickname
|
||||
row << reg.affiliation
|
||||
row << reg.email
|
||||
row << reg.attending_social_events
|
||||
row << reg.attending_with_partner
|
||||
|
|
@ -21,5 +21,5 @@ wb.add_worksheet(:name => "registrations") do |sheet|
|
|||
sheet.add_row row
|
||||
end
|
||||
sheet.column_info[8].width = [sheet.column_info[8].width, 30].min
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -7,16 +7,11 @@
|
|||
= semantic_form_for(@registration, :url => admin_conference_registrations_path(@conference.short_title)) do |f|
|
||||
|
||||
= f.inputs "Your details" do
|
||||
= f.fields_for @person do |p|
|
||||
= 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."
|
||||
= p.input :first_name, :as => :string
|
||||
= p.input :last_name, :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.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 :name, as: :string
|
||||
= u.input :nickname, :as => :string
|
||||
= u.input :affiliation, :placeholder => "Company/User Group/nothing", :as => :string
|
||||
|
||||
= f.inputs "Registration Information" do
|
||||
- if @conference.use_supporter_levels? and @conference.supporter_levels.length > 0
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
Assign speaker
|
||||
= 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
|
||||
= f.collection_select(:person_id, Person.order(:public_name), :id, :public_name)
|
||||
= f.collection_select(:user_id, User.order(:name), :id, :name)
|
||||
|
||||
.modal-footer
|
||||
= link_to "Close", "#", :data => {:dismiss => "modal"}, :class => 'btn'
|
||||
|
|
|
|||
|
|
@ -5,22 +5,16 @@
|
|||
%thead
|
||||
%th
|
||||
ID
|
||||
- (@speaker_fields_person + @speaker_fields_reg).each do |field|
|
||||
- (@speaker_fields_user + @speaker_fields_reg).each do |field|
|
||||
%th
|
||||
= field.capitalize
|
||||
- @speakers.each do |speaker|
|
||||
%tr
|
||||
%td
|
||||
= count +=1
|
||||
- @speaker_fields_person.each do |field|
|
||||
- @speaker_fields_user.each do |field|
|
||||
%td
|
||||
- if field == 'name'
|
||||
= speaker.first_name
|
||||
= speaker.last_name
|
||||
%br
|
||||
(#{speaker.public_name})
|
||||
- else
|
||||
= speaker.send(field.to_sym)
|
||||
= speaker.send(field.to_sym)
|
||||
- @speaker_fields_reg.each do |field|
|
||||
%td
|
||||
- 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
|
||||
- if @users
|
||||
= "(#{@users.length})"
|
||||
|
||||
= link_to "New User", new_admin_user_path, :class => "btn btn-success pull-right"
|
||||
.well
|
||||
%table.table.table-striped.table-bordered.table-hover#users
|
||||
%thead
|
||||
|
|
@ -14,18 +16,15 @@
|
|||
%th
|
||||
%b Email
|
||||
%th
|
||||
%b Last Name
|
||||
%b Name
|
||||
%th
|
||||
%b First Name
|
||||
%th
|
||||
%b Public Name
|
||||
%b # of Conference Registrations
|
||||
%th
|
||||
%b Roles
|
||||
%th
|
||||
%th
|
||||
%th
|
||||
- @users.each do |user|
|
||||
- person = Person.find_person_by_user_id(user.id)
|
||||
%tr
|
||||
%td
|
||||
= user.id
|
||||
|
|
@ -37,13 +36,9 @@
|
|||
%td
|
||||
= user.email
|
||||
%td
|
||||
= user.last_name
|
||||
= user.name
|
||||
%td
|
||||
= user.first_name
|
||||
%td
|
||||
= user.public_name
|
||||
%td
|
||||
= user.roles.map { |role| role.name }.join ','
|
||||
= user.registrations.count
|
||||
%td
|
||||
.modal.fade{:id => "user-role-selection-#{user.id}", "role" => "dialog", "aria-hidden" => "true"}
|
||||
.modal-dialog
|
||||
|
|
@ -60,22 +55,21 @@
|
|||
%button{:class=> "btn btn-danger", "data-dismiss"=> "modal", "aria-hidden"=>"true"}
|
||||
Cancel
|
||||
- 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|
|
||||
= f.input :roles, :label => false
|
||||
%button{:class=> "btn btn-danger", "data-dismiss"=> "modal", "aria-hidden"=>"true"}
|
||||
Cancel
|
||||
= 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
|
||||
=link_to "Details", "javascript: void(0)", :class => "user-details-popover", "data-trigger" => "click", "data-placement" => "bottom",
|
||||
"data-html" => "true",
|
||||
"data-content" => user.popup_details,
|
||||
"data-original-title" => ""
|
||||
= link_to "Edit", edit_admin_user_path(user)
|
||||
%td
|
||||
= link_to "View", admin_user_path(user)
|
||||
%td
|
||||
- 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"
|
||||
- else
|
||||
=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"
|
||||
- else
|
||||
=link_to 'Delete',admin_user_path(user), :method=> :delete , :data=> {:confirm => 'Are you sure ?'},:class => "btn btn-primary btn-danger"
|
||||
|
||||
|
||||
|
|
|
|||
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
|
||||
Registration for
|
||||
= @conference.title
|
||||
- if @person.proposal_count(@conference) > 0
|
||||
- if @user.proposal_count(@conference) > 0
|
||||
.row
|
||||
.col-md-12
|
||||
%i
|
||||
|
|
@ -14,8 +14,8 @@
|
|||
%br
|
||||
Your public name (required)
|
||||
%br
|
||||
= f.fields_for :person do |p|
|
||||
= p.text_field :public_name, :for => :person
|
||||
= f.fields_for :user do |p|
|
||||
= p.input :name
|
||||
|
||||
- if @conference.questions
|
||||
= render :partial => "questions", :locals => {:f => f}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
.row
|
||||
.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.fields_for :person do |p|
|
||||
= render :partial => 'devise/registrations/volunteerperson', :locals => {:p => p}
|
||||
= f.fields_for :user do |u|
|
||||
= render :partial => 'devise/registrations/volunteeruser', :locals => {:u => u}
|
||||
|
||||
%br
|
||||
- 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
|
||||
= semantic_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f|
|
||||
= f.inputs :name => "Profile" do
|
||||
= f.fields_for :person do |p|
|
||||
= p.input :first_name, :as => :string
|
||||
= p.input :last_name, :as => :string
|
||||
= p.input :public_name, :as => :string
|
||||
= p.input :irc_nickname, :label => "IRC nick:", :as => :string
|
||||
= 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
|
||||
= f.fields_for :user do |u|
|
||||
= u.input :name, :as => :string
|
||||
= u.input :nickname, :as => :string
|
||||
= u.input :affiliation, :as => :string, :hint => "This could be a company, a user group, or nothing at all."
|
||||
= u.input :biography, :input_html => {:rows => 5, "onkeyup" => "word_count(this, 'biography-count', 150)"}
|
||||
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.
|
||||
%br
|
||||
%br
|
||||
= render :partial => 'devise/registrations/volunteerperson', :locals => {:p => p}
|
||||
= render :partial => 'devise/registrations/volunteeruser', :locals => {:u => u}
|
||||
= f.inputs :name => 'OpenID' do
|
||||
%h4
|
||||
Currently using the following openIDs:
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
.well
|
||||
= semantic_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
|
||||
= f.input :email
|
||||
= f.input :name, required: true
|
||||
= f.input :password
|
||||
= f.input :password_confirmation
|
||||
= f.action :submit, as: :button, label: 'Sign Up', button_html: {class: 'btn btn-primary'}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
- else
|
||||
= 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
|
||||
- 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"
|
||||
- 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
|
||||
%span.glyphicon.glyphicon-user
|
||||
Users
|
||||
%li
|
||||
= link_to(admin_people_path) do
|
||||
%span.glyphicon.glyphicon-star-empty
|
||||
People
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@
|
|||
%ul.nav.navbar-nav.navbar-right
|
||||
%li.dropdown
|
||||
%a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#", id: "current-user-detail"}
|
||||
- if not current_user.person.public_name.empty?
|
||||
#{current_user.person.public_name}
|
||||
- if not current_user.name.empty?
|
||||
#{current_user.name}
|
||||
-else
|
||||
#{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
|
||||
%ul.dropdown-menu
|
||||
= render 'layouts/user_menu'
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@
|
|||
|
||||
%section#information
|
||||
= f.inputs :name => "Your Information" do
|
||||
= semantic_fields_for @person do |p|
|
||||
= p.input :public_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."
|
||||
= p.input :biography, :required => true, :input_html => {:rows => 5, :class => 'span11', "onkeyup" => "word_count(this, 'biography-count', 150)"}
|
||||
= semantic_fields_for @user do |u|
|
||||
= u.input :name, :as => :string, :required => true
|
||||
= u.input :affiliation, :as => :string, :hint => "This could be a company, a user group, or nothing at all."
|
||||
= u.input :biography, :required => true, :input_html => {:rows => 5, :class => 'span11', "onkeyup" => "word_count(this, 'biography-count', 150)"}
|
||||
You have used
|
||||
%span#biography-count #{@person.biography_word_count}
|
||||
%span#biography-count #{@user.biography_word_count}
|
||||
words. Biographies are limited to 150 words.
|
||||
%br
|
||||
%br
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
= "My Proposals for #{@conference.title}"
|
||||
- if @conference.cfp_open? || organizer_or_admin?
|
||||
= 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
|
||||
.col-md-12
|
||||
%table.table.table-bordered.table-striped
|
||||
|
|
|
|||
|
|
@ -57,15 +57,15 @@
|
|||
.col-md-8
|
||||
%h3
|
||||
by
|
||||
= @speaker.public_name
|
||||
= @speaker.name
|
||||
(
|
||||
= @speaker.email
|
||||
)
|
||||
- if @speaker.company?
|
||||
- if @speaker.affiliation?
|
||||
%br
|
||||
%span.muted
|
||||
from
|
||||
= @speaker.company
|
||||
= @speaker.affiliation
|
||||
-if @speaker.biography?
|
||||
= simple_format(@speaker.biography)
|
||||
.col-md-4
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@
|
|||
data-href="<%= url_for(conference_proposal_path(@conference.short_title, event[0].id)) %>">
|
||||
<%- if speaker = event[0].speakers.first %>
|
||||
<%= image_tag speaker.gravatar_url, :class => "img-circle pull-right",
|
||||
:alt => speaker.public_name,
|
||||
:title => speaker.public_name,
|
||||
:alt => speaker.name,
|
||||
:title => speaker.name,
|
||||
:style => "padding:8px;" %>
|
||||
<%- end %>
|
||||
<h5>
|
||||
|
|
@ -65,7 +65,7 @@
|
|||
</span>
|
||||
<span class="schedule-speaker">
|
||||
<span class="glyphicon glyphicon-user"></span>
|
||||
<%= "#{speaker.first_name} #{speaker.last_name}" %>
|
||||
<%= "#{speaker.name}" %>
|
||||
</span>
|
||||
<% if event[0].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.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20140625114813) do
|
||||
ActiveRecord::Schema.define(version: 20140626123837) do
|
||||
|
||||
create_table "ahoy_events", force: true do |t|
|
||||
t.uuid "visit_id"
|
||||
|
|
@ -21,7 +21,7 @@ ActiveRecord::Schema.define(version: 20140625114813) do
|
|||
t.datetime "time"
|
||||
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", ["user_id"], name: "index_ahoy_events_on_user_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"
|
||||
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|
|
||||
t.integer "conference_id"
|
||||
t.string "title", null: false
|
||||
|
|
@ -197,6 +187,15 @@ ActiveRecord::Schema.define(version: 20140625114813) do
|
|||
t.string "color"
|
||||
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|
|
||||
t.string "guid", null: false
|
||||
t.integer "conference_id"
|
||||
|
|
@ -254,29 +253,6 @@ ActiveRecord::Schema.define(version: 20140625114813) do
|
|||
t.datetime "updated_at"
|
||||
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|
|
||||
t.text "description"
|
||||
t.string "picture_file_name"
|
||||
|
|
@ -314,7 +290,6 @@ ActiveRecord::Schema.define(version: 20140625114813) do
|
|||
end
|
||||
|
||||
create_table "registrations", force: true do |t|
|
||||
t.integer "person_id"
|
||||
t.integer "conference_id"
|
||||
t.boolean "attending_social_events", default: true
|
||||
t.boolean "attending_with_partner", default: false
|
||||
|
|
@ -330,6 +305,7 @@ ActiveRecord::Schema.define(version: 20140625114813) do
|
|||
t.boolean "attended", default: false
|
||||
t.boolean "volunteer"
|
||||
t.integer "week"
|
||||
t.integer "user_id"
|
||||
end
|
||||
|
||||
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.datetime "created_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
|
||||
|
||||
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"
|
||||
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"
|
||||
|
||||
create_table "votes", force: true do |t|
|
||||
t.integer "person_id"
|
||||
t.integer "event_id"
|
||||
t.integer "rating"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "user_id"
|
||||
end
|
||||
|
||||
create_table "vpositions", force: true do |t|
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||
|
||||
FactoryGirl.define do
|
||||
factory :event_person do
|
||||
person
|
||||
factory :event_user do
|
||||
user
|
||||
|
||||
Hash[EventPerson::ROLES].values.each do |role|
|
||||
Hash[EventUser::ROLES].values.each do |role|
|
||||
factory role do
|
||||
event_role role
|
||||
end
|
||||
|
|
@ -33,7 +33,7 @@ FactoryGirl.define do
|
|||
libero quis porta ultricies. Fusce pulvinar accumsan lobortis.
|
||||
EOS
|
||||
after(:build) do |event|
|
||||
event.event_people << build(:submitter, event: event)
|
||||
event.event_users << build(:submitter, event: event)
|
||||
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
|
||||
factory :registration do
|
||||
person
|
||||
user
|
||||
conference
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,9 +2,18 @@
|
|||
FactoryGirl.define do
|
||||
factory :user do
|
||||
sequence(:email) { |n| "example#{n}@example.com" }
|
||||
sequence(:name) { |n| "name#{n}" }
|
||||
password 'changeme'
|
||||
password_confirmation 'changeme'
|
||||
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
|
||||
after(:create) { |user| user.role_ids = create(:participant_role).id }
|
||||
|
|
|
|||
|
|
@ -36,20 +36,11 @@ feature Event do
|
|||
select('YouTube', from: 'event[media_type]')
|
||||
fill_in 'event_media_id', with: '123456'
|
||||
|
||||
fill_in 'person_biography', with: 'Lorem ipsum biography'
|
||||
fill_in 'person_public_name', with: 'Example User'
|
||||
fill_in 'user_biography', with: 'Lorem ipsum biography'
|
||||
fill_in 'user_name', with: 'Example User'
|
||||
|
||||
click_button 'Submit Session'
|
||||
expect(current_path).to eq(edit_user_registration_path)
|
||||
|
||||
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(current_path).to eq(register_conference_path(conference.short_title))
|
||||
|
||||
expect(Event.count).to eq(expected_count)
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ describe Conference do
|
|||
e3 = create(:event, conference: subject)
|
||||
e4 = create(:event, conference: subject)
|
||||
|
||||
e3.event_people = [create(:event_person, person: e2.submitter, event_role: 'submitter')]
|
||||
e4.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_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.keys).to eq([e2.submitter, e1.submitter])
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ module OmniauthMacros
|
|||
provider: 'google',
|
||||
uid: 'google-test-uid-1',
|
||||
info: {
|
||||
name: 'new user name',
|
||||
email: 'test-1@gmail.com'
|
||||
},
|
||||
credentials: {
|
||||
|
|
@ -28,6 +29,7 @@ module OmniauthMacros
|
|||
provider: 'google',
|
||||
uid: 'facebook-test-uid-1',
|
||||
info: {
|
||||
name: 'new user fb name',
|
||||
email: 'test-1@gmail.com'
|
||||
},
|
||||
credentials: {
|
||||
|
|
@ -45,6 +47,7 @@ module OmniauthMacros
|
|||
provider: 'google',
|
||||
uid: 'google-test-uid-participant-1',
|
||||
info: {
|
||||
name: 'existing user participant name',
|
||||
email: 'test-participant-1@google.com'
|
||||
},
|
||||
credentials: {
|
||||
|
|
@ -62,6 +65,7 @@ module OmniauthMacros
|
|||
provider: 'google',
|
||||
uid: 'google-test-uid-admin-1',
|
||||
info: {
|
||||
name: 'existing user admin name',
|
||||
email: 'test-admin-1@google.com'
|
||||
},
|
||||
credentials: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue