Big refactoring of registration

- Added datatable gem
- Addaed datatable to events, users (#422), registrations
This commit is contained in:
Chrisbr 2014-08-22 15:08:54 +02:00
parent 0f1051d24e
commit d21e19b977
34 changed files with 435 additions and 12988 deletions

View 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' }

View file

@ -0,0 +1,10 @@
- @conference.questions.each do |q|
%h5
= "Q: #{q.title}"
- 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}

View 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');

View file

@ -0,0 +1,15 @@
.row
.col-md-12
= 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|
= render :partial => 'devise/registrations/volunteeruser', :locals => {:u => u}
%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:"