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

Conflicts:
	app/controllers/admin/registrations_controller.rb
	app/models/registration.rb
This commit is contained in:
Ancor Gonzalez Sosa 2013-07-16 15:59:00 +02:00
commit 243f33ff91
8 changed files with 217 additions and 90 deletions

View file

@ -2,24 +2,71 @@
.row-fluid
.span12
%h3
Edit registration of #{@person.public_name} for #{@conference.title}
Edit registration of #{@person.public_name} (#{@person.email}) for #{@conference.title}
%br
.row-fluid
.span12
= semantic_form_for(@registration, :url => admin_conference_registrations_edit_path(@conference.short_title, @registration.id), :html => { :method => :put }) do |f|
.span6
= f.inputs :name => "Personal Data" do
= f.fields_for :person do |p|
= p.label :first_name
= p.text_field :first_name
= p.label :last_name
= p.text_field :last_name
= p.label :email
= p.text_field :email
= p.label :affiliation
= p.text_field :company
= p.label :Nickname
= p.text_field :irc_nickname
= render :partial => 'shared/conference_registration', :locals => { :f => f }
= f.inputs "Personal Information" do
= f.fields_for :person do |p|
= p.input :first_name, :as => :string
= p.input :last_name, :as => :string
= p.label :Nickname, :as => :string
= p.text_field :irc_nickname, :as => :string
= p.label :Affiliation
= p.text_field :company, :placeholder => "Company/User Group/nothing", :as => :string
= f.inputs "Registration Information" do
- 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 @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
- 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", :class => "span6"}, :label => "Other Dietary Restictions (please describe)"
= f.action :submit, :button_html => { :value => "Edit Registration", :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,74 @@
.row
.span12
%h3
Create new account and registration
.row
.span12
= semantic_form_for(@registration, :url => admin_conference_registrations_new_path(@conference.short_title), :html => { :method => :put }) 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."
= f.fields_for @person do |p|
= p.input :first_name, :as => :string
= p.input :last_name, :as => :string
= p.input :public_name, :as => :string
= p.label :Nickname
= p.text_field :irc_nickname, :as => :string
= p.label :Affiliation
= p.text_field :company, :placeholder => "Company/User Group/nothing", :as => :string
= f.inputs "Registration Information" do
- 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 @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
- 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", :class => "span6"}, :label => "Other Dietary Restictions (please describe)"
= 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)
}
});

View file

@ -1,7 +1,7 @@
.row-fluid
.span12
.pull-right{:style=>"margin-top:20px; margin-bottom:20px;"}
= link_to "New", admin_users_new_path(@conference.short_title), :class => "btn btn-primary"
= link_to "New", admin_conference_registrations_new_path(@conference.short_title), :class => "btn btn-primary"
= link_to "Export PDF", admin_conference_registrations_path(@conference.short_title, :format => :pdf), :class => "btn btn-success"
= link_to "Export xlsx", {:format => :xlsx}, :class => "btn btn-success"
.row-fluid
@ -29,12 +29,20 @@
- @headers.each do |field|
%td
- if field == "name"
#{registration.last_name} #{registration.first_name} (#{registration.public_name})
#{registration.last_name} #{registration.first_name} (#{registration.nickname}) #{registration.affiliation}
- if registration.supporter_level && registration.supporter_level.title != 'Free'
%p{:style => "color:red"}
= registration.supporter_level.title
-elsif field == 'attended'
= link_to "#{registration.send(field.to_sym)}", admin_conference_registrations_change_field_path(@conference.short_title, :id => registration.id, :view_field => "#{field}"), :method => :put, ":#{field}" => registration.send(field.to_sym), :class => "btn btn-success"
-elsif (registration.send(field.to_sym).class == TrueClass || registration.send(field.to_sym).class == FalseClass)
= link_to "#{registration.send(field.to_sym)}", admin_conference_registrations_change_field_path(@conference.short_title, :id => registration.id, :view_field => "#{field}"), :method => :put, ":#{field}" => registration.send(field.to_sym)
- elsif field == 'arrival' || field == 'departure'
= registration.send(field.to_sym).strftime("%d %b %H:%M") if registration.send(field.to_sym)
- else
= registration.send(field.to_sym)
%td

View file

@ -1,20 +0,0 @@
.row
.span12
%h3
Create new account and registration
.row
.span12
= semantic_form_for(@user, :url => admin_users_new_path(:id => @conference.short_title), :html => { :method => :put }) do |f|
= f.inputs "Account Information" do
= f.input :email
= f.input :password, :hint => "Password must be at least 6 characters"
= f.inputs "Personal Information" do
= f.fields_for :people do |p|
= p.input :first_name
= p.input :last_name
= p.label :Nickname
= p.text_field :irc_nickname
= p.label :Affiliation
= p.text_field :company, :placeholder => "Company/User Group/nothing"
= f.input :conferences, :as => :check_boxes, :label => true, :collection => @conferences
= f.action :submit, :button_html => { :value => "Create", :class => "btn btn-primary"}