VRFS-3332 : Band setup : validate genres only when on the correct step AND the next button is used.

This commit is contained in:
Steven Miers 2015-07-15 20:05:24 -05:00
parent f389f07b52
commit bbcfd3336e
1 changed files with 15 additions and 14 deletions

View File

@ -42,8 +42,9 @@
accountProfileSamples.initialize()
function navBack() {
var band = buildBand()
if (currentStep>0) {
saveBand(function() {
saveBand(band, function() {
currentStep--
renderCurrentPage()
})
@ -57,13 +58,21 @@
}
function navNext() {
var band = buildBand()
if (currentStep==GENRE_STEP) {
band.genres = getSelectedGenres();
band.validate_genres = true
} else {
band.validate_genres = false
}
if (currentStep<STEPS_COUNT-1) {
saveBand(function(band) {
saveBand(band, function(band) {
currentStep++
renderCurrentPage()
})
} else {
saveBand(function(band) {
saveBand(band, function(band) {
resetForm()
showProfile(band.id);
})
@ -227,20 +236,13 @@
if ($screen.find("#play-commitment").length == 0) {
logger.error("MISSING PLAY MOTIMMENT")
logger.error("MISSING PLAY COMMITMENT")
}
band.play_commitment = $screen.find("#play-commitment").val()
band.hourly_rate = profileUtils.normalizeMoneyForSubmit($screen.find("#hourly-rate").val())
band.gig_minimum = profileUtils.normalizeMoneyForSubmit($("#gig-minimum").val())
if (currentStep==GENRE_STEP) {
band.genres = getSelectedGenres();
band.validate_genres = true
} else {
band.validate_genres = false
}
$.each($selectedInstruments, function(index, instrument) {
var h = {}
h.instrument_id = instrument.id
@ -302,11 +304,10 @@
}
}
function saveBand(saveBandSuccessFn) {
function saveBand(band, saveBandSuccessFn) {
unbindNavButtons()
removeErrors()
var band = buildBand()
removeErrors()
var saveBandFn = (isNewBand()) ? rest.createBand : rest.updateBand
saveBandFn(band)