VRFS-3245 : Serialize additional attributes.

This commit is contained in:
Steven Miers 2015-05-28 14:21:55 -05:00
parent 9d59e53679
commit 8d73ef6aac
3 changed files with 58 additions and 20 deletions

View File

@ -24,11 +24,7 @@
var friendInput=null;
var bandType=null;
var bandStatus=null;
var concertCount=null;
// TODO: Use a single variable for a mutually exclusive option:
var step1, step2;
var isSaving = false;
var concertCount=null;
var currentStep = 0;
var STEPS_COUNT=5;
@ -73,7 +69,7 @@
} else {
$("#btn-band-setup-back").removeClass("hidden")
$("#btn-band-setup-next").removeClass("hidden").html("SAVE & FINISH")
}
}
}
function is_new_record() {
@ -111,6 +107,15 @@
// website
$('#band-website').val('');
$("#new-member-no").iCheck('check').attr('checked', 'checked')
$("#paid-gigs-no").iCheck('check').attr('checked', 'checked')
$("#free-gigs-no").iCheck('check').attr('checked', 'checked')
$('#touring-option').val('no')
$("#play-commitment").val('1')
$("#hourly-rate").val("0.0")
$("#gig-minimum").val("0.0")
resetGenres();
//renderCurrentPage();$(".band-step").addClass("hidden")
@ -178,7 +183,16 @@
band.band_status= bandStatus.val();
band.concert_count= concertCount.val();
if (step2) {
band.add_new_members = $('input[name="add_new_members"]:checked').val()=="yes"
band.paid_gigs = $('input[name="paid_gigs"]:checked').val()=="yes"
band.free_gigs=$('input[name="free_gigs"]:checked').val()=="yes"
band.touring_option=$('#touring-option').val()=="yes"
band.play_commitment=$("#play-commitment").val()
band.hourly_rate=$("#hourly-rate").val()
band.gig_minimum=$("#gig-minimum").val()
if (currentStep==3) {
band.genres = getSelectedGenres();
band.validate_genres = true
} else {
@ -295,7 +309,30 @@
bandType.val(band.band_type)
bandStatus.val(band.band_status)
concertCount.val(band.concert_count)
if (band.add_new_members){
$("#new-member-no").iCheck('check').attr('checked', 'checked')
} else {
$("#new-member-yes").iCheck('check').attr('checked', 'checked')
}
if (band.paid_gigs) {
$("#paid-gigs-no").iCheck('check').attr('checked', 'checked')
} else {
$("#paid-gigs-yes").iCheck('check').attr('checked', 'checked')
}
if (band.free_gigs) {
$("#free-gigs-no").iCheck('check').attr('checked', 'checked')
} else {
$("#free-gigs-yes").iCheck('check').attr('checked', 'checked')
}
$('#touring-option').val(band.touring_option ? 'yes' : 'no')
$("#play-commitment").val(band.play_commitment)
$("#hourly-rate").val(band.hourly_rate)
$("#gig-minimum").val(band.gig_minimum)
// Initialize avatar
if (band.photo_url) {
$("#band-avatar").attr('src', band.photo_url);
}
@ -307,8 +344,8 @@
loadCities(band.city);
});
});
;
// TODO: initialize avatar
});
}
@ -448,8 +485,7 @@
$('#selected-band-invitees').append(invitationHtml);
$('#band-invitee-input').select();
selectedFriendIds[data] = true;
}
else {
} else {
$('#band-invitee-input').select();
context.alert('Invitation already exists for this musician.');
}
@ -536,7 +572,7 @@
$('div[layout-id="band/setup"] .btn-facebook-invitation').click(function () {
invitationDialog.showFacebookDialog();
});
$(friendInput).focus(function() { $(this).val(''); })
}

View File

@ -1,7 +1,9 @@
object @band
attributes :id, :name, :city, :state, :country, :location, :website, :biography, :photo_url, :logo_url, :liker_count, :follower_count, :recording_count, :session_count,
:original_fpfile_photo, :cropped_fpfile_photo, :crop_selection_photo
:original_fpfile_photo, :cropped_fpfile_photo, :crop_selection_photo,
:band_type, :band_status, :concert_count, :add_new_members, :play_commitment, :touring_option, :paid_gigs,
:free_gigs, :hourly_rate, :gig_minimum
child :users => :musicians do
attributes :id, :first_name, :last_name, :name, :photo_url

View File

@ -117,10 +117,10 @@
tr
td
.radio-field
input#new-member-yes.iradio-inline type="radio" name="new-member" value='true'
input#new-member-yes.iradio-inline type="radio" name="add_new_members" value='yes'
label for='new-member-yes' Yes
.radio-field
input#new-member-no.iradio-inline type="radio" name="new-member" value='false'
input#new-member-no.iradio-inline type="radio" name="add_new_members" value='no'
label for='new-member-no' No
td
#desired-experience-label None specified
@ -132,8 +132,8 @@
option value="4" 4+ Times Per Week
td
select#touring-option.easydropdown name="touring_option"
option value="true" Yes
option value="false" No
option value="yes" Yes
option value="no" No
tr
td
label.strong-label for="paid-gigs"
@ -146,10 +146,10 @@
tr
td
.radio-field
input#paid-gigs-yes.iradio-inline type="radio" name="paid_gigs" value='true'
input#paid-gigs-yes.iradio-inline type="radio" name="paid_gigs" value='yes'
label for="paid-gigs-yes" Yes
.radio-field
input#paid-gigs-no.iradio-inline type="radio" name="paid_gigs" value='false'
input#paid-gigs-no.iradio-inline type="radio" name="paid_gigs" value='no'
label for="paid-gigs-no" No
td
input#hourly-rate type="number" name="hourly_rate"
@ -163,10 +163,10 @@
tr
td
.radio-field
input#free-gigs-yes.iradio-inline type="radio" name="free-gigs" value='true'
input#free-gigs-yes.iradio-inline type="radio" name="free_gigs" value='yes'
label for="free-gigs-yes" Yes
.radio-field
input#free-gigs-no.iradio-inline type="radio" name="free-gigs" value='false'
input#free-gigs-no.iradio-inline type="radio" name="free_gigs" value='no'
label for="free-gigs-no" No
#band-setup-step-3.band-step.content-wrapper