Merge branch 'final_volunteers' of https://github.com/differentreality/osem into differentreality-final_volunteers

Conflicts:
	app/models/conference.rb
	app/models/registration.rb
	app/views/admin/conference/_sidebar.html.haml
	app/views/conference_registration/register.html.haml
This commit is contained in:
Henne Vogelsang 2014-03-03 10:52:24 +01:00
commit 14a896842b
31 changed files with 342 additions and 43 deletions

View file

@ -0,0 +1,23 @@
class Admin::VolunteersController < ApplicationController
def index
@conference = Conference.find_all_by_short_title(params[:conference_id]).first
render :index
end
def show
@conference = Conference.find_all_by_short_title(params[:conference_id]).first
@volunteers = @conference.registrations.joins(:vchoices).all
end
def update
@conference = Conference.find_all_by_short_title(params[:conference_id]).first
# @conference.update_attributes(params[:conference])
# redirect_to admin_conference_volunteers_path(@conference.short_title)
begin
@conference.update_attributes!(params[:conference])
redirect_to(admin_conference_volunteer_options_path(:conference_id => params[:conference_id]), :notice => "Volunteering options were successfully updated.")
rescue Exception => e
redirect_to(admin_conference_volunteer_options_path(:conference_id => params[:conference_id]), :alert => "Volunteering options update failed: #{e.message}")
end
end
end

View file

@ -2,7 +2,12 @@ class Conference < ActiveRecord::Base
attr_accessible :title, :short_title, :social_tag, :contact_email, :timezone, :html_export_path,
:start_date, :end_date, :rooms_attributes, :tracks_attributes, :dietary_choices_attributes,
:use_dietary_choices, :use_supporter_levels, :supporter_levels_attributes, :social_events_attributes,
<<<<<<< HEAD
:event_types_attributes, :registration_start_date, :registration_end_date, :logo, :questions_attributes, :question_ids, :answers_attributes, :answer_ids, :difficulty_levels_attributes, :use_difficulty_levels
=======
:event_types_attributes, :registration_start_date, :registration_end_date, :logo, :use_vpositions, :use_vdays, :vdays_attributes,
:vpositions_attributes
>>>>>>> 64b2b8b3f8a62be1a4161d957c06a958debe89cc
has_paper_trail
@ -20,6 +25,9 @@ class Conference < ActiveRecord::Base
has_many :difficulty_levels, :dependent => :destroy
has_many :rooms, :dependent => :destroy
has_many :registrations, :dependent => :destroy
has_many :vdays, :dependent => :destroy
has_many :vpositions, :dependent => :destroy
has_many :vchoices, :dependent => :destroy
belongs_to :venue
@ -32,7 +40,12 @@ class Conference < ActiveRecord::Base
accepts_nested_attributes_for :supporter_levels, :allow_destroy => true
accepts_nested_attributes_for :event_types, :allow_destroy => true
accepts_nested_attributes_for :email_settings
<<<<<<< HEAD
accepts_nested_attributes_for :questions, :allow_destroy => true
=======
accepts_nested_attributes_for :vdays, :allow_destroy => true
accepts_nested_attributes_for :vpositions, :allow_destroy => true
>>>>>>> 64b2b8b3f8a62be1a4161d957c06a958debe89cc
has_attached_file :logo,
:styles => {:thumb => "100x100>", :large => "300x300>" }

View file

@ -2,7 +2,7 @@ class Person < ActiveRecord::Base
include Gravtastic
gravtastic :size => 32
attr_accessible :email, :first_name, :last_name, :public_name, :biography, :company, :avatar, :irc_nickname
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
@ -18,6 +18,7 @@ class Person < ActiveRecord::Base
before_create :generate_guid
before_save :set_public_name
before_save :languages_upcase
has_attached_file :avatar,
:styles => {:tiny => "16x16>", :small => "32x32>", :large => "128x128>"},
@ -26,6 +27,10 @@ class Person < ActiveRecord::Base
alias_attribute :affiliation, :company
def languages_upcase
self.languages = self.languages.upcase
end
def to_s
if self.public_name.empty?
self.first_name + " " + self.last_name

View file

