VRFS-2701 edit current interests working
This commit is contained in:
parent
4a8dd75fa2
commit
c0dcbcce75
|
|
@ -9,7 +9,6 @@
|
|||
var EVENTS = context.JK.EVENTS;
|
||||
var api = context.JK.Rest();
|
||||
var ui = new context.JK.UIHelper(JK.app);
|
||||
var userId;
|
||||
var user = {};
|
||||
var profileUtils = context.JK.ProfileUtils;
|
||||
var masterGenreList = [];
|
||||
|
|
@ -23,37 +22,51 @@
|
|||
var GENRE_LIST_SELECTOR = '.genre-list';
|
||||
|
||||
// virtual bands
|
||||
var $virtualBandYes = $screen.find('#virtual-band-yes');
|
||||
var $virtualBandNo = $screen.find('#virtual-band-no');
|
||||
var $virtualBandGenres = $screen.find('#virtual-band-genres');
|
||||
var $btnVirtualBandGenreSelect = $virtualBandGenres.find(SELECT_GENRE_SELECTOR);
|
||||
var $virtualBandGenreList = $virtualBandGenres.find(GENRE_LIST_SELECTOR);
|
||||
var $virtualBandCommitment = $screen.find('#virtual-band-commitment');
|
||||
|
||||
// traditional bands
|
||||
var $traditionalBandYes = $screen.find('#traditional-band-yes');
|
||||
var $traditionalBandNo = $screen.find('#traditional-band-no');
|
||||
var $traditionalBandGenres = $screen.find('#traditional-band-genres');
|
||||
var $btnTraditionalBandGenreSelect = $traditionalBandGenres.find(SELECT_GENRE_SELECTOR);
|
||||
var $traditionalBandGenreList = $traditionalBandGenres.find(GENRE_LIST_SELECTOR);
|
||||
var $traditionalBandCommitment = $screen.find('#traditional-band-commitment');
|
||||
var $traditionalTouringOption = $screen.find('#traditional-band-touring');
|
||||
|
||||
// paid sessions
|
||||
var $paidSessionsYes = $screen.find('#paid-sessions-yes');
|
||||
var $paidSessionsNo = $screen.find('#paid-sessions-no');
|
||||
var $paidSessionsGenres = $screen.find('#paid-sessions-genres');
|
||||
var $btnPaidSessionsGenreSelect = $paidSessionsGenres.find(SELECT_GENRE_SELECTOR);
|
||||
var $paidSessionsGenreList = $paidSessionsGenres.find(GENRE_LIST_SELECTOR);
|
||||
var $hourlyRate = $screen.find('#hourly-rate');
|
||||
var $dailyRate = $screen.find('#daily-rate');
|
||||
|
||||
// free sessions
|
||||
var $freeSessionsYes = $screen.find('#free-sessions-yes');
|
||||
var $freeSessionsNo = $screen.find('#free-sessions-no');
|
||||
var $freeSessionsGenres = $screen.find('#free-sessions-genres');
|
||||
var $btnFreeSessionsGenreSelect = $freeSessionsGenres.find(SELECT_GENRE_SELECTOR);
|
||||
var $freeSessionsGenreList = $freeSessionsGenres.find(GENRE_LIST_SELECTOR);
|
||||
|
||||
// cowriting
|
||||
var $cowritingYes = $screen.find('#cowriting-yes');
|
||||
var $cowritingNo = $screen.find('#cowriting-no');
|
||||
var $cowritingGenres = $screen.find('#cowriting-genres');
|
||||
var $btnCowritingGenreSelect = $cowritingGenres.find(SELECT_GENRE_SELECTOR);
|
||||
var $cowritingGenreList = $cowritingGenres.find(GENRE_LIST_SELECTOR);
|
||||
var $cowritingPurpose = $screen.find('#cowriting-purpose');
|
||||
|
||||
var $scroller = $screen.find('#account-profile-content-scroller');
|
||||
var $btnCancel = $scroller.find('#account-edit-profile-cancel');
|
||||
var $btnBack = $scroller.find('#account-edit-profile-back');
|
||||
var $btnSubmit = $scroller.find('#account-edit-profile-submit');
|
||||
var $btnCancel = $screen.find('#account-edit-profile-cancel');
|
||||
var $btnBack = $screen.find('#account-edit-profile-back');
|
||||
var $btnSubmit = $screen.find('#account-edit-profile-submit');
|
||||
|
||||
function beforeShow(data) {
|
||||
userId = data.id;
|
||||
}
|
||||
|
||||
function afterShow(data) {
|
||||
|
|
@ -61,14 +74,74 @@
|
|||
}
|
||||
|
||||
function resetForm() {
|
||||
$scroller.find('form .error-text').remove();
|
||||
$scroller.find('form .error').removeClass("error");
|
||||
$screen.find('form .error-text').remove();
|
||||
$screen.find('form .error').removeClass("error");
|
||||
}
|
||||
|
||||
function populateAccountProfile(userDetail) {
|
||||
|
||||
// Column 1 - options
|
||||
if (userDetail) {
|
||||
|
||||
context.JK.dropdown($('select', $scroller));
|
||||
if (userDetail.virtual_band) {
|
||||
$virtualBandYes.iCheck('check').attr('checked', 'checked');
|
||||
}
|
||||
else {
|
||||
$virtualBandNo.iCheck('check').attr('checked', 'checked');
|
||||
}
|
||||
|
||||
if (userDetail.traditional_band) {
|
||||
$traditionalBandYes.iCheck('check').attr('checked', 'checked');
|
||||
}
|
||||
else {
|
||||
$traditionalBandNo.iCheck('check').attr('checked', 'checked');
|
||||
}
|
||||
|
||||
if (userDetail.paid_sessions) {
|
||||
$paidSessionsYes.iCheck('check').attr('checked', 'checked');
|
||||
}
|
||||
else {
|
||||
$paidSessionsNo.iCheck('check').attr('checked', 'checked');
|
||||
}
|
||||
|
||||
if (userDetail.free_sessions) {
|
||||
$freeSessionsYes.iCheck('check').attr('checked', 'checked');
|
||||
}
|
||||
else {
|
||||
$freeSessionsNo.iCheck('check').attr('checked', 'checked');
|
||||
}
|
||||
|
||||
if (userDetail.cowriting) {
|
||||
$cowritingYes.iCheck('check').attr('checked', 'checked');
|
||||
}
|
||||
else {
|
||||
$cowritingNo.iCheck('check').attr('checked', 'checked');
|
||||
}
|
||||
}
|
||||
|
||||
// Column 2 - genres
|
||||
var genres = profileUtils.virtualBandGenreList(userDetail.genres);
|
||||
$virtualBandGenreList.html(genres && genres.length > 0 ? genres : NONE_SPECIFIED);
|
||||
|
||||
genres = profileUtils.traditionalBandGenreList(userDetail.genres);
|
||||
$traditionalBandGenreList.html(genres && genres.length > 0 ? genres : NONE_SPECIFIED);
|
||||
|
||||
genres = profileUtils.paidSessionGenreList(userDetail.genres);
|
||||
$paidSessionsGenreList.html(genres && genres.length > 0 ? genres : NONE_SPECIFIED);
|
||||
|
||||
genres = profileUtils.freeSessionGenreList(userDetail.genres);
|
||||
$freeSessionsGenreList.html(genres && genres.length > 0 ? genres : NONE_SPECIFIED);
|
||||
|
||||
genres = profileUtils.cowritingGenreList(userDetail.genres);
|
||||
$cowritingGenreList.html(genres && genres.length > 0 ? genres : NONE_SPECIFIED);
|
||||
|
||||
// Column 3 - misc (play commitment, rates, cowriting purpose)
|
||||
$virtualBandCommitment.val(userDetail.virtual_band_commitment);
|
||||
$traditionalBandCommitment.val(userDetail.traditional_band_commitment);
|
||||
$traditionalTouringOption.val(userDetail.traditional_band_touring ? '1' : '0');
|
||||
$hourlyRate.val(userDetail.paid_sessions_hourly_rate);
|
||||
$dailyRate.val(userDetail.paid_sessions_daily_rate);
|
||||
$cowritingPurpose.val(userDetail.cowriting_purpose);
|
||||
}
|
||||
|
||||
function bindGenreSelector($btnSelect, $genreList) {
|
||||
|
|
@ -97,16 +170,15 @@
|
|||
$btnCancel.on('click', function(evt) { evt.stopPropagation(); navigateTo('/client#/account'); return false; } );
|
||||
$btnBack.on('click', function(evt) { evt.stopPropagation(); navigateTo('/client#/account/profile/experience'); return false; } );
|
||||
$btnSubmit.on('click', function(evt) { evt.stopPropagation(); handleUpdateProfile(); return false; } );
|
||||
|
||||
context.JK.dropdown($('select', $screen));
|
||||
}
|
||||
|
||||
function renderInterests() {
|
||||
$.when(api.getUserProfile())
|
||||
.done(function(userDetailResponse) {
|
||||
var userDetail = userDetailResponse[0];
|
||||
.done(function(userDetail) {
|
||||
populateAccountProfile(userDetail);
|
||||
});
|
||||
|
||||
context.JK.dropdown($('select'));
|
||||
}
|
||||
|
||||
function navigateTo(targetLocation) {
|
||||
|
|
@ -117,11 +189,26 @@
|
|||
resetForm();
|
||||
|
||||
api.updateUser({
|
||||
instruments: instruments,
|
||||
genres: genres,
|
||||
skill_level: $scroller.find('select[name=skill_level]').val(),
|
||||
concert_count: $scroller.find('select[name=concert_count]').val(),
|
||||
studio_session_count: $scroller.find('select[name=studio_session_count]').val()
|
||||
virtual_band: $screen.find('input[name=virtual_band]:checked').val(),
|
||||
virtual_band_genres: $virtualBandGenreList.html() === NONE_SPECIFIED ? [] : $virtualBandGenreList.html().split(GENRE_LIST_DELIMITER),
|
||||
virtual_band_commitment: $virtualBandCommitment.val(),
|
||||
|
||||
traditional_band: $screen.find('input[name=traditional_band]:checked').val(),
|
||||
traditional_band_genres: $traditionalBandGenreList.html() === NONE_SPECIFIED ? [] : $traditionalBandGenreList.html().split(GENRE_LIST_DELIMITER),
|
||||
traditional_band_commitment: $traditionalBandCommitment.val(),
|
||||
traditional_band_touring: $traditionalTouringOption.val(),
|
||||
|
||||
paid_sessions: $screen.find('input[name=paid_sessions]:checked').val(),
|
||||
paid_session_genres: $paidSessionsGenreList.html() === NONE_SPECIFIED ? [] : $paidSessionsGenreList.html().split(GENRE_LIST_DELIMITER),
|
||||
paid_sessions_hourly_rate: $hourlyRate.val(),
|
||||
paid_sessions_daily_rate: $dailyRate.val(),
|
||||
|
||||
free_sessions: $screen.find('input[name=free_sessions]:checked').val(),
|
||||
free_session_genre: $freeSessionsGenreList.html() === NONE_SPECIFIED ? [] : $freeSessionsGenreList.html().split(GENRE_LIST_DELIMITER),
|
||||
|
||||
cowriting: $screen.find('input[name=cowriting]:checked').val(),
|
||||
cowriting_genres: $cowritingGenreList.html() === NONE_SPECIFIED ? [] : $cowritingGenreList.html().split(GENRE_LIST_DELIMITER),
|
||||
cowriting_purpose: $cowritingPurpose.val()
|
||||
})
|
||||
.done(postUpdateProfileSuccess)
|
||||
.fail(postUpdateProfileFailure);
|
||||
|
|
@ -154,7 +241,7 @@
|
|||
|
||||
events();
|
||||
|
||||
$screen.iCheck({
|
||||
$screen.find('.interest-options').iCheck({
|
||||
checkboxClass: 'icheckbox_minimal',
|
||||
radioClass: 'iradio_minimal',
|
||||
inheritClass: true
|
||||
|
|
|
|||
|
|
@ -90,9 +90,12 @@
|
|||
|
||||
// virtual band genres
|
||||
profileUtils.virtualBandGenres = function(genres) {
|
||||
var matches = $.grep(genres, function(g) {
|
||||
return g.player_type === USER_TYPE && g.genre_type === VIRTUAL_BAND_GENRE_TYPE;
|
||||
});
|
||||
var matches = [];
|
||||
if (genres) {
|
||||
matches = $.grep(genres, function(g) {
|
||||
return g.player_type === USER_TYPE && g.genre_type === VIRTUAL_BAND_GENRE_TYPE;
|
||||
});
|
||||
}
|
||||
|
||||
return matches;
|
||||
}
|
||||
|
|
@ -104,9 +107,12 @@
|
|||
|
||||
// traditional band genres
|
||||
profileUtils.traditionalBandGenres = function(genres) {
|
||||
var matches = $.grep(genres, function(g) {
|
||||
return g.player_type === USER_TYPE && g.genre_type === TRADITIONAL_BAND_GENRE_TYPE;
|
||||
});
|
||||
var matches = [];
|
||||
if (genres) {
|
||||
matches = $.grep(genres, function(g) {
|
||||
return g.player_type === USER_TYPE && g.genre_type === TRADITIONAL_BAND_GENRE_TYPE;
|
||||
});
|
||||
}
|
||||
|
||||
return matches;
|
||||
}
|
||||
|
|
@ -118,9 +124,12 @@
|
|||
|
||||
// paid session genres
|
||||
profileUtils.paidSessionGenres = function(genres) {
|
||||
var matches = $.grep(genres, function(g) {
|
||||
return g.player_type === USER_TYPE && g.genre_type === PAID_SESSION_GENRE_TYPE;
|
||||
});
|
||||
var matches = [];
|
||||
if (genres) {
|
||||
matches = $.grep(genres, function(g) {
|
||||
return g.player_type === USER_TYPE && g.genre_type === PAID_SESSION_GENRE_TYPE;
|
||||
});
|
||||
}
|
||||
|
||||
return matches;
|
||||
}
|
||||
|
|
@ -132,9 +141,12 @@
|
|||
|
||||
// free session genres
|
||||
profileUtils.freeSessionGenres = function(genres) {
|
||||
var matches = $.grep(genres, function(g) {
|
||||
return g.player_type === USER_TYPE && g.genre_type === FREE_SESSION_GENRE_TYPE;
|
||||
});
|
||||
var matches = [];
|
||||
if (genres) {
|
||||
matches = $.grep(genres, function(g) {
|
||||
return g.player_type === USER_TYPE && g.genre_type === FREE_SESSION_GENRE_TYPE;
|
||||
});
|
||||
}
|
||||
|
||||
return matches;
|
||||
}
|
||||
|
|
@ -146,9 +158,12 @@
|
|||
|
||||
// cowriting genres
|
||||
profileUtils.cowritingGenres = function(genres) {
|
||||
var matches = $.grep(genres, function(g) {
|
||||
return g.player_type === USER_TYPE && g.genre_type === COWRITING_GENRE_TYPE;
|
||||
});
|
||||
var matches = [];
|
||||
if (genres) {
|
||||
matches = $.grep(genres, function(g) {
|
||||
return g.player_type === USER_TYPE && g.genre_type === COWRITING_GENRE_TYPE;
|
||||
});
|
||||
}
|
||||
|
||||
return matches;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
@import "client/common.css.scss";
|
||||
@import "common.css.scss";
|
||||
|
||||
|
||||
#account-profile-experience {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
@import "client/common.css.scss";
|
||||
@import "common.css.scss";
|
||||
|
||||
|
||||
#account-profile-interests {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
<label>I would like to join a virtual band <a class="help">[?]</a></label>
|
||||
<div class="left w30">
|
||||
<div class="left w25">
|
||||
<input type="radio" name="virtual_band" id="virtual-band-yes" value="1" />
|
||||
<input type="radio" name="virtual_band" id="virtual-band-yes" value="true" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="virtual-band-yes">Yes</label>
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
</div>
|
||||
<div class="left w30">
|
||||
<div class="left w25">
|
||||
<input type="radio" name="virtual_band" id="virtual-band-no" value="0" />
|
||||
<input type="radio" name="virtual_band" id="virtual-band-no" value="false" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="virtual-band-no">No</label>
|
||||
|
|
@ -38,12 +38,12 @@
|
|||
|
||||
<div id="virtual-band-genres" class="left genres">
|
||||
<label>Desired Genre <a class="select-genre">select</a></label>
|
||||
<span class="genre-list">None specified</span>
|
||||
<span class="genre-list"></span>
|
||||
</div>
|
||||
|
||||
<div class="field left w35">
|
||||
<label>Play Commitment</label>
|
||||
<select name="virtual_play_commitment">
|
||||
<select id="virtual-band-commitment" name="virtual_band_commitment">
|
||||
<option value='1'>infrequent</option>
|
||||
<option value='2'>once a week</option>
|
||||
<option value='3'>2-3 times a week</option>
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
<label>I would like to join a traditional band <a class="help">[?]</a></label>
|
||||
<div class="left w30">
|
||||
<div class="left w25">
|
||||
<input type="radio" name="traditional_band" id="traditional-band-yes" value="1" />
|
||||
<input type="radio" name="traditional_band" id="traditional-band-yes" value="true" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="traditional-band-yes">Yes</label>
|
||||
|
|
@ -67,7 +67,7 @@
|
|||
</div>
|
||||
<div class="left w30">
|
||||
<div class="left w25">
|
||||
<input type="radio" name="traditional_band" id="traditional-band-no" value="0" />
|
||||
<input type="radio" name="traditional_band" id="traditional-band-no" value="false" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="traditional-band-no">No</label>
|
||||
|
|
@ -77,12 +77,12 @@
|
|||
|
||||
<div id="traditional-band-genres" class="left genres">
|
||||
<label>Desired Genre <a class="select-genre">select</a></label>
|
||||
<span class="genre-list">None specified</span>
|
||||
<span class="genre-list"></span>
|
||||
</div>
|
||||
|
||||
<div class="field left w15">
|
||||
<label>Play Commitment</label>
|
||||
<select name="traditional_play_commitment">
|
||||
<select id="traditional-band-commitment" name="traditional_band_commitment">
|
||||
<option value='1'>infrequent</option>
|
||||
<option value='2'>once a week</option>
|
||||
<option value='3'>2-3 times a week</option>
|
||||
|
|
@ -92,7 +92,7 @@
|
|||
|
||||
<div class="field left w10">
|
||||
<label>Touring Option</label>
|
||||
<select name="touring">
|
||||
<select id="traditional-band-touring" name="touring">
|
||||
<option value='1'>Yes</option>
|
||||
<option value='0'>No</option>
|
||||
</select>
|
||||
|
|
@ -106,7 +106,7 @@
|
|||
<label>I am available to play in paid sessions <a class="help">[?]</a></label>
|
||||
<div class="left w30">
|
||||
<div class="left w25">
|
||||
<input type="radio" name="paid_sessions" id="paid-sessions-yes" value="1" />
|
||||
<input type="radio" name="paid_sessions" id="paid-sessions-yes" value="true" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="paid-sessions-yes">Yes</label>
|
||||
|
|
@ -114,7 +114,7 @@
|
|||
</div>
|
||||
<div class="left w30">
|
||||
<div class="left w25">
|
||||
<input type="radio" name="paid_sessions" id="paid-sessions-no" value="0" />
|
||||
<input type="radio" name="paid_sessions" id="paid-sessions-no" value="false" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="paid-sessions-no">No</label>
|
||||
|
|
@ -124,17 +124,17 @@
|
|||
|
||||
<div id="paid-sessions-genres" class="left genres">
|
||||
<label>Desired Genre <a class="select-genre">select</a></label>
|
||||
<span class="genre-list">None specified</span>
|
||||
<span class="genre-list"></span>
|
||||
</div>
|
||||
|
||||
<div class="field left w15">
|
||||
<label>Hourly Rate:</label>
|
||||
<input type="text" class="rate" name="hourly_rate" />
|
||||
<input type="text" class="rate" id="hourly-rate" name="paid_sessions_hourly_rate" />
|
||||
</div>
|
||||
|
||||
<div class="field left w15">
|
||||
<label>Daily Rate:</label>
|
||||
<input type="text" class="rate" name="daily_rate" />
|
||||
<input type="text" class="rate" id="daily-rate" name="paid_sessions_daily_rate" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -145,7 +145,7 @@
|
|||
<label>I am available to play in free sessions <a class="help">[?]</a></label>
|
||||
<div class="left w30">
|
||||
<div class="left w25">
|
||||
<input type="radio" name="free_sessions" id="free-sessions-yes" value="1" />
|
||||
<input type="radio" name="free_sessions" id="free-sessions-yes" value="true" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="free-sessions-yes">Yes</label>
|
||||
|
|
@ -153,7 +153,7 @@
|
|||
</div>
|
||||
<div class="left w30">
|
||||
<div class="left w25">
|
||||
<input type="radio" name="free_sessions" id="free-sessions-no" value="0" />
|
||||
<input type="radio" name="free_sessions" id="free-sessions-no" value="false" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="free-sessions-no">No</label>
|
||||
|
|
@ -163,7 +163,7 @@
|
|||
|
||||
<div id="free-sessions-genres" class="left genres">
|
||||
<label>Desired Genre <a class="select-genre">select</a></label>
|
||||
<span class="genre-list">None specified</span>
|
||||
<span class="genre-list"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -174,7 +174,7 @@
|
|||
<label>I would like to co-write with partner(s) <a class="help">[?]</a></label>
|
||||
<div class="left w30">
|
||||
<div class="left w25">
|
||||
<input type="radio" name="cowriting" id="cowriting-yes" value="1" />
|
||||
<input type="radio" name="cowriting" id="cowriting-yes" value="true" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="cowriting-yes">Yes</label>
|
||||
|
|
@ -182,7 +182,7 @@
|
|||
</div>
|
||||
<div class="left w30">
|
||||
<div class="left w25">
|
||||
<input type="radio" name="cowriting" id="cowriting-no" value="0" />
|
||||
<input type="radio" name="cowriting" id="cowriting-no" value="false" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="cowriting-no">No</label>
|
||||
|
|
@ -192,14 +192,14 @@
|
|||
|
||||
<div id="cowriting-genres" class="left genres">
|
||||
<label>Desired Genre <a class="select-genre">select</a></label>
|
||||
<span class="genre-list">None specified</span>
|
||||
<span class="genre-list"></span>
|
||||
</div>
|
||||
|
||||
<div class="field left w35">
|
||||
<label>Purpose</label>
|
||||
<select name="cowriting_purpose">
|
||||
<option value='1'>just for fun</option>
|
||||
<select id="cowriting-purpose" name="cowriting_purpose">
|
||||
<option value='2'>sell music</option>
|
||||
<option value='1'>just for fun</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -219,4 +219,5 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -33,4 +33,5 @@
|
|||
= render 'dialogs/allSyncsDialog'
|
||||
= render 'dialogs/adjustGearSpeedDialog'
|
||||
= render 'dialogs/openJamTrackDialog'
|
||||
= render 'dialogs/openBackingTrackDialog'
|
||||
= render 'dialogs/openBackingTrackDialog'
|
||||
= render 'dialogs/genreSelectorDialog'
|
||||
Loading…
Reference in New Issue