New look
This commit is contained in:
@@ -1,8 +1,45 @@
|
||||
.columns.medium-8
|
||||
= select_tag :is_attending, ConferenceRegistration::AttendingOptions, label: 'Are you attending?', value: @conference_registration.try(:is_attending)
|
||||
.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
|
||||
= form_actions :register
|
||||
= 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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user