VRFS-3243 : Ability to selectively skip genre validation

This commit is contained in:
Steven Miers 2015-05-19 13:32:15 -05:00
parent 826022d414
commit f16bd28574
2 changed files with 15 additions and 5 deletions

View File

@ -9,7 +9,7 @@ module JamRuby
:band_type, :band_status, :concert_count, :add_new_members, :play_commitment, :touring_option, :paid_gigs,
:free_gigs, :hourly_rate, :gig_minimum
attr_accessor :updating_photo, :skip_location_validation
attr_accessor :updating_photo, :skip_location_validation, :skip_genre_validation
self.primary_key = 'id'
@ -21,7 +21,7 @@ module JamRuby
validates :city, presence: true, :unless => :skip_location_validation
validate :validate_photo_info
validate :require_at_least_one_genre
validate :require_at_least_one_genre, :unless => :skip_genre_validation
validate :limit_max_genres
before_save :check_lat_lng
@ -199,7 +199,8 @@ module JamRuby
band.genres = genres
end
band.skip_genre_validation = true unless params[:validate_genres]
puts "SKIPPING GENRE VALIDATION: #{band.skip_genre_validation}"
band
end

View File

@ -22,6 +22,8 @@
var nilOptionText = 'n/a';
var bandId = '';
var friendInput=null;
// TODO: Use a single variable for a mutually exclusive option:
var step1, step2;
var isSaving = false;
@ -123,7 +125,13 @@
band.city = $("#band-city").val();
band.state = $("#band-region").val();
band.country = $("#band-country").val();
band.genres = getSelectedGenres();
if (step2) {
band.genres = getSelectedGenres();
band.validate_genres = true
} else {
band.validate_genres = false
}
return band;
}
@ -240,7 +248,6 @@
$("#band-setup-title").html("edit band");
$("#btn-band-setup-save").html("SAVE CHANGES");
$("#band-change-photo").html('Upload band photo.');
//$("#name_row").after($("#tdBandPhoto"));
$('.band-photo').removeClass("hidden")
// retrieve and initialize band profile data points
@ -472,6 +479,8 @@
$("#band-setup-step-1").hide();
} else if (step1) {
saveBand();
step1=false
step2=true
}
})
.fail(function (jqXHR) {