VRFS-2699 select checkboxes for items already in list

This commit is contained in:
Brian Smith 2015-04-14 03:06:18 -04:00
parent 12f5fc94c2
commit 09e4253f5f
3 changed files with 19 additions and 2 deletions

View File

@ -172,8 +172,15 @@
ui.launchRecordingSelectorDialog(response, window.jamkazamRecordingSources, function(selectedRecordings) {
$jamkazamSampleList.empty();
window.jamkazamRecordingSources = [];
// update the list with the selected recordings
$.each(selectedRecordings, function(index, val) {
window.jamkazamRecordingSources.push({
'claimed_recording_id': val.id,
'description': val.name
});
buildJamkazamEntry(val.id, val.name);
});
});

View File

@ -156,8 +156,18 @@
$('.details-arrow', $feedItem).click(toggleRecordingDetails);
$('.play-button', $feedItem).click(toggleRecordingPlay);
var checked = '';
var match = $.grep(selectedRecordings, function(obj, index) {
return obj.claimed_recording_id === claimedRecording.id;
});
if (match && match.length > 0) {
checked = 'checked';
}
// put the item on the page
$recordings.append("<div class='left'><input type='checkbox' data-recording-id='" + claimedRecording.id + "' data-recording-title='" + claimedRecording.name + "' />");
$recordings.append("<div class='left'><input type='checkbox' " + checked + " data-recording-id='" + claimedRecording.id + "' data-recording-title='" + claimedRecording.name + "' />");
$recordings.append($feedItem);
// these routines need the item to have height to work (must be after renderFeed)

View File

@ -11,4 +11,4 @@
.right.action-buttons
%a.button-grey.btn-cancel-dialog{'layout-action' => 'cancel'} CANCEL
%a.button-orange.btn-select-recordings ADD
%a.button-orange.btn-select-recordings SAVE