VRFS-3190 : Fix a few functional and style problems. Cleanup as necessary.
This commit is contained in:
parent
b39c314e5b
commit
972b65c4ef
|
|
@ -32,9 +32,9 @@
|
|||
var $twitterUsername = $screen.find('.twitter-username');
|
||||
|
||||
// performance samples
|
||||
var $jamkazamSampleList = $screen.find('.samples.jamkazam').find('.sample-list');
|
||||
var $soundCloudSampleList = $screen.find('.samples.soundcloud').find('.sample-list');
|
||||
var $youTubeSampleList = $screen.find('.samples.youtube').find('.sample-list');
|
||||
var $jamkazamSampleList = $screen.find(".sample-list[source-type='jamkazam']")
|
||||
var $soundCloudSampleList = $screen.find(".sample-list[source-type='soundcloud']")
|
||||
var $youTubeSampleList = $screen.find(".sample-list[source-type='youtube']")
|
||||
|
||||
// buttons
|
||||
var $btnAddJkRecording = $screen.find('.btn-add-jk-recording');
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
if (targetPlayer && targetPlayer.keys && targetPlayer.keys.length > 0) {
|
||||
renderPlayer(targetPlayer)
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function renderPlayer(targetPlayer) {
|
||||
|
|
@ -120,7 +120,7 @@
|
|||
}
|
||||
|
||||
function loadSamples(samples, type, $sampleList, recordingSources) {
|
||||
$sampleList.empty();
|
||||
$sampleList.empty();
|
||||
|
||||
if (type === 'jamkazam') {
|
||||
$.each(samples, function(index, val) {
|
||||
|
|
@ -131,8 +131,7 @@
|
|||
|
||||
buildJamkazamEntry(val.claimed_recording.id, val.claimed_recording.name);
|
||||
});
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (samples && samples.length > 0) {
|
||||
$.each(samples, function(index, val) {
|
||||
|
||||
|
|
@ -208,6 +207,9 @@
|
|||
});
|
||||
|
||||
enableSubmits();
|
||||
|
||||
$(".sample-list .close-button", $screen).on("click", function(e) {
|
||||
}
|
||||
}
|
||||
|
||||
function enableSubmits() {
|
||||
|
|
@ -257,9 +259,7 @@
|
|||
'service_type': type,
|
||||
'claimed_recording_id': id,
|
||||
});
|
||||
}
|
||||
|
||||
else {
|
||||
} else {
|
||||
var url = $(this).attr('data-recording-url');
|
||||
var title = $(this).attr('data-recording-title');
|
||||
|
||||
|
|
@ -325,14 +325,19 @@
|
|||
|
||||
if(xhr.status == 422) {
|
||||
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
app.ajaxError(xhr, textStatus, errorMessage)
|
||||
}
|
||||
}
|
||||
|
||||
function removeRow(recordingId, type) {
|
||||
$('div[data-recording-id=' + recordingId + ']').remove();
|
||||
var sampleList = $('.sample-list[source-type="' + type + '"]')
|
||||
var rowCnt = sampleList.find('.recording-row').length
|
||||
|
||||
if (rowCnt==0) {
|
||||
sampleList.find(".empty").removeClass("hidden")
|
||||
}
|
||||
|
||||
if (type === 'soundcloud') {
|
||||
window.soundCloudRecordingValidator.removeRecordingId(recordingId);
|
||||
|
|
@ -361,10 +366,11 @@
|
|||
//var $screen = $('#account-profile-samples');
|
||||
var $btnAddSoundCloudRecording = $screen.find('.btn-add-soundcloud-recording');
|
||||
var $btnAddYouTubeVideo = $screen.find('.btn-add-youtube-video');
|
||||
var $soundCloudSampleList = $screen.find('.samples.soundcloud');
|
||||
var $youTubeSampleList = $screen.find('.samples.youtube');
|
||||
// var $soundCloudSampleList = $screen.find('.samples.soundcloud');
|
||||
// var $youTubeSampleList = $screen.find('.samples.youtube');
|
||||
|
||||
|
||||
setTimeout(function() {
|
||||
setTimeout(function() {
|
||||
window.urlValidator = new JK.SiteValidator('url', userNameSuccessCallback, userNameFailCallback, parent);
|
||||
window.urlValidator.init();
|
||||
|
||||
|
|
@ -390,7 +396,7 @@
|
|||
window.twitterValidator.init();
|
||||
|
||||
window.soundCloudRecordingValidator = new JK.RecordingSourceValidator('rec_soundcloud', soundCloudSuccessCallback, siteFailCallback, parent);
|
||||
logger.debug("window.soundCloudRecordingValidator", window.soundCloudRecordingValidator)
|
||||
logger.debug("window.soundCloudRecordingValidator", window.soundCloudRecordingValidator, parent)
|
||||
window.youTubeRecordingValidator = new JK.RecordingSourceValidator('rec_youtube', youTubeSuccessCallback, siteFailCallback, parent);
|
||||
|
||||
$document.triggerHandler('INIT_SITE_VALIDATORS');
|
||||
|
|
@ -408,7 +414,7 @@
|
|||
$inputDiv.append("<span class='error-text'>Invalid username</span>").show();
|
||||
}
|
||||
|
||||
function soundCloudSuccessCallback($inputDiv) {
|
||||
function soundCloudSuccessCallback($inputDiv) {
|
||||
siteSuccessCallback($inputDiv, window.soundCloudRecordingValidator, $soundCloudSampleList, 'soundcloud');
|
||||
}
|
||||
|
||||
|
|
@ -416,24 +422,24 @@
|
|||
siteSuccessCallback($inputDiv, window.youTubeRecordingValidator, $youTubeSampleList, 'youtube');
|
||||
}
|
||||
|
||||
function siteSuccessCallback($inputDiv, recordingSiteValidator, $sampleList, type) {
|
||||
function siteSuccessCallback($inputDiv, recordingSiteValidator, sampleList, type) {
|
||||
sampleList.find(".empty").addClass("hidden")
|
||||
$inputDiv.removeClass('error');
|
||||
$inputDiv.find('.error-text').remove();
|
||||
|
||||
var recordingSources = recordingSiteValidator.recordingSources();
|
||||
if (recordingSources && recordingSources.length > 0) {
|
||||
var $sampleList = $sampleList.find('.sample-list');
|
||||
var addedRecording = recordingSources[recordingSources.length-1];
|
||||
|
||||
// TODO: this code is repeated in JS file
|
||||
// TODO: this code is repeated in elsewhere in this JS file:
|
||||
var recordingIdAttr = ' data-recording-id="' + addedRecording.recording_id + '" ';
|
||||
var recordingUrlAttr = ' data-recording-url="' + addedRecording.url + '" ';
|
||||
var recordingTitleAttr = ' data-recording-title="' + addedRecording.recording_title + '"';
|
||||
var title = formatTitle(addedRecording.recording_title);
|
||||
$sampleList.append('<div class="clearall recording-row left entry"' + recordingIdAttr + recordingUrlAttr + recordingTitleAttr + '>' + title + '</div>');
|
||||
sampleList.append('<div class="clearall recording-row left entry"' + recordingIdAttr + recordingUrlAttr + recordingTitleAttr + '>' + title + '</div>');
|
||||
|
||||
var onclick = "onclick=removeRow(\'" + addedRecording.recording_id + "\',\'" + type + "\');";
|
||||
$sampleList.append('<div class="right close-button" ' + recordingIdAttr + onclick + '>X</div>');
|
||||
sampleList.append('<div class="right close-button" ' + recordingIdAttr + onclick + '>X</div>');
|
||||
}
|
||||
|
||||
$inputDiv.find('input').val('');
|
||||
|
|
|
|||
|
|
@ -14,6 +14,16 @@
|
|||
}
|
||||
}
|
||||
|
||||
.sample-list {
|
||||
border: 1px inset #cfcfcf;
|
||||
padding: 0.5em;
|
||||
.empty {
|
||||
font-style: italic;
|
||||
}
|
||||
min-height: 150px;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
table.control-table {
|
||||
width: 100%;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
td colspan="33.33%": label JamKazam Recordings:
|
||||
td colspan="33.33%": label SoundCloud Recordings (URL):
|
||||
td colspan="33.33%": label YouTube Videos (URL):
|
||||
tr
|
||||
tr.add-samples-controls-row
|
||||
td colspan="33.33%"
|
||||
a.btn-add-jk-recording.button-grey BROWSE
|
||||
td colspan="33.33%"
|
||||
|
|
@ -82,7 +82,13 @@
|
|||
td
|
||||
a.btn-add-youtube-video.button-grey.add-recording-source ADD
|
||||
span.spinner-small
|
||||
tr
|
||||
td colspan="33.33%": .sample-list
|
||||
td colspan="33.33%": .sample-list
|
||||
td colspan="33.33%": .sample-list
|
||||
tr.add-samples-list-row
|
||||
td colspan="33.33%"
|
||||
.sample-list source-type='jamkazam'
|
||||
.empty No recordings
|
||||
td colspan="33.33%"
|
||||
.sample-list source-type='soundcloud'
|
||||
.empty No recordings
|
||||
td colspan="33.33%"
|
||||
.sample-list source-type='youtube'
|
||||
.empty No recordings
|
||||
|
|
@ -236,7 +236,7 @@
|
|||
var accountProfileInterests = new JK.AccountProfileInterests(JK.app);
|
||||
accountProfileInterests.initialize();
|
||||
|
||||
var accountProfileSamples = new JK.AccountProfileSamples(JK.app, null)
|
||||
var accountProfileSamples = new JK.AccountProfileSamples(JK.app, $(".account-profile-samples"))
|
||||
accountProfileSamples.initialize();
|
||||
|
||||
var accountAudioProfile = new JK.AccountAudioProfile(JK.app);
|
||||
|
|
|
|||
Loading…
Reference in New Issue