Show More
@@ -122,14 +122,14 define([ | |||
|
122 | 122 | $('.delete-button').click($.proxy(this.delete_selected, this)); |
|
123 | 123 | |
|
124 | 124 | // Bind events for selection menu buttons. |
|
125 |
$('#selector-menu').click(function(event){that.select($(event.target).attr('id') |
|
|
126 |
$(' |
|
|
125 | $('#selector-menu').click(function(event){that.select($(event.target).attr('id'))}); | |
|
126 | $('#select-all').change(function(){that.select($(this).is(':checked') ? 'select-all' : 'select-none')}); | |
|
127 | 127 | $('#button-select-all').click(function(e) { |
|
128 | 128 | // toggle checkbox if the click doesn't come from the checkbox already |
|
129 | 129 | if (!$(e.target).is('input[type=checkbox]')) { |
|
130 | 130 | var checkbox = $('#select-all'); |
|
131 | 131 | checkbox.prop('checked', !checkbox.prop('checked')); |
|
132 |
that.select( |
|
|
132 | that.select(checkbox.prop('checked') ? 'select-all' : 'select-none'); | |
|
133 | 133 | } |
|
134 | 134 | }); |
|
135 | 135 | } |
@@ -387,21 +387,20 define([ | |||
|
387 | 387 | |
|
388 | 388 | /** |
|
389 | 389 | * Select all items in the tree of specified type. |
|
390 | * selection_type : string among "select-all, "select-folders", "select-notebooks", "select-running-notebooks", "select-files" | |
|
391 | * state : boolean, true to select and false to deselect | |
|
390 | * selection_type : string among "select-all", "select-folders", "select-notebooks", "select-running-notebooks", "select-files" | |
|
391 | * any other string (like "select-none") deselects all items | |
|
392 | 392 | */ |
|
393 |
NotebookList.prototype.select = function(selection_type |
|
|
393 | NotebookList.prototype.select = function(selection_type) { | |
|
394 | 394 | var that = this; |
|
395 | 395 | $('.list_item').each(function(index, item) { |
|
396 | // For each item, determine if the state should be set, depending on the selection_type that triggered select | |
|
397 | var set_state = (selection_type === "select-all"); | |
|
398 |
|
|
|
399 |
|
|
|
400 |
|
|
|
401 |
|
|
|
402 | if (set_state) { | |
|
403 |
|
|
|
404 | } | |
|
396 | var item_type = $(item).data('type'); | |
|
397 | var state = false; | |
|
398 | state = state || (selection_type === "select-all"); | |
|
399 | state = state || (selection_type === "select-folders" && item_type === 'directory'); | |
|
400 | state = state || (selection_type === "select-notebooks" && item_type === 'notebook'); | |
|
401 | state = state || (selection_type === "select-running-notebooks" && item_type === 'notebook' && that.sessions[$(item).data('path')] !== undefined); | |
|
402 | state = state || (selection_type === "select-files" && item_type === 'file'); | |
|
403 | $(item).find('input[type=checkbox]').prop('checked', state); | |
|
405 | 404 | }); |
|
406 | 405 | this._selection_changed(); |
|
407 | 406 | }; |
General Comments 0
You need to be logged in to leave comments.
Login now