diff --git a/app/controllers/admin/dietchoices_controller.rb b/app/controllers/admin/dietchoices_controller.rb
new file mode 100644
index 00000000..ad9c7f07
--- /dev/null
+++ b/app/controllers/admin/dietchoices_controller.rb
@@ -0,0 +1,17 @@
+class Admin::DietchoicesController < ApplicationController
+ before_filter :verify_organizer
+ layout "admin"
+
+ def show
+ render :diets_list
+ end
+
+ def update
+ begin
+ @conference.update_attributes!(params[:conference])
+ redirect_to(admin_conference_dietary_list_path(:conference_id => @conference.short_title), :notice => 'Dietary choices were successfully updated.')
+ rescue Exception => e
+ redirect_to(admin_conference_dietary_list_path(:conference_id => @conference.short_title), :alert => "Dietary choices update failed: #{e.message}")
+ end
+ end
+end
\ No newline at end of file
diff --git a/app/controllers/admin/supporter_levels_controller.rb b/app/controllers/admin/supporter_levels_controller.rb
new file mode 100644
index 00000000..5f77e9e4
--- /dev/null
+++ b/app/controllers/admin/supporter_levels_controller.rb
@@ -0,0 +1,17 @@
+class Admin::SupporterLevelsController < ApplicationController
+ before_filter :verify_organizer
+ layout "admin"
+
+ def show
+ render :supporter_levels
+ end
+
+ def update
+ begin
+ @conference.update_attributes!(params[:conference])
+ redirect_to(admin_conference_supporter_levels_path(:conference_id => @conference.short_title), :notice => 'Supporter levels were successfully updated.')
+ rescue Exception => e
+ redirect_to(admin_conference_supporter_levels_path(:conference_id => @conference.short_title), :alert => "Supporter levels update failed: #{e.message}")
+ end
+ end
+end
\ No newline at end of file
diff --git a/app/controllers/conference_registration_controller.rb b/app/controllers/conference_registration_controller.rb
index 11b54c69..aa3abda1 100644
--- a/app/controllers/conference_registration_controller.rb
+++ b/app/controllers/conference_registration_controller.rb
@@ -11,6 +11,8 @@ class ConferenceRegistrationController < ApplicationController
@registered = false
@registration = @person.registrations.new(:conference_id => @conference.id)
end
+
+ @registration.supporter_registration ||= SupporterRegistration.new
end
# TODO this is ugly
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb
index 4d97851a..04828917 100644
--- a/app/controllers/registrations_controller.rb
+++ b/app/controllers/registrations_controller.rb
@@ -18,16 +18,14 @@ class RegistrationsController < Devise::RegistrationsController
else
params[:user].delete :password
params[:user].delete :password_confirmation
- params[:user].delete :current_password
end
end
-
- successfully_updated = if email_changed or password_changed
- @user.update_with_password(params[:user])
- else
- @user.update_without_password(params[:user])
- end
+ if email_changed or password_changed
+ successfully_updated = @user.update_with_password(params[:user])
+ else
+ successfully_updated = @user.update_without_password(params[:user])
+ end
if successfully_updated
set_flash_message :notice, :updated
diff --git a/app/models/conference.rb b/app/models/conference.rb
index a34f305e..ef06bf2b 100644
--- a/app/models/conference.rb
+++ b/app/models/conference.rb
@@ -1,12 +1,15 @@
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,
+ :start_date, :end_date, :rooms_attributes, :tracks_attributes, :dietary_choices_attributes,
+ :use_dietary_choices, :use_supporter_levels, :supporter_levels_attributes,
:event_types_attributes, :registration_start_date, :registration_end_date, :logo
has_paper_trail
has_one :email_settings, :dependent => :destroy
has_one :call_for_papers, :dependent => :destroy
+ has_many :supporter_levels, :dependent => :destroy
+ has_many :dietary_choices, :dependent => :destroy
has_many :events, :dependent => :destroy
has_many :event_types, :dependent => :destroy
has_many :tracks, :dependent => :destroy
@@ -18,6 +21,8 @@ class Conference < ActiveRecord::Base
accepts_nested_attributes_for :rooms, :reject_if => proc {|r| r["name"].blank?}, :allow_destroy => true
accepts_nested_attributes_for :tracks, :reject_if => proc {|r| r["name"].blank?}, :allow_destroy => true
accepts_nested_attributes_for :venue
+ accepts_nested_attributes_for :dietary_choices, :allow_destroy => true
+ accepts_nested_attributes_for :supporter_levels, :allow_destroy => true
accepts_nested_attributes_for :event_types, :allow_destroy => true
accepts_nested_attributes_for :email_settings
diff --git a/app/models/dietary_choice.rb b/app/models/dietary_choice.rb
new file mode 100644
index 00000000..ffe896b7
--- /dev/null
+++ b/app/models/dietary_choice.rb
@@ -0,0 +1,7 @@
+class DietaryChoice < ActiveRecord::Base
+ attr_accessible :title
+
+ belongs_to :conference
+ has_many :registrations
+
+end
diff --git a/app/models/registration.rb b/app/models/registration.rb
index b8886570..ddb01971 100644
--- a/app/models/registration.rb
+++ b/app/models/registration.rb
@@ -1,9 +1,14 @@
class Registration < ActiveRecord::Base
belongs_to :person
belongs_to :conference
+ belongs_to :dietary_choice
+
+ has_one :supporter_registration
attr_accessible :person_id, :conference_id, :attending_social_events, :attending_social_events_with_partner,
- :using_affiliated_lodging, :arrival, :departure, :person_attributes
- accepts_nested_attributes_for :person
+ :using_affiliated_lodging, :arrival, :departure, :person_attributes, :other_dietary_choice, :dietary_choice_id,
+ :handicapped_access_required, :supporter_registration_attributes
+ accepts_nested_attributes_for :person
+ accepts_nested_attributes_for :supporter_registration
end
\ No newline at end of file
diff --git a/app/models/supporter_level.rb b/app/models/supporter_level.rb
new file mode 100644
index 00000000..e51c1be5
--- /dev/null
+++ b/app/models/supporter_level.rb
@@ -0,0 +1,6 @@
+class SupporterLevel < ActiveRecord::Base
+ belongs_to :conference
+ has_many :supporter_registrations
+
+ attr_accessible :conference, :title, :url
+end
diff --git a/app/models/supporter_registration.rb b/app/models/supporter_registration.rb
new file mode 100644
index 00000000..085bc829
--- /dev/null
+++ b/app/models/supporter_registration.rb
@@ -0,0 +1,6 @@
+class SupporterRegistration < ActiveRecord::Base
+ belongs_to :supporter_level
+ belongs_to :registration
+
+ attr_accessible :registration, :supporter_level_id, :code, :code_is_valid
+end
diff --git a/app/views/admin/conference/_sidebar.html.haml b/app/views/admin/conference/_sidebar.html.haml
index 02f08fc7..8538a073 100644
--- a/app/views/admin/conference/_sidebar.html.haml
+++ b/app/views/admin/conference/_sidebar.html.haml
@@ -4,6 +4,10 @@
%li.active= link_to "Conference", "#"
- else
%li= link_to "Conference", admin_conference_path(@conference.short_title)
+ - if activated == "Levels"
+ %li.active= link_to "Supporter Levels", "#"
+ - else
+ %li= link_to "Supporter Levels", admin_conference_supporter_levels_path(@conference.short_title)
- if activated == "Call for Papers"
%li.active= link_to "Call for Papers", "#"
- else
@@ -28,3 +32,8 @@
%li.active= link_to "Emails", "#"
- else
%li= link_to "Emails", admin_conference_email_settings_path(@conference.short_title)
+ - if activated == "Diet"
+ %li.active= link_to "Dietary Choices", "#"
+ - else
+ %li= link_to "Dietary Choices", admin_conference_dietary_list_path(@conference.short_title)
+
diff --git a/app/views/admin/dietchoices/_dietary_choice_fields.html.erb b/app/views/admin/dietchoices/_dietary_choice_fields.html.erb
new file mode 100644
index 00000000..a71a416f
--- /dev/null
+++ b/app/views/admin/dietchoices/_dietary_choice_fields.html.erb
@@ -0,0 +1,6 @@
+
+ <%= f.inputs do %>
+ <%= f.input :title %>
+ <%= remove_association_link :dietary_choice, f %>
+ <% end %>
+
diff --git a/app/views/admin/dietchoices/diets_list.html.haml b/app/views/admin/dietchoices/diets_list.html.haml
new file mode 100644
index 00000000..537c26de
--- /dev/null
+++ b/app/views/admin/dietchoices/diets_list.html.haml
@@ -0,0 +1,9 @@
+.container-fluid
+ .row-fluid
+ .span3
+ = render 'admin/conference/sidebar', :activated => "Diet"
+ .span9
+ = semantic_form_for(@conference, :url => admin_conference_dietary_update_path(@conference.short_title)) do |f|
+ = f.input :use_dietary_choices, :label => false
+ = dynamic_association :dietary_choices, "Dietary Choices", f
+ = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
\ No newline at end of file
diff --git a/app/views/admin/supporter_levels/_supporter_level_fields.html.erb b/app/views/admin/supporter_levels/_supporter_level_fields.html.erb
new file mode 100644
index 00000000..ec793dc7
--- /dev/null
+++ b/app/views/admin/supporter_levels/_supporter_level_fields.html.erb
@@ -0,0 +1,7 @@
+
+ <%= f.inputs do %>
+ <%= f.input :title%>
+ <%= f.input :url %>
+ <%= remove_association_link :supporter_level, f %>
+ <% end %>
+
diff --git a/app/views/admin/supporter_levels/supporter_levels.html.haml b/app/views/admin/supporter_levels/supporter_levels.html.haml
new file mode 100644
index 00000000..0c619057
--- /dev/null
+++ b/app/views/admin/supporter_levels/supporter_levels.html.haml
@@ -0,0 +1,9 @@
+.container-fluid
+ .row-fluid
+ .span3
+ = render 'admin/conference/sidebar', :activated => "Levels"
+ .span9
+ = semantic_form_for(@conference, :url => admin_conference_supporter_levels_path(@conference.short_title)) do |f|
+ = f.input :use_supporter_levels, :label => false
+ = dynamic_association :supporter_levels, "Supporter Levels", f
+ = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
\ No newline at end of file
diff --git a/app/views/conference_registration/register.html.haml b/app/views/conference_registration/register.html.haml
index a5867688..7c952544 100644
--- a/app/views/conference_registration/register.html.haml
+++ b/app/views/conference_registration/register.html.haml
@@ -17,8 +17,17 @@
= f.input :attending_social_events, :label => false
= f.input :attending_social_events_with_partner, :label => false
= f.input :using_affiliated_lodging, :label => false
+ = f.input :handicapped_access_required, :label => false
= f.input :arrival, :as => :string, :input_html => {:value => (f.object.arrival.to_formatted_s(:db_without_seconds) unless f.object.arrival.nil?), :id => "conference-reg-start-datepicker", :readonly => "readonly" }
= f.input :departure, :as => :string, :input_html => {:value => (f.object.departure.to_formatted_s(:db_without_seconds) unless f.object.arrival.nil?), :id => "conference-reg-end-datepicker", :readonly => "readonly" }
+ - if @conference.use_dietary_choices?
+ = 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)"
+ - 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, :hint => "If you have a confirmation or registration code, enter it here."
- 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",
diff --git a/config/routes.rb b/config/routes.rb
index 2c98c58d..122a58d5 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -12,12 +12,16 @@ Osem::Application.routes.draw do
get "/registrations" => "registrations#show"
get "/emailsettings" => "emails#show", :as => "email_settings"
put "/emailsettings" => "emails#update", :as => "email_settings"
+ get "/supporter_levels" => "SupporterLevels#show"
+ put "/supporter_levels" => "SupporterLevels#update"
get "/venue" => "venue#show", :as => "venue_info"
put "/venue" => "venue#update", :as => "venue_update"
get "/rooms" => "rooms#show", :as => "rooms_list"
put "/rooms" => "rooms#update", :as => "rooms_update"
get "/tracks" => "tracks#show", :as => "tracks_list"
put "/tracks" => "tracks#update", :as => "tracks_update"
+ get "/dietary_choices" => "dietchoices#show", :as => "dietary_list"
+ put "/dietary_choices" => "dietchoices#update", :as => "dietary_update"
get "/cfp" => "callforpapers#show", :as => "cfp_info"
put "/cfp" => "callforpapers#update", :as => "cfp_update"
post "/cfp" => "callforpapers#create", :as => "cfp_create"
diff --git a/db/migrate/20130202091022_add_dietary_choice_to_conferences.rb b/db/migrate/20130202091022_add_dietary_choice_to_conferences.rb
new file mode 100644
index 00000000..c1e55417
--- /dev/null
+++ b/db/migrate/20130202091022_add_dietary_choice_to_conferences.rb
@@ -0,0 +1,5 @@
+class AddDietaryChoiceToConferences < ActiveRecord::Migration
+ def change
+ add_column :conferences, :use_dietary_choices, :boolean, :default => false
+ end
+end
diff --git a/db/migrate/20130202091051_create_dietary_choices_table.rb b/db/migrate/20130202091051_create_dietary_choices_table.rb
new file mode 100644
index 00000000..bc320e88
--- /dev/null
+++ b/db/migrate/20130202091051_create_dietary_choices_table.rb
@@ -0,0 +1,13 @@
+class CreateDietaryChoicesTable < ActiveRecord::Migration
+ def up
+ create_table :dietary_choices do |t|
+ t.references :conference
+ t.string :title, :null => false
+ t.timestamps
+ end
+ end
+
+ def down
+ drop_table :dietary_choices
+ end
+end
diff --git a/db/migrate/20130202091229_add_dietary_choice_to_registration.rb b/db/migrate/20130202091229_add_dietary_choice_to_registration.rb
new file mode 100644
index 00000000..5694d206
--- /dev/null
+++ b/db/migrate/20130202091229_add_dietary_choice_to_registration.rb
@@ -0,0 +1,5 @@
+class AddDietaryChoiceToRegistration < ActiveRecord::Migration
+ def change
+ add_column :registrations, :dietary_choice_id, :integer
+ end
+end
diff --git a/db/migrate/20130202093137_add_dietary_text_to_registration.rb b/db/migrate/20130202093137_add_dietary_text_to_registration.rb
new file mode 100644
index 00000000..3147cd3c
--- /dev/null
+++ b/db/migrate/20130202093137_add_dietary_text_to_registration.rb
@@ -0,0 +1,5 @@
+class AddDietaryTextToRegistration < ActiveRecord::Migration
+ def change
+ add_column :registrations, :other_dietary_choice, :text
+ end
+end
diff --git a/db/migrate/20130202102024_add_handicapped_access_to_registrations.rb b/db/migrate/20130202102024_add_handicapped_access_to_registrations.rb
new file mode 100644
index 00000000..63cd4251
--- /dev/null
+++ b/db/migrate/20130202102024_add_handicapped_access_to_registrations.rb
@@ -0,0 +1,5 @@
+class AddHandicappedAccessToRegistrations < ActiveRecord::Migration
+ def change
+ add_column :registrations, :handicapped_access_required, :boolean, :default => false
+ end
+end
diff --git a/db/migrate/20130202130737_create_supporter_level_table.rb b/db/migrate/20130202130737_create_supporter_level_table.rb
new file mode 100644
index 00000000..342a37fd
--- /dev/null
+++ b/db/migrate/20130202130737_create_supporter_level_table.rb
@@ -0,0 +1,13 @@
+class CreateSupporterLevelTable < ActiveRecord::Migration
+ def up
+ create_table :supporter_levels do |t|
+ t.references :conference
+ t.string :title, :null => false
+ t.string :url
+ end
+ end
+
+ def down
+ drop_table :supporter_levels
+ end
+end
diff --git a/db/migrate/20130202130923_create_table_supporter_registrations.rb b/db/migrate/20130202130923_create_table_supporter_registrations.rb
new file mode 100644
index 00000000..9c7b8a04
--- /dev/null
+++ b/db/migrate/20130202130923_create_table_supporter_registrations.rb
@@ -0,0 +1,15 @@
+class CreateTableSupporterRegistrations < ActiveRecord::Migration
+ def up
+ create_table :supporter_registrations do |t|
+ t.references :registration
+ t.references :supporter_level
+ t.string :email
+ t.string :code
+ t.boolean :code_is_valid, :default => false
+ end
+ end
+
+ def down
+ drop_table :supporter_registrations
+ end
+end
diff --git a/db/migrate/20130202131932_add_use_supporter_levels_to_conferences.rb b/db/migrate/20130202131932_add_use_supporter_levels_to_conferences.rb
new file mode 100644
index 00000000..5d3918b2
--- /dev/null
+++ b/db/migrate/20130202131932_add_use_supporter_levels_to_conferences.rb
@@ -0,0 +1,5 @@
+class AddUseSupporterLevelsToConferences < ActiveRecord::Migration
+ def change
+ add_column :conferences, :use_supporter_levels, :boolean, :default => false
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index aa3435a9..b94006d8 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20130131100257) do
+ActiveRecord::Schema.define(:version => 20130202131932) do
create_table "call_for_papers", :force => true do |t|
t.date "start_date", :null => false
@@ -42,24 +42,33 @@ ActiveRecord::Schema.define(:version => 20130131100257) do
add_index "comments", ["user_id"], :name => "index_comments_on_user_id"
create_table "conferences", :force => true do |t|
- t.string "guid", :null => false
- t.string "title", :null => false
- t.string "short_title", :null => false
+ t.string "guid", :null => false
+ t.string "title", :null => false
+ t.string "short_title", :null => false
t.string "social_tag"
- t.string "contact_email", :null => false
- t.string "timezone", :null => false
+ t.string "contact_email", :null => false
+ t.string "timezone", :null => false
t.string "html_export_path"
- t.date "start_date", :null => false
- t.date "end_date", :null => false
+ t.date "start_date", :null => false
+ t.date "end_date", :null => false
t.integer "venue_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.date "registration_start_date"
t.date "registration_end_date"
t.string "logo_file_name"
t.string "logo_content_type"
t.integer "logo_file_size"
t.datetime "logo_updated_at"
+ t.boolean "use_dietary_choices", :default => false
+ t.boolean "use_supporter_levels", :default => false
+ end
+
+ create_table "dietary_choices", :force => true do |t|
+ t.integer "conference_id"
+ t.string "title", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "email_settings", :force => true do |t|
@@ -164,6 +173,9 @@ ActiveRecord::Schema.define(:version => 20130131100257) do
t.text "additional_speakers"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
+ t.integer "dietary_choice_id"
+ t.text "other_dietary_choice"
+ t.boolean "handicapped_access_required", :default => false
end
create_table "roles", :force => true do |t|
@@ -185,6 +197,20 @@ ActiveRecord::Schema.define(:version => 20130131100257) do
t.boolean "public", :default => true
end
+ create_table "supporter_levels", :force => true do |t|
+ t.integer "conference_id"
+ t.string "title", :null => false
+ t.string "url"
+ end
+
+ create_table "supporter_registrations", :force => true do |t|
+ t.integer "registration_id"
+ t.integer "supporter_level_id"
+ t.string "email"
+ t.string "code"
+ t.boolean "code_is_valid", :default => false
+ end
+
create_table "tracks", :force => true do |t|
t.string "guid", :null => false
t.integer "conference_id"