let caller decide what to display if no genres are found

This commit is contained in:
Brian Smith 2015-03-03 21:29:10 -05:00
parent 5f2b0b9745
commit aba65a82bd
2 changed files with 13 additions and 8 deletions

View File

@ -408,7 +408,6 @@
function hideElements(elements) {
$.each(elements, function(index, val) {
console.log('hiding ' + val.id);
val.hide();
});
}
@ -520,7 +519,7 @@
// genres
$genres.empty();
var profileGenres = profileUtils.profileGenreList(user.genres);
$genres.append(profileGenres);
$genres.append(profileGenres.length > 0 ? profileGenres : NOT_SPECIFIED_TEXT);
// concert gigs
var concertGigCount = user.concert_count;
@ -680,7 +679,8 @@
if (user.paid_sessions) {
$paidGigSection.show();
$paidGigDetails.find("ul li:nth-child(1)").append(profileUtils.paidSessionGenreList(user.genres));
var genreList = profileUtils.paidSessionGenreList(user.genres);
$paidGigDetails.find("ul li:nth-child(1)").append(genreList.length > 0 ? genreList : NOT_SPECIFIED_TEXT);
var hourlyRate = user.paid_sessions_hourly_rate;
$paidGigDetails.find("ul li:nth-child(2)").append(hourlyRate ? hourlyRate : NOT_SPECIFIED_TEXT);
@ -695,7 +695,9 @@
// free sessions
if (user.free_sessions) {
$freeGigSection.show();
$freeGigDetails.find("ul li:nth-child(1)").append(profileUtils.freeSessionGenreList(user.genres));
var genreList = profileUtils.freeSessionGenreList(user.genres);
$freeGigDetails.find("ul li:nth-child(1)").append(genreList.length > 0 ? genreList : NOT_SPECIFIED_TEXT);
}
else {
$freeGigSection.hide();
@ -705,7 +707,8 @@
if (user.cowriting) {
$cowritingSection.show();
$cowritingDetails.find("ul li:nth-child(1)").append(profileUtils.cowritingGenreList(user.genres));
var genreList = profileUtils.cowritingGenreList(user.genres);
$cowritingDetails.find("ul li:nth-child(1)").append(genreList.length > 0 ? genreList : NOT_SPECIFIED_TEXT);
var purpose = user.cowriting_purpose;
$cowritingDetails.find("ul li:nth-child(2)").append(purpose ? profileUtils.cowritingPurposeMap[purpose] : NOT_SPECIFIED_TEXT);
@ -718,7 +721,8 @@
if (user.traditional_band) {
$traditionalBandSection.show();
$traditionalBandDetails.find("ul li:nth-child(1)").append(profileUtils.traditionalBandGenreList(user.genres));
var genreList = profileUtils.traditionalBandGenreList(user.genres);
$traditionalBandDetails.find("ul li:nth-child(1)").append(genreList.length > 0 ? genreList : NOT_SPECIFIED_TEXT);
var commitment = user.traditional_band_commitment;
$traditionalBandDetails.find("ul li:nth-child(2)").append(commitment ? profileUtils.bandCommitmentMap[commitment] : NOT_SPECIFIED_TEXT);
@ -735,7 +739,8 @@
if (user.virtual_band) {
$virtualBandSection.show();
$virtualBandDetails.find("ul li:nth-child(1)").append(profileUtils.virtualBandGenreList(user.genres));
var genreList = profileUtils.virtualBandGenreList(user.genres);
$virtualBandDetails.find("ul li:nth-child(1)").append(genreList.length > 0 ? genreList : NOT_SPECIFIED_TEXT);
var commitment = user.virtual_band_commitment;
$virtualBandDetails.find("ul li:nth-child(2)").append(commitment ? profileUtils.bandCommitmentMap[commitment] : NOT_SPECIFIED_TEXT);

View File

@ -71,7 +71,7 @@
}
}
return list.length > 0 ? list : 'None specified';
return list.length > 0;
}
// profile genres