mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Adding more registration options, and starting work on supporter levels
This commit is contained in:
parent
61a02d17a3
commit
973913b3bf
25 changed files with 228 additions and 20 deletions
17
app/controllers/admin/dietchoices_controller.rb
Normal file
17
app/controllers/admin/dietchoices_controller.rb
Normal file
|
|
@ -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
|
||||
17
app/controllers/admin/supporter_levels_controller.rb
Normal file
17
app/controllers/admin/supporter_levels_controller.rb
Normal file
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
7
app/models/dietary_choice.rb
Normal file
7
app/models/dietary_choice.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
class DietaryChoice < ActiveRecord::Base
|
||||
attr_accessible :title
|
||||
|
||||
belongs_to :conference
|
||||
has_many :registrations
|
||||
|
||||
end
|
||||
|
|
@ -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
|
||||
6
app/models/supporter_level.rb
Normal file
6
app/models/supporter_level.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
class SupporterLevel < ActiveRecord::Base
|
||||
belongs_to :conference
|
||||
has_many :supporter_registrations
|
||||
|
||||
attr_accessible :conference, :title, :url
|
||||
end
|
||||
6
app/models/supporter_registration.rb
Normal file
6
app/models/supporter_registration.rb
Normal file
|
|
@ -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
|
||||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
<div class="nested-fields">
|
||||
<%= f.inputs do %>
|
||||
<%= f.input :title %>
|
||||
<%= remove_association_link :dietary_choice, f %>
|
||||
<% end %>
|
||||
</div>
|
||||
9
app/views/admin/dietchoices/diets_list.html.haml
Normal file
9
app/views/admin/dietchoices/diets_list.html.haml
Normal file
|
|
@ -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"}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<div class="nested-fields">
|
||||
<%= f.inputs do %>
|
||||
<%= f.input :title%>
|
||||
<%= f.input :url %>
|
||||
<%= remove_association_link :supporter_level, f %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
@ -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"}
|
||||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
class AddDietaryChoiceToConferences < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :conferences, :use_dietary_choices, :boolean, :default => false
|
||||
end
|
||||
end
|
||||
13
db/migrate/20130202091051_create_dietary_choices_table.rb
Normal file
13
db/migrate/20130202091051_create_dietary_choices_table.rb
Normal file
|
|
@ -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
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddDietaryChoiceToRegistration < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :registrations, :dietary_choice_id, :integer
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddDietaryTextToRegistration < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :registrations, :other_dietary_choice, :text
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddHandicappedAccessToRegistrations < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :registrations, :handicapped_access_required, :boolean, :default => false
|
||||
end
|
||||
end
|
||||
13
db/migrate/20130202130737_create_supporter_level_table.rb
Normal file
13
db/migrate/20130202130737_create_supporter_level_table.rb
Normal file
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddUseSupporterLevelsToConferences < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :conferences, :use_supporter_levels, :boolean, :default => false
|
||||
end
|
||||
end
|
||||
46
db/schema.rb
46
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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue