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