@ -8,10 +8,13 @@ class Registration < ActiveRecord::Base
has_and_belongs_to_many :social_events
has_and_belongs_to_many :events
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,
:handicapped_access_required, :supporter_registration_attributes, :social_event_ids, :other_special_needs, :event_ids, :attended, :qanswer_ids, :qanswers_attributes
: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 :supporter_registration
@ -24,6 +27,10 @@ class Registration < ActiveRecord::Base
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
alias_attribute :other_needs, :other_special_needs
end

6
app/models/vchoice.rb Normal file
View file

@ -0,0 +1,6 @@
class Vchoice < ActiveRecord::Base
belongs_to :vday
belongs_to :vposition
has_and_belongs_to_many :registrations
end

8
app/models/vday.rb Normal file
View file

@ -0,0 +1,8 @@
class Vday < ActiveRecord::Base
attr_accessible :day, :description
belongs_to :conference
has_many :vchoices
has_many :vpositions, :through => :vchoices, :dependent => :destroy
end

10
app/models/vposition.rb Normal file
View file

@ -0,0 +1,10 @@
class Vposition < ActiveRecord::Base
attr_accessible :title, :description, :date, :vday_ids
belongs_to :conference
has_many :vchoices
has_many :vdays, :through => :vchoices
validates_presence_of :title, :vdays
end

View file

@ -51,3 +51,7 @@
%li.active= link_to "Questions", "#"
- else
%li= link_to "Questions", admin_conference_questions_path(@conference.short_title)
- if activated == "volunteers"
%li.active= link_to "Volunteer Options", "#"
- else
%li= link_to "Volunteer Options", admin_conference_volunteer_options_path(@conference.short_title)

View file

@ -0,0 +1,7 @@
<div class="nested-fields">
<%= f.inputs do %>
<%= f.date_select :day %>
<%= f.input :description, :input_html => {:rows => "2", :class => "span8"} %>
<%= remove_association_link :vday, f %>
<% end %>
</div>

View file

@ -0,0 +1,19 @@
%table.table.table-striped.table-bordered.table-hover#speakertable
%thead
%th First Name
%th Last Name
%th Email
%th Mobile
%th Languages
%th Experience
%th Tshirt Size
%tbody
- @volunteers.each do |volunteer|
%tr
%td= volunteer.first_name
%td= volunteer.last_name
%td= volunteer.email
%td= volunteer.mobile
%td= volunteer.languages
%td= volunteer.volunteer_experience
%td= volunteer.tshirt

View file

@ -0,0 +1,8 @@
<div class="nested-fields">
<%= f.inputs do %>
<%= f.input :title %>
<%= f.input :description, :input_html => {:rows => "2", :class => "span8"}%>
<%= f.input :vdays, :collection => @conference.vdays.map {|x| [x.day, x.id]}, :label => "Position is required for the following days:"%>
<%= remove_association_link :vposition, f %>
<% end %>
</div>

View file

@ -0,0 +1,15 @@
.container-fluid
.row-fluid
.span3
= render 'admin/conference/sidebar', :activated => "Volunteers"
.span9
= semantic_form_for(@conference, :url => admin_conference_volunteer_options_update_path(@conference.short_title)) do |f|
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
%br
%br
.span5
= f.input :use_vdays, :label => false
= dynamic_association :vdays, "Volunteer Days", f
.span5
= f.input :use_vpositions, :label => false
= dynamic_association :vpositions, "Volunteer positions", f

View file

@ -0,0 +1,6 @@
- if @volunteers.count > 0
%h3= "Volunteers (#{@volunteers.count})"
%br
= render :partial => "volunteers_table"
- else
%h3 There are no volunteers yet!

View file

@ -0,0 +1,76 @@
.row
.span12
%h3
Registration for
= @conference.title
- if @person.proposal_count(@conference) > 0
.row
.span12
%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
.span12
= 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?
= 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 @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)
}
});

View file

@ -0,0 +1,16 @@
.row
.span12
= 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}
%br
- if @conference.vpositions.count > 0
%h4
%u Positions that require volunteers:
- @conference.vpositions.each do |pos|
%p{:style => "font-weight:bold"}
= pos.title
= "(#{pos.description})" if pos.description
= f.input :vchoices, :collection => pos.vchoices.map {|x| [x.vday.day, x.id]}, :label => "Choose days to volunteer:"

View file

