mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Big refactoring of registration
- Added datatable gem - Addaed datatable to events, users (#422), registrations
This commit is contained in:
parent
0f1051d24e
commit
d21e19b977
34 changed files with 435 additions and 12988 deletions
1
Gemfile
1
Gemfile
|
|
@ -52,6 +52,7 @@ gem 'bootstrap3-datetimepicker-rails', '~> 3.0.2'
|
||||||
# Use jquery as the JavaScript library
|
# Use jquery as the JavaScript library
|
||||||
gem 'jquery-rails'
|
gem 'jquery-rails'
|
||||||
gem 'cocoon'
|
gem 'cocoon'
|
||||||
|
gem 'jquery-datatables-rails', '~> 2.2.1'
|
||||||
|
|
||||||
# Use gravtastic for user avatars
|
# Use gravtastic for user avatars
|
||||||
gem 'gravtastic'
|
gem 'gravtastic'
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,9 @@ GEM
|
||||||
i18n (0.6.11)
|
i18n (0.6.11)
|
||||||
inversion (0.12.3)
|
inversion (0.12.3)
|
||||||
loggability (~> 0.4)
|
loggability (~> 0.4)
|
||||||
|
jquery-datatables-rails (2.2.2)
|
||||||
|
jquery-rails
|
||||||
|
sass-rails
|
||||||
jquery-rails (3.1.0)
|
jquery-rails (3.1.0)
|
||||||
railties (>= 3.0, < 5.0)
|
railties (>= 3.0, < 5.0)
|
||||||
thor (>= 0.14, < 2.0)
|
thor (>= 0.14, < 2.0)
|
||||||
|
|
@ -428,6 +431,7 @@ DEPENDENCIES
|
||||||
guard-rspec (~> 4.2.8)
|
guard-rspec (~> 4.2.8)
|
||||||
haml-rails
|
haml-rails
|
||||||
hoptoad_notifier (~> 2.3)
|
hoptoad_notifier (~> 2.3)
|
||||||
|
jquery-datatables-rails (~> 2.2.1)
|
||||||
jquery-rails
|
jquery-rails
|
||||||
letter_opener
|
letter_opener
|
||||||
mina
|
mina
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,8 @@
|
||||||
//
|
//
|
||||||
//= require jquery
|
//= require jquery
|
||||||
//= require jquery_ujs
|
//= require jquery_ujs
|
||||||
//= require jquery.dataTables
|
//= require dataTables/jquery.dataTables
|
||||||
|
//= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
|
||||||
//= require cocoon
|
//= require cocoon
|
||||||
//= require bootstrap
|
//= require bootstrap
|
||||||
//= require Chart
|
//= require Chart
|
||||||
|
|
@ -27,6 +28,7 @@
|
||||||
//= require moment
|
//= require moment
|
||||||
//= require bootstrap-datetimepicker
|
//= require bootstrap-datetimepicker
|
||||||
//= require osem-datepickers
|
//= require osem-datepickers
|
||||||
|
//= require osem-datatables
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('a[disabled=disabled]').click(function(event){
|
$('a[disabled=disabled]').click(function(event){
|
||||||
|
|
|
||||||
12099
app/assets/javascripts/jquery.dataTables.js
vendored
12099
app/assets/javascripts/jquery.dataTables.js
vendored
File diff suppressed because it is too large
Load diff
11
app/assets/javascripts/osem-datatables.js
Normal file
11
app/assets/javascripts/osem-datatables.js
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
$(function () {
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#registrations-datatable').dataTable();
|
||||||
|
} );
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#users-datatable').dataTable();
|
||||||
|
} );
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#events-datatable').dataTable();
|
||||||
|
} );
|
||||||
|
} );
|
||||||
|
|
@ -1,4 +1,12 @@
|
||||||
$(function () {
|
$(function () {
|
||||||
|
$("#registration-arrival-datepicker").datetimepicker({
|
||||||
|
pickTime: true,
|
||||||
|
format: "YYYY-MM-DD hh:mm"
|
||||||
|
});
|
||||||
|
$("#registration-departure-datepicker").datetimepicker({
|
||||||
|
pickTime: true,
|
||||||
|
format: "YYYY-MM-DD hh:mm"
|
||||||
|
});
|
||||||
$("#conference-start-datepicker").datetimepicker({
|
$("#conference-start-datepicker").datetimepicker({
|
||||||
pickTime: false,
|
pickTime: false,
|
||||||
format: "YYYY-MM-DD"
|
format: "YYYY-MM-DD"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,17 @@
|
||||||
$(function () {
|
$(function () {
|
||||||
|
/**
|
||||||
|
* Displays a modal with the questions of the registration.
|
||||||
|
*/
|
||||||
|
$(document).ready(function(){
|
||||||
|
$(".question-btn").click(function(){
|
||||||
|
var id = $(this).data('id');
|
||||||
|
$("#question-modal-body").empty();
|
||||||
|
$("#question-modal-body").html($(".question" + id).clone().show());
|
||||||
|
$("#question-modal-header").text('Questions for ' + $(this).data('name'));
|
||||||
|
$('#questions').modal('show');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggles email template help below email body textarea field.
|
* Toggles email template help below email body textarea field.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
*= require strap-on
|
*= require strap-on
|
||||||
*= require formtastic-bootstrap
|
*= require formtastic-bootstrap
|
||||||
*= require jquery.dataTables_themeroller
|
*= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
|
||||||
*= require osem
|
*= require osem
|
||||||
*= require osem-rating
|
*= require osem-rating
|
||||||
*= require osem-schedule
|
*= require osem-schedule
|
||||||
|
|
|
||||||
|
|
@ -1,244 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Table
|
|
||||||
*/
|
|
||||||
table.dataTable {
|
|
||||||
margin: 0 auto;
|
|
||||||
clear: both;
|
|
||||||
width: 100%;
|
|
||||||
border-collapse: collapse;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.dataTable thead th {
|
|
||||||
padding: 3px 0px 3px 10px;
|
|
||||||
cursor: pointer;
|
|
||||||
*cursor: hand;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.dataTable tfoot th {
|
|
||||||
padding: 3px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.dataTable td {
|
|
||||||
padding: 3px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.dataTable td.center,
|
|
||||||
table.dataTable td.dataTables_empty {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.dataTable tr.odd { background-color: #E2E4FF; }
|
|
||||||
table.dataTable tr.even { background-color: white; }
|
|
||||||
|
|
||||||
table.dataTable tr.odd td.sorting_1 { background-color: #D3D6FF; }
|
|
||||||
table.dataTable tr.odd td.sorting_2 { background-color: #DADCFF; }
|
|
||||||
table.dataTable tr.odd td.sorting_3 { background-color: #E0E2FF; }
|
|
||||||
table.dataTable tr.even td.sorting_1 { background-color: #EAEBFF; }
|
|
||||||
table.dataTable tr.even td.sorting_2 { background-color: #F2F3FF; }
|
|
||||||
table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Table wrapper
|
|
||||||
*/
|
|
||||||
.dataTables_wrapper {
|
|
||||||
position: relative;
|
|
||||||
clear: both;
|
|
||||||
*zoom: 1;
|
|
||||||
}
|
|
||||||
.dataTables_wrapper .ui-widget-header {
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
.dataTables_wrapper .ui-toolbar {
|
|
||||||
padding: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Page length menu
|
|
||||||
*/
|
|
||||||
.dataTables_length {
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Filter
|
|
||||||
*/
|
|
||||||
.dataTables_filter {
|
|
||||||
float: right;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Table information
|
|
||||||
*/
|
|
||||||
.dataTables_info {
|
|
||||||
padding-top: 3px;
|
|
||||||
clear: both;
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Pagination
|
|
||||||
*/
|
|
||||||
.dataTables_paginate {
|
|
||||||
float: right;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dataTables_paginate .ui-button {
|
|
||||||
margin-right: -0.1em !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.paging_two_button .ui-button {
|
|
||||||
float: left;
|
|
||||||
cursor: pointer;
|
|
||||||
* cursor: hand;
|
|
||||||
}
|
|
||||||
|
|
||||||
.paging_full_numbers .ui-button {
|
|
||||||
padding: 2px 6px;
|
|
||||||
margin: 0;
|
|
||||||
cursor: pointer;
|
|
||||||
* cursor: hand;
|
|
||||||
color: #333 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Two button pagination - previous / next */
|
|
||||||
.paginate_disabled_previous,
|
|
||||||
.paginate_enabled_previous,
|
|
||||||
.paginate_disabled_next,
|
|
||||||
.paginate_enabled_next {
|
|
||||||
height: 19px;
|
|
||||||
float: left;
|
|
||||||
cursor: pointer;
|
|
||||||
*cursor: hand;
|
|
||||||
color: #111 !important;
|
|
||||||
}
|
|
||||||
.paginate_disabled_previous:hover,
|
|
||||||
.paginate_enabled_previous:hover,
|
|
||||||
.paginate_disabled_next:hover,
|
|
||||||
.paginate_enabled_next:hover {
|
|
||||||
text-decoration: none !important;
|
|
||||||
}
|
|
||||||
.paginate_disabled_previous:active,
|
|
||||||
.paginate_enabled_previous:active,
|
|
||||||
.paginate_disabled_next:active,
|
|
||||||
.paginate_enabled_next:active {
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.paginate_disabled_previous,
|
|
||||||
.paginate_disabled_next {
|
|
||||||
color: #666 !important;
|
|
||||||
}
|
|
||||||
.paginate_disabled_previous,
|
|
||||||
.paginate_enabled_previous {
|
|
||||||
padding-left: 23px;
|
|
||||||
}
|
|
||||||
.paginate_disabled_next,
|
|
||||||
.paginate_enabled_next {
|
|
||||||
padding-right: 23px;
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.paginate_enabled_previous { background: url('../images/back_enabled.png') no-repeat top left; }
|
|
||||||
.paginate_enabled_previous:hover { background: url('../images/back_enabled_hover.png') no-repeat top left; }
|
|
||||||
.paginate_disabled_previous { background: url('../images/back_disabled.png') no-repeat top left; }
|
|
||||||
|
|
||||||
.paginate_enabled_next { background: url('../images/forward_enabled.png') no-repeat top right; }
|
|
||||||
.paginate_enabled_next:hover { background: url('../images/forward_enabled_hover.png') no-repeat top right; }
|
|
||||||
.paginate_disabled_next { background: url('../images/forward_disabled.png') no-repeat top right; }
|
|
||||||
|
|
||||||
/* Full number pagination */
|
|
||||||
.paging_full_numbers a:active {
|
|
||||||
outline: none
|
|
||||||
}
|
|
||||||
.paging_full_numbers a:hover {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.paging_full_numbers a.paginate_button,
|
|
||||||
.paging_full_numbers a.paginate_active {
|
|
||||||
border: 1px solid #aaa;
|
|
||||||
-webkit-border-radius: 5px;
|
|
||||||
-moz-border-radius: 5px;
|
|
||||||
border-radius: 5px;
|
|
||||||
padding: 2px 5px;
|
|
||||||
margin: 0 3px;
|
|
||||||
cursor: pointer;
|
|
||||||
*cursor: hand;
|
|
||||||
color: #333 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.paging_full_numbers a.paginate_button {
|
|
||||||
background-color: #ddd;
|
|
||||||
}
|
|
||||||
|
|
||||||
.paging_full_numbers a.paginate_button:hover {
|
|
||||||
background-color: #ccc;
|
|
||||||
text-decoration: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.paging_full_numbers a.paginate_active {
|
|
||||||
background-color: #99B3FF;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Processing indicator
|
|
||||||
*/
|
|
||||||
.dataTables_processing {
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
width: 250px;
|
|
||||||
height: 30px;
|
|
||||||
margin-left: -125px;
|
|
||||||
margin-top: -15px;
|
|
||||||
padding: 14px 0 2px 0;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
text-align: center;
|
|
||||||
color: #999;
|
|
||||||
font-size: 14px;
|
|
||||||
background-color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sorting
|
|
||||||
*/
|
|
||||||
table.dataTable thead th div.DataTables_sort_wrapper {
|
|
||||||
position: relative;
|
|
||||||
padding-right: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.dataTable thead th div.DataTables_sort_wrapper span {
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
margin-top: -8px;
|
|
||||||
right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.dataTable th:active {
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Scrolling
|
|
||||||
*/
|
|
||||||
.dataTables_scroll {
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dataTables_scrollBody {
|
|
||||||
*margin-top: -1px;
|
|
||||||
-webkit-overflow-scrolling: touch;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -2,114 +2,46 @@ module Admin
|
||||||
class RegistrationsController < Admin::BaseController
|
class RegistrationsController < Admin::BaseController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
load_and_authorize_resource through: :conference
|
load_and_authorize_resource through: :conference
|
||||||
|
before_filter :set_user, except: [:index]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
authorize! :show, Registration.new(conference_id: @conference.id)
|
authorize! :show, Registration.new(conference_id: @conference.id)
|
||||||
session[:return_to] ||= request.referer
|
|
||||||
@pdf_filename = "#{@conference.title}.pdf"
|
@pdf_filename = "#{@conference.title}.pdf"
|
||||||
@registrations = @conference.registrations.includes(:user)
|
@registrations = @conference.registrations.includes(:user).order('registrations.created_at ASC')
|
||||||
@registrations = @registrations.order('registrations.created_at ASC')
|
|
||||||
@attended = @conference.registrations.where('attended = ?', true).count
|
@attended = @conference.registrations.where('attended = ?', true).count
|
||||||
@headers = %w(name email nickname other_needs arrival departure attended)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def change_field
|
def toogle_attended
|
||||||
field = params[:view_field]
|
@registration.attended = !@registration.attended
|
||||||
if @registration.send(field.to_sym)
|
if @registration.save
|
||||||
@registration.update_attribute(:"#{field}", 0)
|
flash[:notice] = "Successfully updated Attended for #{@user.email}"
|
||||||
|
redirect_to admin_conference_registrations_path(@conference.short_title)
|
||||||
else
|
else
|
||||||
@registration.update_attribute(:"#{field}", 1)
|
flash[:notice] = "Update Attended for #{@user.email} failed!"
|
||||||
|
redirect_to admin_conference_registrations_path(@conference.short_title)
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to admin_conference_registrations_path(@conference.short_title)
|
|
||||||
flash[:notice] = "Updated '#{params[:view_field]}' => #{@registration.attended} for
|
|
||||||
#{(User.where('id = ?', @registration.user_id).first).email}"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@user = User.where('id = ?', @registration.user_id).first
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@user = User.where('id = ?', @registration.user_id).first
|
@registration.update_attributes(registration_params)
|
||||||
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 => e
|
|
||||||
Rails.logger.debug e.backtrace.join("\n")
|
|
||||||
redirect_to(admin_conference_registrations_path(@conference.short_title),
|
|
||||||
alert: 'Failed to update registration:' + e.message)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
|
||||||
@user = User.new
|
|
||||||
@registration = @user.registrations.new
|
|
||||||
@registration.conference_id = @conference.id
|
|
||||||
@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
|
if @registration.save
|
||||||
flash[:success] = "Successfully created new registration for #{@user.email}."
|
redirect_to admin_conference_registrations_path(@conference.short_title),
|
||||||
redirect_to admin_conference_registrations_path(@conference.short_title)
|
notice: 'Successfully updated registration!'
|
||||||
else
|
else
|
||||||
render action: 'new'
|
flash[:alert] = "A error prohibited the Registration for #{@conference.title}: "\
|
||||||
|
"#{@registration.errors.full_messages.join('. ')}."
|
||||||
|
render :edit
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
if can? :destroy, @registration
|
if can? :destroy, @registration
|
||||||
registration = @conference.registrations.where(id: params[:id]).first
|
@registration.destroy
|
||||||
user = User.where('id = ?', registration.user_id).first
|
redirect_to admin_conference_registrations_path(@conference.short_title),
|
||||||
|
notice: "Deleted registration for #{@user.name}!"
|
||||||
begin registration.destroy
|
|
||||||
redirect_to admin_conference_registrations_path
|
|
||||||
flash[:notice] = "Deleted registration for #{user.name} #{user.email}"
|
|
||||||
rescue => 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
|
else
|
||||||
redirect_to(admin_conference_registrations_path(@conference.short_title),
|
redirect_to(admin_conference_registrations_path(@conference.short_title),
|
||||||
alert: 'You must be an admin to delete a registration.')
|
alert: 'You must be an admin to delete a registration.')
|
||||||
|
|
@ -118,18 +50,23 @@ module Admin
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
def set_user
|
||||||
|
@user = User.where('id = ?', @registration.user_id).first
|
||||||
|
end
|
||||||
|
|
||||||
def registration_params
|
def registration_params
|
||||||
params.require(:registration).permit(:attending_with_partner, :using_affiliated_lodging,
|
params.require(:registration).
|
||||||
:handicapped_access_required, :other_special_needs,
|
permit(
|
||||||
:attended)
|
:conference_id, :arrival, :departure,
|
||||||
end
|
:volunteer,
|
||||||
|
vchoice_ids: [], qanswer_ids: [],
|
||||||
def user_params
|
qanswers_attributes: [],
|
||||||
params.require(:registration).permit(user: [:email, :name, :nickname, :affiliation])
|
user_attributes: [
|
||||||
end
|
:id, :name, :tshirt, :mobile, :volunteer_experience, :languages,
|
||||||
|
:nickname, :affiliation ],
|
||||||
def supporter_params
|
supporter_registration_attributes: [
|
||||||
params.require(:registration).permit(supporter_registration: [:supporter_level_id, :code])
|
:id, :supporter_level_id, :code
|
||||||
|
])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,124 +0,0 @@
|
||||||
class ConferenceRegistrationController < ApplicationController
|
|
||||||
before_filter :verify_user
|
|
||||||
load_resource :conference, find_by: :short_title
|
|
||||||
authorize_resource :conference_registration, class: Registration
|
|
||||||
|
|
||||||
def register
|
|
||||||
@workshops = @conference.events.where('require_registration = ? AND state LIKE ?',
|
|
||||||
true, 'confirmed')
|
|
||||||
@user = current_user
|
|
||||||
|
|
||||||
@registration = @user.registrations.where(conference_id: @conference.id).first
|
|
||||||
@registered = true
|
|
||||||
if @registration.nil?
|
|
||||||
@registered = false
|
|
||||||
@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: @user.email).first
|
|
||||||
@registration.supporter_registration ||= SupporterRegistration.new(conference_id: @conference.id)
|
|
||||||
end
|
|
||||||
|
|
||||||
# TODO this is ugly
|
|
||||||
def update
|
|
||||||
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: user.email).count == 0
|
|
||||||
redirect_to(conference_register_path(conference_id: @conference.short_title),
|
|
||||||
alert: "This code is already in use.
|
|
||||||
Please contact #{conference.contact.email} for assistance.")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
begin
|
|
||||||
if registration.nil?
|
|
||||||
update_registration = false
|
|
||||||
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 = user.registrations.new(registration_params)
|
|
||||||
if @conference.use_supporter_levels? && !supporter_reg.nil?
|
|
||||||
if !supporter_reg[:id].blank?
|
|
||||||
# Means that their supporter registration was entered ahead of time, by an admin
|
|
||||||
registration.supporter_registration = SupporterRegistration.find(supporter_reg[:id])
|
|
||||||
if registration.supporter_registration.email != user.email
|
|
||||||
raise 'Invalid code'
|
|
||||||
end
|
|
||||||
else
|
|
||||||
registration.supporter_registration = @conference.
|
|
||||||
supporter_registrations.new(registration_params[:supporter_registration_attributes])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
registration.conference_id = @conference.id
|
|
||||||
registration.save!
|
|
||||||
if user.subscriptions.where(conference: @conference).blank?
|
|
||||||
subscription = Subscription.new(conference_id: @conference.id, user_id: user.id)
|
|
||||||
redirect_message = subscription.save ? 'You are now Registered and will be receiving Email Notifications.' : 'You are now Registered.'
|
|
||||||
end
|
|
||||||
else
|
|
||||||
registration.update_attributes!(registration_params)
|
|
||||||
end
|
|
||||||
rescue => e
|
|
||||||
Rails.logger.debug e.backtrace.join('\n')
|
|
||||||
redirect_to(conference_register_path(conference_id: @conference.short_title),
|
|
||||||
alert: 'Registration failed:' + e.message)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if update_registration
|
|
||||||
redirect_message = 'Registration updated.'
|
|
||||||
else
|
|
||||||
# Track ahoy event
|
|
||||||
ahoy.track 'Registered', title: 'New registration'
|
|
||||||
if @conference.email_settings.send_on_registration?
|
|
||||||
Mailbot.delay.registration_mail(@conference, current_user)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
redirect_to(conference_register_path(conference_id: @conference.short_title),
|
|
||||||
notice: redirect_message)
|
|
||||||
end
|
|
||||||
|
|
||||||
def unregister
|
|
||||||
user = current_user
|
|
||||||
registration = user.registrations.where(conference_id: @conference.id).first
|
|
||||||
subscription = user.subscriptions.where(conference: @conference)
|
|
||||||
unless subscription.blank?
|
|
||||||
subscription.first.destroy
|
|
||||||
end
|
|
||||||
registration.destroy
|
|
||||||
redirect_to :root
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
|
||||||
|
|
||||||
def registration_params
|
|
||||||
params.require(:registration).
|
|
||||||
permit(
|
|
||||||
:conference_id, :attending_social_events, :attending_with_partner,
|
|
||||||
:using_affiliated_lodging, :arrival, :departure,
|
|
||||||
:other_dietary_choice, :handicapped_access_required, :dietary_choice_id,
|
|
||||||
:volunteer, :other_special_needs,
|
|
||||||
social_event_ids: [],
|
|
||||||
vchoice_ids: [],
|
|
||||||
qanswer_ids: [],
|
|
||||||
qanswers_attributes: [],
|
|
||||||
user_attributes: [
|
|
||||||
:id, :name],
|
|
||||||
supporter_registration_attributes: [
|
|
||||||
:id, :supporter_level_id, :code
|
|
||||||
])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
85
app/controllers/conference_registrations_controller.rb
Normal file
85
app/controllers/conference_registrations_controller.rb
Normal file
|
|
@ -0,0 +1,85 @@
|
||||||
|
class ConferenceRegistrationsController < ApplicationController
|
||||||
|
before_filter :verify_user
|
||||||
|
load_resource :conference, find_by: :short_title
|
||||||
|
authorize_resource :conference_registrations, class: Registration
|
||||||
|
before_action :set_registration, only: [:edit, :update, :destroy]
|
||||||
|
before_action :set_workshops, only: [:new, :edit, :update, :create]
|
||||||
|
|
||||||
|
def new
|
||||||
|
@registration = current_user.registrations.build(conference_id: @conference.id)
|
||||||
|
@registration.build_supporter_registration
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
user_attributes = registration_params[:user_attributes]
|
||||||
|
params[:registration].delete :user_attributes
|
||||||
|
|
||||||
|
@registration = current_user.registrations.build(registration_params)
|
||||||
|
@registration.conference_id = @conference.id
|
||||||
|
|
||||||
|
if @registration.save && current_user.update_attributes(user_attributes)
|
||||||
|
# Trigger ahoy event
|
||||||
|
ahoy.track 'Registered', title: 'New registration'
|
||||||
|
|
||||||
|
# Send registration mail
|
||||||
|
if @conference.email_settings.send_on_registration?
|
||||||
|
Mailbot.delay.registration_mail(@conference, current_user)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Set subscription for the conference
|
||||||
|
Subscription.create(conference_id: @conference.id, user_id: current_user.id)
|
||||||
|
|
||||||
|
redirect_to edit_conference_conference_registrations_path(@conference.short_title),
|
||||||
|
notice: 'You are now registered and will be receiving E-Mail notifications.'
|
||||||
|
else
|
||||||
|
flash[:alert] = "A error prohibited the registration for #{@conference.title}: "\
|
||||||
|
"#{@registration.errors.full_messages.join('. ')}."
|
||||||
|
render :new
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
if @registration.update(registration_params)
|
||||||
|
redirect_to edit_conference_conference_registrations_path(@conference.short_title),
|
||||||
|
notice: 'Registration was successfully updated.'
|
||||||
|
else
|
||||||
|
flash[:alert] = "A error prohibited the registration for #{@conference.title}: "\
|
||||||
|
"#{@registration.errors.full_messages.join('. ')}."
|
||||||
|
render :edit
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@registration.destroy
|
||||||
|
redirect_to root_path,
|
||||||
|
notice: "You are not registered for #{@conference.title} anymore!"
|
||||||
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def set_workshops
|
||||||
|
@workshops = @conference.events.where('require_registration = ? AND state LIKE ?', true, 'confirmed')
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_registration
|
||||||
|
@registration = current_user.registrations.where(conference_id: @conference.id).first
|
||||||
|
end
|
||||||
|
|
||||||
|
def registration_params
|
||||||
|
params.require(:registration).
|
||||||
|
permit(
|
||||||
|
:conference_id, :arrival, :departure,
|
||||||
|
:volunteer,
|
||||||
|
vchoice_ids: [], qanswer_ids: [],
|
||||||
|
qanswers_attributes: [],
|
||||||
|
event_ids: [],
|
||||||
|
user_attributes: [
|
||||||
|
:id, :name, :tshirt, :mobile, :volunteer_experience, :languages],
|
||||||
|
supporter_registration_attributes: [
|
||||||
|
:id, :supporter_level_id, :code
|
||||||
|
])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -45,15 +45,13 @@ class ProposalController < ApplicationController
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
registration = current_user.registrations.where(conference_id: @conference.id).first
|
|
||||||
ahoy.track 'Event submission', title: 'New submission'
|
ahoy.track 'Event submission', title: 'New submission'
|
||||||
if registration.nil?
|
if @conference.user_registered?(current_user)
|
||||||
redirect_to(conference_register_path(@conference.short_title),
|
redirect_to(conference_proposal_index_path(@conference.short_title),
|
||||||
alert: 'Event was successfully submitted.
|
|
||||||
You should register for the conference now.')
|
|
||||||
else
|
|
||||||
redirect_to(conference_proposal_index_path(conference_id: @conference.short_title),
|
|
||||||
notice: 'Event was successfully submitted.')
|
notice: 'Event was successfully submitted.')
|
||||||
|
else
|
||||||
|
redirect_to(new_conference_conference_registrations_path(conference_id: @conference.short_title),
|
||||||
|
alert: 'Event was successfully submitted. You should register for the conference now.')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -114,13 +112,12 @@ class ProposalController < ApplicationController
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if !@conference.user_registered?(current_user)
|
if @conference.user_registered?(current_user)
|
||||||
redirect_to(conference_register_path(@conference.short_title),
|
redirect_to(conference_proposal_index_path(@conference.short_title),
|
||||||
alert: 'The proposal was confirmed. Please register to attend the conference.')
|
notice: 'The proposal was confirmed.')
|
||||||
return
|
|
||||||
end
|
end
|
||||||
redirect_to(conference_proposal_index_path(conference_id: @conference.short_title),
|
redirect_to(new_conference_conference_registrations_path(conference_id: @conference.short_title),
|
||||||
notice: 'The proposal was confirmed.')
|
alert: 'The proposal was confirmed. Please register to attend the conference.')
|
||||||
end
|
end
|
||||||
|
|
||||||
def restart
|
def restart
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class Conference < ActiveRecord::Base
|
||||||
|
|
||||||
has_paper_trail
|
has_paper_trail
|
||||||
|
|
||||||
has_and_belongs_to_many :questions
|
has_many :questions
|
||||||
|
|
||||||
has_one :contact, dependent: :destroy
|
has_one :contact, dependent: :destroy
|
||||||
has_one :registration_period, dependent: :destroy
|
has_one :registration_period, dependent: :destroy
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ class Registration < ActiveRecord::Base
|
||||||
|
|
||||||
alias_attribute :other_needs, :other_special_needs
|
alias_attribute :other_needs, :other_special_needs
|
||||||
|
|
||||||
|
validates_uniqueness_of :user_id, scope: :conference_id, message: 'already Registered!'
|
||||||
|
|
||||||
after_create :set_week
|
after_create :set_week
|
||||||
|
|
||||||
def week
|
def week
|
||||||
|
|
|
||||||
|
|
@ -3,4 +3,6 @@ class Subscription < ActiveRecord::Base
|
||||||
validates_uniqueness_of :user_id, scope: [:conference_id]
|
validates_uniqueness_of :user_id, scope: [:conference_id]
|
||||||
belongs_to :conference
|
belongs_to :conference
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
|
validates_uniqueness_of :user_id, scope: :conference_id, message: 'already subscribed!'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,8 @@ class User < ActiveRecord::Base
|
||||||
has_many :openids
|
has_many :openids
|
||||||
|
|
||||||
attr_accessible :email, :password, :password_confirmation, :remember_me, :role_id, :role_ids,
|
attr_accessible :email, :password, :password_confirmation, :remember_me, :role_id, :role_ids,
|
||||||
:name, :email_public, :biography, :nickname, :affiliation, :is_admin
|
:name, :email_public, :biography, :nickname, :affiliation, :is_admin,
|
||||||
|
:tshirt, :mobile, :volunteer_experience, :languages
|
||||||
|
|
||||||
has_many :event_users, dependent: :destroy
|
has_many :event_users, dependent: :destroy
|
||||||
has_many :events, -> { uniq }, through: :event_users
|
has_many :events, -> { uniq }, through: :event_users
|
||||||
|
|
|
||||||
|
|
@ -6,110 +6,102 @@
|
||||||
Events
|
Events
|
||||||
- if @events
|
- if @events
|
||||||
= "(#{@events.length})"
|
= "(#{@events.length})"
|
||||||
.well
|
%table.table.table-striped.table-bordered.table-hover#events-datatable
|
||||||
%table.table.table-striped.table-bordered.table-hover#events
|
%thead
|
||||||
%thead
|
%th
|
||||||
|
%b ID
|
||||||
|
%th
|
||||||
|
%b Title
|
||||||
|
- if @conference.call_for_papers && @conference.call_for_papers.rating && @conference.call_for_papers.rating > 0
|
||||||
%th
|
%th
|
||||||
%b ID
|
%b Rating
|
||||||
%th
|
%th
|
||||||
%b Title
|
%b Submitter
|
||||||
|
%th
|
||||||
|
%b Speaker
|
||||||
|
%th
|
||||||
|
%b Type
|
||||||
|
%th
|
||||||
|
%b Track
|
||||||
|
%th
|
||||||
|
%b Difficulty
|
||||||
|
%th
|
||||||
|
%b State
|
||||||
|
- @events.each do |event|
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
= event.id
|
||||||
|
%td
|
||||||
|
=link_to event.title, admin_conference_event_path(@conference.short_title, event)
|
||||||
|
|
||||||
- if @conference.call_for_papers && @conference.call_for_papers.rating && @conference.call_for_papers.rating > 0
|
- if @conference.call_for_papers && @conference.call_for_papers.rating && @conference.call_for_papers.rating > 0
|
||||||
%th
|
%td{:style => "width:96px"}
|
||||||
%b Rating
|
- if event.average_rating.to_f > 0
|
||||||
%th
|
#{event.average_rating}/#{@conference.call_for_papers.rating}
|
||||||
%b Submitter
|
|
||||||
%th
|
|
||||||
%b Speaker
|
|
||||||
%th
|
|
||||||
%b Type
|
|
||||||
%th
|
|
||||||
%b Track
|
|
||||||
%th
|
|
||||||
%b Difficulty
|
|
||||||
%th
|
|
||||||
%b State
|
|
||||||
- @events.each do |event|
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
= event.id
|
|
||||||
%td
|
|
||||||
=link_to event.title, admin_conference_event_path(@conference.short_title, event)
|
|
||||||
|
|
||||||
- if @conference.call_for_papers && @conference.call_for_papers.rating && @conference.call_for_papers.rating > 0
|
|
||||||
%td{:style => "width:96px"}
|
|
||||||
- if event.average_rating.to_f > 0
|
|
||||||
#{event.average_rating}/#{@conference.call_for_papers.rating}
|
|
||||||
%br
|
|
||||||
#{pluralize(event.voters.length, 'voter')}
|
|
||||||
%br
|
|
||||||
- @conference.call_for_papers.rating.times do |counter|
|
|
||||||
- if event.average_rating.to_f.round == counter+1
|
|
||||||
= label_tag "label_rating", "", :class => "avgrating", :avgrate => true
|
|
||||||
= javascript_tag "$('label[avgrate=true]').prevAll().andSelf().addClass('bright');"
|
|
||||||
- else
|
|
||||||
= label_tag "label_rating", "", :class => "avgrating"
|
|
||||||
- else
|
|
||||||
0/#{@conference.call_for_papers.rating}
|
|
||||||
%br
|
%br
|
||||||
|
#{pluralize(event.voters.length, 'voter')}
|
||||||
|
%br
|
||||||
|
- @conference.call_for_papers.rating.times do |counter|
|
||||||
|
- if event.average_rating.to_f.round == counter+1
|
||||||
|
= label_tag "label_rating", "", :class => "avgrating", :avgrate => true
|
||||||
|
= javascript_tag "$('label[avgrate=true]').prevAll().andSelf().addClass('bright');"
|
||||||
|
- else
|
||||||
|
= label_tag "label_rating", "", :class => "avgrating"
|
||||||
|
- else
|
||||||
|
0/#{@conference.call_for_papers.rating}
|
||||||
|
%br
|
||||||
|
|
||||||
- if event.submitter && event.submitter.registrations && event.submitter.registrations.count < 1
|
- if event.submitter && event.submitter.registrations && event.submitter.registrations.count < 1
|
||||||
- bgcolor="#F7819F"
|
- bgcolor="#F7819F"
|
||||||
|
- else
|
||||||
|
- bgcolor=""
|
||||||
|
%td{:style=>"background-color: #{bgcolor}"}
|
||||||
|
- if !event.submitter.nil?
|
||||||
|
=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.name, admin_user_path(speaker)
|
||||||
|
- else
|
||||||
|
Unknown speaker
|
||||||
|
- l = link_to "Change", edit_admin_conference_event_speaker_path(@conference.short_title, event), :remote => true
|
||||||
|
= "(#{l})".html_safe
|
||||||
|
%td
|
||||||
|
.btn-group
|
||||||
|
%button{:type=>"button", :class=>"btn btn-link dropdown-toggle", "data-toggle"=>"dropdown"}
|
||||||
|
- if event.event_type.nil?
|
||||||
|
Event Type
|
||||||
|
- else
|
||||||
|
= event.event_type.title
|
||||||
|
%span.caret
|
||||||
|
%ul.dropdown-menu
|
||||||
|
- @event_types.each do |type|
|
||||||
|
%li= link_to type.title, admin_conference_event_path(@conference.short_title, event, :event_type_id => type.id) ,
|
||||||
|
:method => :put, :event_type_id => type.id
|
||||||
|
%td
|
||||||
|
.btn-group
|
||||||
|
%button{:type=>"button", :class=>"btn btn-link dropdown-toggle", "data-toggle"=>"dropdown"}
|
||||||
|
- if event.track.nil?
|
||||||
|
Track
|
||||||
|
- else
|
||||||
|
= event.track.name
|
||||||
|
%span.caret
|
||||||
|
%ul.dropdown-menu
|
||||||
|
- @tracks.each do |track|
|
||||||
|
%li= link_to track.name, admin_conference_event_path(@conference.short_title, event, :track_id => track.id) ,
|
||||||
|
:method => :put, :track_id => track.id
|
||||||
|
%td
|
||||||
|
= event.difficulty_level.title if @conference.use_difficulty_levels && event.difficulty_level
|
||||||
|
%td
|
||||||
|
- if event.state == "withdrawn"
|
||||||
|
Withdrawn
|
||||||
- else
|
- else
|
||||||
- bgcolor=""
|
|
||||||
%td{:style=>"background-color: #{bgcolor}"}
|
|
||||||
- if !event.submitter.nil?
|
|
||||||
=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.name, admin_user_path(speaker)
|
|
||||||
- else
|
|
||||||
Unknown speaker
|
|
||||||
- l = link_to "Change", edit_admin_conference_event_speaker_path(@conference.short_title, event), :remote => true
|
|
||||||
= "(#{l})".html_safe
|
|
||||||
%td
|
|
||||||
.btn-group
|
.btn-group
|
||||||
%button{:type=>"button", :class=>"btn btn-link dropdown-toggle", "data-toggle"=>"dropdown"}
|
%button{:type=>"button", :class=>"btn btn-link dropdown-toggle", "data-toggle"=>"dropdown"}
|
||||||
- if event.event_type.nil?
|
= event.state.humanize
|
||||||
Event Type
|
|
||||||
- else
|
|
||||||
= event.event_type.title
|
|
||||||
%span.caret
|
%span.caret
|
||||||
%ul.dropdown-menu
|
%ul.dropdown-menu{:role=>"menu"}
|
||||||
- @event_types.each do |type|
|
= render 'change_state_dropdown', event: event
|
||||||
%li= link_to type.title, admin_conference_event_path(@conference.short_title, event, :event_type_id => type.id) ,
|
|
||||||
:method => :put, :event_type_id => type.id
|
|
||||||
%td
|
|
||||||
.btn-group
|
|
||||||
%button{:type=>"button", :class=>"btn btn-link dropdown-toggle", "data-toggle"=>"dropdown"}
|
|
||||||
- if event.track.nil?
|
|
||||||
Track
|
|
||||||
- else
|
|
||||||
= event.track.name
|
|
||||||
%span.caret
|
|
||||||
%ul.dropdown-menu
|
|
||||||
- @tracks.each do |track|
|
|
||||||
%li= link_to track.name, admin_conference_event_path(@conference.short_title, event, :track_id => track.id) ,
|
|
||||||
:method => :put, :track_id => track.id
|
|
||||||
%td
|
|
||||||
= event.difficulty_level.title if @conference.use_difficulty_levels && event.difficulty_level
|
|
||||||
%td
|
|
||||||
- if event.state == "withdrawn"
|
|
||||||
Withdrawn
|
|
||||||
- else
|
|
||||||
.btn-group
|
|
||||||
%button{:type=>"button", :class=>"btn btn-link dropdown-toggle", "data-toggle"=>"dropdown"}
|
|
||||||
= event.state.humanize
|
|
||||||
%span.caret
|
|
||||||
%ul.dropdown-menu{:role=>"menu"}
|
|
||||||
= render 'change_state_dropdown', event: event
|
|
||||||
|
|
||||||
:javascript
|
|
||||||
$(document).ready(function() {
|
|
||||||
$('#events').dataTable( {
|
|
||||||
"bPaginate": false
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
|
|
|
||||||
|
|
@ -4,28 +4,35 @@
|
||||||
Edit registration of #{@user.name} (#{@user.email}) for #{@conference.title}
|
Edit registration of #{@user.name} (#{@user.email}) for #{@conference.title}
|
||||||
%br
|
%br
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-8
|
||||||
= semantic_form_for(@registration, :url => admin_conference_registration_path(@conference.short_title, @registration)) do |f|
|
= semantic_form_for(@registration, :url => admin_conference_registration_path(@conference.short_title, @registration)) do |f|
|
||||||
= f.inputs "Personal Information" do
|
= f.inputs 'Personal Information' do
|
||||||
= f.fields_for :user do |u|
|
= f.fields_for :user do |u|
|
||||||
= u.input :nickname, :as => :string
|
= u.input :name, as: :string
|
||||||
= u.input :affiliation, :placeholder => "Company/User Group/nothing", :as => :string
|
= u.input :nickname, as: :string
|
||||||
= f.inputs "Registration Information" do
|
= 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
|
- if @conference.use_supporter_levels? and @conference.supporter_levels.length > 0
|
||||||
= f.semantic_fields_for :supporter_registration do |reg|
|
= f.semantic_fields_for :supporter_registration do |reg|
|
||||||
= reg.input :supporter_level, :as => :select, :collection => @conference.supporter_levels
|
= 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
|
%span#supporter-link.help-block
|
||||||
= f.input :attending_with_partner, :label => false
|
- @conference.questions.each do |q|
|
||||||
= f.input :using_affiliated_lodging, :label => false
|
%h5
|
||||||
= f.input :handicapped_access_required, :label => false
|
= "Q: #{q.title}"
|
||||||
= f.input :other_special_needs, :label => "Any other special needs?", :input_html => {:rows => 2, :class => "span6"}
|
- if q.question_type.id == 1 || q.question_type.id == 2 # yes/no or single choice
|
||||||
|
= f.input :qanswers, :collection => q.qanswers, :as => :select, :input_html => { :multiple => false }, :label => false, :include_blank => "Please make your choice",
|
||||||
|
:member_label => Proc.new {|a| a.answer.title}
|
||||||
|
- if q.question_type.id == 3 # multiple choice
|
||||||
|
= f.input :qanswers, :collection => q.qanswers, :as => :check_boxes, :label => false,
|
||||||
|
:member_label => Proc.new {|a| a.answer.title}
|
||||||
|
|
||||||
|
-# Not necessary
|
||||||
- if @conference.social_events.count > 0
|
- if @conference.social_events.count > 0
|
||||||
= f.inputs "Are you planning to attend any of the parties?" do
|
= f.inputs 'Are you planning to attend any of the parties?' do
|
||||||
%br Yes, I'll be attending...
|
%br Yes, I'll be attending...
|
||||||
%br
|
%br
|
||||||
= f.input :social_events, :as => :check_boxes, :label => false, :collection => @conference.social_events
|
= f.input :social_events, as: :check_boxes, label: false, collection: @conference.social_events
|
||||||
= f.action :submit, :button_html => { :value => "Edit Registration", :class => "btn btn-primary" }
|
= f.action :submit, button_html: { value: 'Edit Registration', class: 'btn btn-primary' }
|
||||||
:javascript
|
:javascript
|
||||||
$("#registration_supporter_registration_attributes_supporter_level_id").change(function () {
|
$("#registration_supporter_registration_attributes_supporter_level_id").change(function () {
|
||||||
var str = "";
|
var str = "";
|
||||||
|
|
@ -33,25 +40,3 @@
|
||||||
$("#supporter-link").html(str);
|
$("#supporter-link").html(str);
|
||||||
})
|
})
|
||||||
.trigger('change');
|
.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)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
|
||||||
|
|
@ -7,70 +7,63 @@
|
||||||
= "(#{@registrations.length})"
|
= "(#{@registrations.length})"
|
||||||
= " - Attended (#{@attended})"
|
= " - Attended (#{@attended})"
|
||||||
.btn-group.pull-right
|
.btn-group.pull-right
|
||||||
- if can? :create, Registration
|
|
||||||
= link_to "New", new_admin_conference_registration_path(@conference.short_title), :class => "btn btn-default"
|
|
||||||
- if can? :read, Registration
|
- if can? :read, Registration
|
||||||
= link_to "Export PDF", admin_conference_registrations_path(@conference.short_title, :format => :pdf), :class => "btn btn-default"
|
= link_to "Export PDF", admin_conference_registrations_path(@conference.short_title, :format => :pdf), :class => "btn btn-default"
|
||||||
= link_to "Export XLS", {:format => :xlsx}, :class => "btn btn-default"
|
= link_to "Export XLS", {:format => :xlsx}, :class => "btn btn-default"
|
||||||
%table.table.table-bordered.table-striped.table-hover#registrations
|
%table.table.table-bordered.table-striped.table-hover#registrations-datatable
|
||||||
%thead
|
%thead
|
||||||
%th
|
|
||||||
No
|
|
||||||
- @headers.each do |h|
|
|
||||||
- h = h.gsub("_", " ")
|
|
||||||
%th
|
|
||||||
= h.capitalize
|
|
||||||
%th
|
|
||||||
%th
|
|
||||||
%th
|
|
||||||
- counter = 0
|
|
||||||
- @registrations.each do |registration|
|
|
||||||
%tr
|
%tr
|
||||||
%td
|
%th #
|
||||||
= counter +=1
|
%th Name
|
||||||
- @headers.each do |field|
|
%th E-Mail
|
||||||
|
%th Ticket
|
||||||
|
%th Arrival
|
||||||
|
%th Departure
|
||||||
|
%th Attended
|
||||||
|
%th Questions
|
||||||
|
%th Edit
|
||||||
|
%th Delete
|
||||||
|
%tbody
|
||||||
|
- @registrations.each_with_index do |registration, index|
|
||||||
|
%tr
|
||||||
%td
|
%td
|
||||||
- if field == "name"
|
= index + 1
|
||||||
#{registration.name} #{registration.nickname} #{registration.affiliation}
|
%td
|
||||||
- if registration.supporter_level && registration.supporter_level.title != 'Free'
|
= registration.name
|
||||||
%p{:style => "color:red"}
|
%td
|
||||||
= registration.supporter_level.title
|
= registration.email
|
||||||
|
%td
|
||||||
-elsif field == 'attended'
|
- if registration.supporter_level
|
||||||
= link_to "#{registration.send(field.to_sym)}", admin_conference_registrations_change_field_path(@conference.short_title, :id => registration.id, :view_field => "#{field}"), :method => :patch, ":#{field}" => registration.send(field.to_sym), :class => "btn btn-success"
|
= registration.supporter_level.title
|
||||||
|
%td
|
||||||
-elsif (registration.send(field.to_sym).class == TrueClass || registration.send(field.to_sym).class == FalseClass)
|
- if registration.arrival
|
||||||
= link_to "#{registration.send(field.to_sym)}", admin_conference_registrations_change_field_path(@conference.short_title, :id => registration.id, :view_field => "#{field}"), :method => :patch, ":#{field}" => registration.send(field.to_sym)
|
= registration.arrival.strftime("%d %b %H:%M")
|
||||||
|
|
||||||
- elsif field == 'arrival' || field == 'departure'
|
|
||||||
= registration.send(field.to_sym).strftime("%d %b %H:%M") if registration.send(field.to_sym)
|
|
||||||
|
|
||||||
- else
|
- else
|
||||||
= registration.send(field.to_sym)
|
n/a
|
||||||
%td
|
%td
|
||||||
= link_to "Questions", "javascript: void(0)", :class => "questions btn btn-success", :id => counter, :onclick => "toggle('row#{counter}')"
|
- if registration.departure
|
||||||
|
= registration.departure.strftime("%d %b %H:%M")
|
||||||
|
- else
|
||||||
|
n/a
|
||||||
|
%td
|
||||||
|
= link_to "#{registration.attended}", admin_conference_registrations_toogle_attended_path(@conference.short_title, id: registration.id),
|
||||||
|
method: :patch, class: 'btn btn-success'
|
||||||
|
%td
|
||||||
|
= link_to 'Questions','#', class: 'btn btn-success question-btn', 'data-id' => index, 'data-name' => registration.name
|
||||||
|
%td
|
||||||
|
= 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: "Do you really want to delete the Registration for #{registration.name}?" }
|
||||||
|
- @registrations.each_with_index do |registration, index|
|
||||||
|
.questions{class: "question#{index}", style: 'display:none;'}
|
||||||
|
= render partial: 'questions', locals: { registration: registration }
|
||||||
|
|
||||||
%td
|
.modal.fade{ id: "questions", 'role' => 'dialog', 'aria-hidden' => 'true' }
|
||||||
= link_to "Edit", edit_admin_conference_registration_path(@conference.short_title, :id => registration), :method => :get, :class => "btn btn-primary"
|
.modal-dialog
|
||||||
|
.modal-content
|
||||||
%td
|
.modal-header
|
||||||
= 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}?"}
|
%h3{id: 'question-modal-header'}
|
||||||
%tr{:id => "row#{counter}", :style=>"display:none;"}
|
Questions for Foobar
|
||||||
%td{:colspan=>13}
|
.modal-body#question-modal-body
|
||||||
= render :partial => "questions", :locals => {:registration => registration}
|
|
||||||
|
|
||||||
:javascript
|
|
||||||
$(document).ready(function() {
|
|
||||||
$('#registrations').dataTable( {
|
|
||||||
"bPaginate": false,
|
|
||||||
"bLengthChange": false
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
|
|
||||||
function toggle(rowid) {
|
|
||||||
if( document.getElementById(rowid).style.display=='none' ){
|
|
||||||
document.getElementById(rowid).style.display = '';
|
|
||||||
}else{
|
|
||||||
document.getElementById(rowid).style.display = 'none';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -1,64 +0,0 @@
|
||||||
.row
|
|
||||||
.col-md-12
|
|
||||||
%h3
|
|
||||||
Create new account and registration
|
|
||||||
.row
|
|
||||||
.col-md-12
|
|
||||||
= semantic_form_for(@registration, :url => admin_conference_registrations_path(@conference.short_title)) do |f|
|
|
||||||
|
|
||||||
= f.inputs "Your details" do
|
|
||||||
= 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
|
|
||||||
= 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"}
|
|
||||||
|
|
||||||
- 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
|
|
||||||
|
|
||||||
= f.action :submit, :button_html => { :value => "Create", :class => "btn btn-primary"}
|
|
||||||
|
|
||||||
: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)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
@ -5,25 +5,19 @@
|
||||||
- if @users
|
- if @users
|
||||||
= "(#{@users.length})"
|
= "(#{@users.length})"
|
||||||
|
|
||||||
= link_to "New User", new_admin_user_path, class: 'btn btn-success pull-right'
|
= link_to 'New User', new_admin_user_path, class: 'btn btn-success pull-right'
|
||||||
.well
|
%table.table.table-striped.table-bordered.table-hover#users-datatable
|
||||||
%table.table.table-striped.table-bordered.table-hover#users
|
%thead
|
||||||
%thead
|
%th ID
|
||||||
%th
|
%th State
|
||||||
%b ID
|
%th Email
|
||||||
%th
|
%th Name
|
||||||
%b State
|
%th Attended Conferences
|
||||||
%th
|
%th Roles
|
||||||
%b Email
|
%th View
|
||||||
%th
|
%th Edit
|
||||||
%b Name
|
%th Delete
|
||||||
%th
|
%tbody
|
||||||
%b Attended Conferences
|
|
||||||
%th
|
|
||||||
%b Roles
|
|
||||||
%th
|
|
||||||
%th
|
|
||||||
%th
|
|
||||||
- @users.each do |user|
|
- @users.each do |user|
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
|
|
@ -44,24 +38,19 @@
|
||||||
= show_roles(user.get_roles.first(2))
|
= show_roles(user.get_roles.first(2))
|
||||||
- if user.get_roles.count > 2
|
- if user.get_roles.count > 2
|
||||||
= '...'
|
= '...'
|
||||||
|
- else
|
||||||
|
None
|
||||||
- if can? :show, user
|
- if can? :show, user
|
||||||
%td
|
%td
|
||||||
= link_to "View", admin_user_path(user), class: 'btn btn-success'
|
= link_to 'View', admin_user_path(user), class: 'btn btn-success'
|
||||||
- if can? :update, user
|
- if can? :update, user
|
||||||
%td
|
%td
|
||||||
= link_to "Edit", edit_admin_user_path(user), class: 'btn btn-primary'
|
= link_to 'Edit', edit_admin_user_path(user), class: 'btn btn-primary'
|
||||||
- if can? :destroy, user
|
- if can? :destroy, user
|
||||||
%td
|
%td
|
||||||
- if current_user.id == user.id or user.role_ids.include? 3
|
- if current_user.id == user.id or user.role_ids.include? 3
|
||||||
=link_to 'Delete',admin_user_path(user), :method => :delete , :data => {:confirm => 'Are you sure ?'}, :disabled => true,:class => "btn btn-primary disabled btn-danger",:role => "button"
|
= link_to 'Delete',admin_user_path(user), :method => :delete , :data => {:confirm => 'Are you sure ?'},
|
||||||
|
disabled: true, class: 'btn btn-primary disabled btn-danger', role: 'button'
|
||||||
- else
|
- else
|
||||||
=link_to 'Delete',admin_user_path(user), :method=> :delete , :data=> {:confirm => 'Are you sure ?'},:class => "btn btn-primary btn-danger"
|
= link_to 'Delete',admin_user_path(user), method: :delete,
|
||||||
|
data: { confirm: 'Are you sure ?' }, class: 'btn btn-primary btn-danger'
|
||||||
|
|
||||||
:javascript
|
|
||||||
$(document).ready(function() {
|
|
||||||
$('#users').dataTable( {
|
|
||||||
"bPaginate": false,
|
|
||||||
"bLengthChange": false
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,10 @@
|
||||||
-else
|
-else
|
||||||
%h4 Registration is Closed, it was from #{ date_string(@conference.registration_period.start_date, @conference.registration_period.end_date) }
|
%h4 Registration is Closed, it was from #{ date_string(@conference.registration_period.start_date, @conference.registration_period.end_date) }
|
||||||
- if @conference.registration_open?
|
- if @conference.registration_open?
|
||||||
= link_to "Register for #{@conference.short_title}", conference_register_path(@conference.short_title), :class =>"btn btn-success btn-lg", target: '_blank'
|
- if current_user && @conference.user_registered?(current_user)
|
||||||
|
= link_to "Modify Registration for #{@conference.short_title}", edit_conference_conference_registrations_path(@conference.short_title), class: "btn btn-success btn-lg", target: '_blank'
|
||||||
|
- else
|
||||||
|
= link_to "Register for #{@conference.short_title}", new_conference_conference_registrations_path(@conference.short_title), class: "btn btn-success btn-lg", target: '_blank'
|
||||||
- if @conference.use_supporter_levels?
|
- if @conference.use_supporter_levels?
|
||||||
- if @conference.include_tickets_in_splash?
|
- if @conference.include_tickets_in_splash?
|
||||||
= render 'tickets'
|
= render 'tickets'
|
||||||
|
|
|
||||||
|
|
@ -1,78 +0,0 @@
|
||||||
.row
|
|
||||||
.col-md-12
|
|
||||||
%h3
|
|
||||||
Registration for
|
|
||||||
= @conference.title
|
|
||||||
- if @user.proposal_count(@conference) > 0
|
|
||||||
.row
|
|
||||||
.col-md-12
|
|
||||||
%i
|
|
||||||
Please note: Registration is not automatically performed for speakers. If you're scheduled to speak at the conference, you still need to register!
|
|
||||||
.row
|
|
||||||
.col-md-12
|
|
||||||
= f.inputs :name => "Your Details" do
|
|
||||||
%br
|
|
||||||
Your public name (required)
|
|
||||||
%br
|
|
||||||
= f.fields_for :user do |p|
|
|
||||||
= p.input :name
|
|
||||||
|
|
||||||
- if @conference.questions
|
|
||||||
= render :partial => "questions", :locals => {:f => f}
|
|
||||||
%br
|
|
||||||
|
|
||||||
- if @conference.use_supporter_levels? && @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 :other_special_needs, :label => "Any other needs or comments?", :input_html => {:rows => 2, :class => "span6"}
|
|
||||||
|
|
||||||
- if @workshops.count > 0
|
|
||||||
=f.inputs "Register to workshops" do
|
|
||||||
= f.input :events, :as => :check_boxes, :label => false, :collection => @workshops
|
|
||||||
|
|
||||||
= f.inputs "Travel Info" do
|
|
||||||
= f.input :arrival, :as => :string, :input_html => {:value => (f.object.arrival.to_formatted_s(:db_without_seconds) unless f.object.arrival.nil?), :id => "registration-arrival-datepicker", :readonly => "readonly" }
|
|
||||||
= f.input :departure, :as => :string, :input_html => {:value => (f.object.departure.to_formatted_s(:db_without_seconds) unless f.object.departure.nil?), :id => "registration-departure-datepicker", :readonly => "readonly" }
|
|
||||||
- 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
|
|
||||||
- if @conference.use_dietary_choices?
|
|
||||||
= f.inputs "Food" do
|
|
||||||
= f.input :dietary_choice, :collection => [["None", nil]] + @conference.dietary_choices.map {|x| [x.title, x.id]},
|
|
||||||
:include_blank => false, :label => "Special Dietary Restriction"
|
|
||||||
= f.input :other_dietary_choice, :input_html => {:rows => "2"}, :label => "Other Dietary Restictions (please describe)"
|
|
||||||
|
|
||||||
: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)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
.row
|
|
||||||
.col-md-12
|
|
||||||
= semantic_form_for(@registration, :url => conference_register_path(@conference.short_title), :html => { :method => :patch }) do |f|
|
|
||||||
.tabbable
|
|
||||||
%ul.nav.nav-tabs
|
|
||||||
%li.active
|
|
||||||
= link_to "Register", "#register-content", "data-toggle"=>"tab"
|
|
||||||
- if @conference.use_volunteers
|
|
||||||
%li
|
|
||||||
= link_to "Volunteer", "#volunteer-content", "data-toggle"=>"tab"
|
|
||||||
.tab-content
|
|
||||||
#register-content.tab-pane.active
|
|
||||||
= render 'conference_registration/registration', :f => f
|
|
||||||
- if @conference.use_volunteers
|
|
||||||
#volunteer-content.tab-pane
|
|
||||||
= render 'conference_registration/volunteer', :f => f
|
|
||||||
- if @registered
|
|
||||||
= f.action :submit, :button_html => { :value => "Update Registration", :class => "btn btn-primary" }
|
|
||||||
= link_to "Unregister", conference_register_path(@conference.short_title),:method => :delete, :class => "btn btn-danger",
|
|
||||||
:confirm => "Are you sure you want to unregister?"
|
|
||||||
- else
|
|
||||||
= f.action :submit, :button_html => { :value => "Register", :class => "btn btn-primary", id: 'register' }
|
|
||||||
22
app/views/conference_registrations/_form.html.haml
Normal file
22
app/views/conference_registrations/_form.html.haml
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
= semantic_form_for(@registration, url: conference_conference_registrations_path(@conference.short_title)) do |f|
|
||||||
|
.tabbable
|
||||||
|
%ul.nav.nav-tabs
|
||||||
|
%li.active
|
||||||
|
= link_to 'Register', '#register-content', 'data-toggle' => 'tab'
|
||||||
|
- if @conference.use_volunteers
|
||||||
|
%li
|
||||||
|
= link_to 'Volunteer', '#volunteer-content', 'data-toggle' => 'tab'
|
||||||
|
.tab-content
|
||||||
|
#register-content.tab-pane.active
|
||||||
|
= render 'conference_registrations/registration', f: f
|
||||||
|
- if @conference.use_volunteers
|
||||||
|
#volunteer-content.tab-pane
|
||||||
|
= render 'conference_registrations/volunteer', f: f
|
||||||
|
- if @conference.user_registered?(current_user)
|
||||||
|
= f.action :submit, button_html: { value: 'Update Registration', class: 'btn btn-primary' }
|
||||||
|
= link_to 'Unregister', conference_conference_registrations_path(@conference.short_title),
|
||||||
|
method: :delete, class: 'btn btn-danger', confirm: 'Are you sure you want to unregister?'
|
||||||
|
- else
|
||||||
|
= f.action :submit, button_html: { value: 'Register', class: 'btn btn-primary', id: 'register' }
|
||||||
|
|
@ -7,7 +7,4 @@
|
||||||
|
|
||||||
- if q.question_type.id == 3 # multiple choice
|
- if q.question_type.id == 3 # multiple choice
|
||||||
= f.input :qanswers, :collection => q.qanswers, :as => :check_boxes, :label => false,
|
= f.input :qanswers, :collection => q.qanswers, :as => :check_boxes, :label => false,
|
||||||
:member_label => Proc.new {|a| a.answer.title}
|
:member_label => Proc.new {|a| a.answer.title}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
35
app/views/conference_registrations/_registration.html.haml
Normal file
35
app/views/conference_registrations/_registration.html.haml
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
%h3
|
||||||
|
Registration for
|
||||||
|
= @conference.title
|
||||||
|
- if current_user.proposal_count(@conference) > 0
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
%i
|
||||||
|
Please note: Registration is not automatically performed for speakers. If you're scheduled to speak at the conference, you still need to register!
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
= f.inputs name: 'Your Details' do
|
||||||
|
- if @conference.questions
|
||||||
|
= render partial: 'questions', locals: { f: f }
|
||||||
|
%br
|
||||||
|
- if @conference.use_supporter_levels? && @conference.supporter_levels.length > 0
|
||||||
|
= f.semantic_fields_for :supporter_registration do |reg|
|
||||||
|
= reg.input :supporter_level, as: :select, collection: @conference.supporter_levels
|
||||||
|
%span#supporter-link.help-block
|
||||||
|
|
||||||
|
- if @workshops.count > 0
|
||||||
|
=f.inputs 'Register to Workshops' do
|
||||||
|
= f.input :events, as: :check_boxes, label: false, collection: @workshops
|
||||||
|
|
||||||
|
= f.inputs 'Travel Info' do
|
||||||
|
= f.input :arrival, as: :string, input_html: { value: (f.object.arrival.to_formatted_s(:db_without_seconds) unless f.object.arrival.nil?), id: 'registration-arrival-datepicker', readonly: 'readonly' }
|
||||||
|
= f.input :departure, as: :string, input_html: { value: (f.object.departure.to_formatted_s(:db_without_seconds) unless f.object.departure.nil?), id: 'registration-departure-datepicker', readonly: 'readonly' }
|
||||||
|
|
||||||
|
:javascript
|
||||||
|
$("#registration_supporter_registration_attributes_supporter_level_id").change(function () {
|
||||||
|
var str = "";
|
||||||
|
#{generate_supporter_level_js @conference}
|
||||||
|
$("#supporter-link").html(str);
|
||||||
|
}).trigger('change');
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
= f.input :volunteer, :label => "Click here if you want to become a volunteer at #{@conference.short_title}", :input_html => {:maxlength => 15, :size => 40}
|
= f.input :volunteer, :label => "Click here if you want to become a volunteer at #{@conference.short_title}", :input_html => {:maxlength => 15, :size => 40}
|
||||||
= f.fields_for :user do |u|
|
= f.fields_for :user do |u|
|
||||||
= render :partial => 'devise/registrations/volunteeruser', :locals => {:u => u}
|
= render :partial => 'devise/registrations/volunteeruser', :locals => {:u => u}
|
||||||
|
|
||||||
%br
|
%br
|
||||||
- if @conference.vpositions.count > 0
|
- if @conference.vpositions.count > 0
|
||||||
%h4
|
%h4
|
||||||
|
|
@ -31,9 +31,9 @@
|
||||||
= link_to "View Conference", conference_path(conference.short_title), :class =>"btn btn-default"
|
= link_to "View Conference", conference_path(conference.short_title), :class =>"btn btn-default"
|
||||||
- if conference.registration_open?
|
- if conference.registration_open?
|
||||||
- if conference.user_registered?(current_user)
|
- if conference.user_registered?(current_user)
|
||||||
= link_to "Modify Registration", conference_register_path(conference.short_title), :class =>"btn btn-default"
|
= link_to "Modify Registration", edit_conference_conference_registrations_path(conference.short_title), :class =>"btn btn-default"
|
||||||
- else
|
- else
|
||||||
= link_to "Register", conference_register_path(conference.short_title), :class =>"btn btn-success"
|
= link_to "Register", new_conference_conference_registrations_path(conference.short_title), :class =>"btn btn-success"
|
||||||
= link_to "Schedule", conference_schedule_path(conference.short_title), :class =>"btn btn-default" if conference.call_for_papers and conference.call_for_papers.schedule_public
|
= link_to "Schedule", conference_schedule_path(conference.short_title), :class =>"btn btn-default" if conference.call_for_papers and conference.call_for_papers.schedule_public
|
||||||
- if !current_user.nil? && current_user.proposal_count(conference) > 0
|
- if !current_user.nil? && current_user.proposal_count(conference) > 0
|
||||||
= link_to "View My Proposals", conference_proposal_index_path(conference.short_title), :class =>"btn btn-default"
|
= link_to "View My Proposals", conference_proposal_index_path(conference.short_title), :class =>"btn btn-default"
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
(Pre-registered: #{pre_registered(event).count})
|
(Pre-registered: #{pre_registered(event).count})
|
||||||
- if event.confirmed? && !@conference.user_registered?(current_user)
|
- if event.confirmed? && !@conference.user_registered?(current_user)
|
||||||
%br
|
%br
|
||||||
= link_to "Register to attend", conference_register_path(@conference.short_title), :style => "font-size:10px;"
|
= link_to "Register to attend", new_conference_conference_registrations_path(@conference.short_title), :style => "font-size:10px;"
|
||||||
%td
|
%td
|
||||||
.pull-right
|
.pull-right
|
||||||
- if event.transition_possible? :confirm
|
- if event.transition_possible? :confirm
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
%span.label{:style =>"background-color: #{@event.difficulty_level.color};"}
|
%span.label{:style =>"background-color: #{@event.difficulty_level.color};"}
|
||||||
= @event.difficulty_level.title
|
= @event.difficulty_level.title
|
||||||
- if @event.require_registration
|
- if @event.require_registration
|
||||||
= link_to "Registration required!", conference_register_path(@conference.short_title), :class => "btn btn-xs btn-warning"
|
= link_to "Registration required!", new_conference_conference_registrations_path(@conference.short_title), :class => "btn btn-xs btn-warning"
|
||||||
.col-md-9
|
.col-md-9
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@ Osem::Application.routes.draw do
|
||||||
get '/volunteers' => 'volunteers#index', as: 'volunteers_info'
|
get '/volunteers' => 'volunteers#index', as: 'volunteers_info'
|
||||||
patch '/volunteers' => 'volunteers#update', as: 'volunteers_update'
|
patch '/volunteers' => 'volunteers#update', as: 'volunteers_update'
|
||||||
|
|
||||||
patch '/registrations/change_field' => 'registrations#change_field'
|
patch '/registrations/toogle_attended' => 'registrations#toogle_attended'
|
||||||
resources :registrations
|
resources :registrations, except: [:create, :new]
|
||||||
|
|
||||||
resource :registration_period
|
resource :registration_period
|
||||||
|
|
||||||
|
|
@ -97,13 +97,13 @@ Osem::Application.routes.draw do
|
||||||
patch '/restart' => 'proposal#restart'
|
patch '/restart' => 'proposal#restart'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
resource :conference_registrations, path: 'register'
|
||||||
|
|
||||||
resource :schedule, only: [] do
|
resource :schedule, only: [] do
|
||||||
get "/" => "schedule#index"
|
get "/" => "schedule#index"
|
||||||
end
|
end
|
||||||
|
|
||||||
get "/register" => "conference_registration#register"
|
|
||||||
patch "/register" => "conference_registration#update"
|
|
||||||
delete "/register" => "conference_registration#unregister"
|
|
||||||
member do
|
member do
|
||||||
get "gallery_photos"
|
get "gallery_photos"
|
||||||
patch "subscription" => "conference#subscribe"
|
patch "subscription" => "conference#subscribe"
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ feature Event do
|
||||||
click_button 'Create Event'
|
click_button 'Create Event'
|
||||||
expect(flash).to eq('Event was successfully submitted. You should register for the conference now.')
|
expect(flash).to eq('Event was successfully submitted. You should register for the conference now.')
|
||||||
|
|
||||||
expect(current_path).to eq(conference_register_path(conference.short_title))
|
expect(current_path).to eq(new_conference_conference_registrations_path(conference.short_title))
|
||||||
|
|
||||||
expect(Event.count).to eq(expected_count)
|
expect(Event.count).to eq(expected_count)
|
||||||
|
|
||||||
|
|
@ -128,7 +128,7 @@ feature Event do
|
||||||
|
|
||||||
# Register for conference
|
# Register for conference
|
||||||
find('#register').click
|
find('#register').click
|
||||||
expect(flash).to eq('You are now Registered and will be receiving Email Notifications.')
|
expect(flash).to eq('You are now registered and will be receiving E-Mail notifications.')
|
||||||
|
|
||||||
# Withdraw proposal
|
# Withdraw proposal
|
||||||
visit conference_proposal_index_path(conference.short_title)
|
visit conference_proposal_index_path(conference.short_title)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue