VRFS-867 bug fixes

This commit is contained in:
Brian Smith 2013-12-01 18:16:33 -05:00
parent 3e1e05e378
commit cc4f2512bd
2 changed files with 15 additions and 8 deletions

View File

@ -19,7 +19,7 @@
var userPhotoUrls = [];
var selectedFriendIds = {};
var nilOptionText = 'n/a';
var bandId;
var bandId = '';
function resetForm() {
@ -37,12 +37,14 @@
$tdCountry.removeClass("error");
// region
$("#band-region").empty();
$("#band-region").val('');
var $tdRegion = $("#tdBandRegion");
$tdRegion.find('.error-text').remove();
$tdRegion.removeClass("error");
// city
$("#band-city").empty();
$("#band-city").val('');
var $tdCity = $("#tdBandCity");
$tdCity.find('.error-text').remove();
@ -57,6 +59,9 @@
resetGenres();
$("#hdn-band-id").val('');
$("#band-setup-step-1").show();
$("#band-setup-step-2").hide();
}
function resetGenres() {
@ -175,11 +180,11 @@
band.website = $("#band-website").val();
band.biography = $("#band-biography").val();
band.city = $("#band-city").val();
band.state = $("#band-state").val();
band.state = $("#band-region").val();
band.country = $("#band-country").val();
band.genres = getSelectedGenres();
if (!bandId) {
if (bandId.length === 0) {
rest.createBand(band).done(function(response) {
createBandInvitations(response.id, function() {
context.location = "#/bandProfile/" + response.id;
@ -187,9 +192,10 @@
});
}
else {
band.id = bandId;
rest.updateBand(band, bandId).done(function(response) {
createBandInvitations(response.id, function() {
context.location = "#/bandProfile/" + response.id;
createBandInvitations(band.id, function() {
context.location = "#/bandProfile/" + band.id;
});
});
}
@ -231,7 +237,7 @@
friendSelectorDialog.setCallback(friendSelectorCallback);
loadFriends();
if (bandId) {
if (bandId.length > 0) {
$("#band-setup-title").html("edit band");
$("#btn-band-setup-save").html("SAVE CHANGES");
@ -288,7 +294,7 @@
}
function loadGenres(selectedGenres) {
$("band-genres").empty();
$("#band-genres").empty();
rest.getGenres().done(function(genres) {
$.each(genres, function(index, genre) {
@ -453,7 +459,7 @@
$("#band-setup-step-2").hide();
});
$('#btn-band-setup-create').click(saveBand);
$('#btn-band-setup-save').click(saveBand);
$('#btn-band-choose-friends').click(function() {
friendSelectorDialog.showDialog(selectedFriendIds);

View File

@ -66,6 +66,7 @@
}
function updateBand(band, bandId) {
logger.debug("bandId=" + bandId);
return $.ajax({
type: "POST",
dataType: "json",