Bike!Bike! Website!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

45 lines
1.6 KiB

.columns{:class => @host_privledges ? 'medium-8' : 'medium-12'}
= f.fields_for @user do |u|
.columns#step-1.registration-step= u.email_field :email
%button#submit-email.next=_'form.Next'
= f.fields_for @user do |u|
.columns#step-2.registration-step= u.text_field :username
-# .columns.medium-6
= select_tag :is_attending, options_for_select(ConferenceRegistration::AttendingOptions, @conference_registration.try(:is_attending)), :label => true
%ol
- @conference.registration_form_fields.each do |ff|
%li
- response = @conference_registration ? ConferenceRegistrationResponse.find_by(conference_registration_id: @conference_registration.id, registration_form_field_id: ff.id) : nil
= form_field ff, response
= f.actions :register
- content_for :scripts do
:plain
function updateForm(data, step) {
$('.registration-step').each(function() {
var $this = $(this);
var this_step = parseInt($this.attr('id').replace(/^step\-(\d+)$/, '$1'));
if (this_step > step) {
$this.find('input,select').each(function(){
var $input = $(this);
var params = $input.attr('name').match(/\[(.*?)\]/g);
var val = data.conference;
for (key in params) {
var k = params[key].replace(/\[(.*)\]/, '$1');
val = val[params[key].replace(/\[(.*)\]/, '$1')];
}
$input.val(val)
});
}
});
}
- dom_ready do
:plain
$('#submit-email').click(function(e){
e.preventDefault();
$.post('register/step/1', $('form.edit_conference').serialize(), function(data) {
//console.log(data.conference.user.username);
updateForm(data, 1);
});
});