@ -1,13 +1,3 @@
.row
.span12
%h3
Registration for
= @conference.title
- if @person.proposal_count(@conference) > 0
.row
.span12
%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
.span12
= semantic_form_for(@registration, :url => register_conference_path(@conference.short_title), :html => { :method => :put }) do |f|
@ -47,40 +37,20 @@
= 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)"
.tabbable
%ul.nav.nav-tabs
%li.active
= link_to "Register", "#register-content", "data-toggle"=>"tab"
%li
= link_to "Volunteer", "#volunteer-content", "data-toggle"=>"tab"
.tab-content
#register-content.tab-pane.active
= render 'conference_registration/registration', :f => f
#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", register_conference_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" }
: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)
}
});

View file

@ -0,0 +1,7 @@
=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"}

View file

@ -16,6 +16,8 @@
words. Biographies are limited to 150 words.
%br
%br
= render :partial => 'devise/registrations/volunteerperson', :locals => {:p => p}
= f.inputs :name => "Account" do
= f.input :email, :required => false
= f.input :password, :hint => "(Leave blank if you don't want to change it)", :input_html => {:autocomplete => "off"}

View file

@ -63,6 +63,16 @@
= link_to(admin_conference_stats_path(@conference.short_title)) do
%i.icon-tasks
Statistics
- if current_page?(admin_conference_volunteers_list_path(@conference.short_title))
%li.active
= link_to('#') do
%i.icon-user
Volunteers
- else
%li
= link_to(admin_conference_volunteers_list_path(@conference.short_title)) do
%i.icon-user
Volunteers
%li
= link_to(admin_conference_schedule_path(@conference.short_title), :target => "_blank") do
%i.icon-calendar

View file

@ -30,6 +30,9 @@ Osem::Application.routes.draw do
put "/tracks" => "tracks#update", :as => "tracks_update"
get "/dietary_choices" => "dietchoices#show", :as => "dietary_list"
put "/dietary_choices" => "dietchoices#update", :as => "dietary_update"
get "/volunteers_list" => "volunteers#show"
get "/volunteers" => "volunteers#index", :as => "volunteer_options"
put "/volunteers" => "volunteers#update", :as => "volunteer_options_update"
get "/cfp" => "callforpapers#show", :as => "cfp_info"
put "/cfp" => "callforpapers#update", :as => "cfp_update"
post "/cfp" => "callforpapers#create", :as => "cfp_create"

View file

@ -0,0 +1,5 @@
class AddVolunteerToRegistrations < ActiveRecord::Migration
def change
add_column :registrations, :volunteer, :boolean
end
end

View file

@ -0,0 +1,5 @@
class AddVolunteerExperienceToRegistrations < ActiveRecord::Migration
def change
add_column :people, :volunteer_experience, :text
end
end

View file

@ -0,0 +1,5 @@
class AddTshirtToPeople < ActiveRecord::Migration
def change
add_column :people, :tshirt, :string
end
end

View file

@ -0,0 +1,5 @@
class AddMobileToPeople < ActiveRecord::Migration
def change
add_column :people, :mobile, :string
end
end

View file

@ -0,0 +1,5 @@
class AddLanguagesToPeople < ActiveRecord::Migration
def change
add_column :people, :languages, :string
end
end

View file

@ -0,0 +1,5 @@
class AddUseVpositionsToConferences < ActiveRecord::Migration
def change
add_column :conferences, :use_vpositions, :boolean
end
end

View file

@ -0,0 +1,5 @@
class AddUseVdaysToConferences < ActiveRecord::Migration
def change
add_column :conferences, :use_vdays, :boolean
end
end

View file

@ -0,0 +1,15 @@
class CreateVpositions < ActiveRecord::Migration
def up
create_table :vpositions do |t|
t.references :conference
t.string :title, :null => false
t.text :description
t.timestamps
end
end
def down
drop_table :vpositions
end
end

View file

@ -0,0 +1,15 @@
class CreateVdays < ActiveRecord::Migration
def up
create_table :vdays do |t|
t.references :conference
t.date :day
t.text :description
t.timestamps
end
end
def down
drop_table :vdays
end
end

View file

@ -0,0 +1,8 @@
class CreateVchoices < ActiveRecord::Migration
def change
create_table :vchoices do |t|
t.references :vday
t.references :vposition
end
end
end

View file

@ -0,0 +1,11 @@
class RegistrationsVchoices < ActiveRecord::Migration
def up
create_table :registrations_vchoices, :id => false do |t|
t.references :registration, :vchoice
end
end
def down
drop_table :registrations_vchoices
end
end