##// END OF EJS Templates
Add some more comments...
Jonathan Frederic -
Show More
@@ -329,7 +329,14 b' define(['
329 329 file: 'edit',
330 330 };
331 331
332 /**
333 * Handles when any row selector checkbox is toggled.
334 */
332 335 NotebookList.prototype._selection_changed = function() {
336
337 // Use a JQuery selector to find each row with a checked checkbox. If
338 // we decide to add more checkboxes in the future, this code will need
339 // to be changed to distinguish which checkbox is the row selector.
333 340 var selected = [];
334 341 var has_running_notebook = false;
335 342 var has_directory = false;
@@ -337,6 +344,8 b' define(['
337 344 var that = this;
338 345 $('.list_item :checked').each(function(index, item) {
339 346 var parent = $(item).parent().parent();
347
348 // If the item doesn't have an upload button, it can be selected.
340 349 if (parent.find('.upload_button').length === 0) {
341 350 selected.push({
342 351 name: parent.data('name'),
@@ -344,6 +353,8 b' define(['
344 353 type: parent.data('type')
345 354 });
346 355
356 // Set flags according to what is selected. Flags are later
357 // used to decide which action buttons are visible.
347 358 has_running_notebook = has_running_notebook ||
348 359 (parent.data('type') == 'notebook' && that.sessions[parent.data('path')] !== undefined);
349 360 has_file = has_file || parent.data('type') == 'file';
@@ -359,14 +370,15 b' define(['
359 370 $('.rename-button').css('display', 'none');
360 371 }
361 372
362 // Shutdown is only visible when one or more notebooks are visible.
373 // Shutdown is only visible when one or more notebooks running notebooks
374 // are selected and no non-notebook items are selected.
363 375 if (has_running_notebook && !(has_file || has_directory)) {
364 376 $('.shutdown-button').css('display', 'inline-block');
365 377 } else {
366 378 $('.shutdown-button').css('display', 'none');
367 379 }
368 380
369 // Duplicate isn't visible if a directory is selected.
381 // Duplicate isn't visible when a directory is selected.
370 382 if (selected.length > 0 && !has_directory) {
371 383 $('.duplicate-button').css('display', 'inline-block');
372 384 } else {
General Comments 0
You need to be logged in to leave comments. Login now