Show More
@@ -121,14 +121,25 b' define([' | |||||
121 | $('.duplicate-button').click($.proxy(this.duplicate_selected, this)); |
|
121 | $('.duplicate-button').click($.proxy(this.duplicate_selected, this)); | |
122 | $('.delete-button').click($.proxy(this.delete_selected, this)); |
|
122 | $('.delete-button').click($.proxy(this.delete_selected, this)); | |
123 |
|
123 | |||
124 |
// Bind events for selection |
|
124 | // Bind events for selection checkboxes. | |
125 | $('.tree-selector').change(function(){that.select($(this).attr('id'),$(this).is(':checked'))}); |
|
125 | $('.tree-selector').change(function(){that.select($(this).attr('id'),$(this).is(':checked'))}); | |
126 | // Do not propagate click for the menu to prevent the menu from closing |
|
126 | ||
127 | $('#tree-selector-menu').click(function(event){event.stopPropagation();}) |
|
127 | // Make the dropdown sticky | |
|
128 | // Dirty solution by stopping click propagation | |||
|
129 | // $('#tree-selector-menu').click(function(event){event.stopPropagation();}) | |||
|
130 | // Cleaner solution by reimplementing the open-close dynamics (and removing data-toggle="dropdown" in html) | |||
|
131 | $('#tree-selector-btn').on('click', function(event) { | |||
|
132 | $(this).parent().toggleClass('open'); | |||
|
133 | }); | |||
|
134 | $('body').on('click', function (e) { | |||
|
135 | if (!$('#tree-selector-btn').is(e.target) && $('#tree-selector-btn').has(e.target).length === 0 && $('.open').has(e.target).length === 0) { | |||
|
136 | $('#tree-selector-btn').parent().removeClass('open'); | |||
|
137 | } | |||
|
138 | }); | |||
128 | } |
|
139 | } | |
129 | }; |
|
140 | }; | |
130 |
|
141 | |||
131 |
NotebookList.prototype.handleFilesUpload = |
|
142 | NotebookList.prototype.handleFilesUpload = function(event, dropOrForm) { | |
132 | var that = this; |
|
143 | var that = this; | |
133 | var files; |
|
144 | var files; | |
134 | if(dropOrForm =='drop'){ |
|
145 | if(dropOrForm =='drop'){ | |
@@ -288,7 +299,7 b' define([' | |||||
288 | } |
|
299 | } | |
289 | } |
|
300 | } | |
290 | }); |
|
301 | }); | |
291 |
this._selection_changed(); |
|
302 | this._selection_changed(); | |
292 | }; |
|
303 | }; | |
293 |
|
304 | |||
294 |
|
305 | |||
@@ -379,7 +390,7 b' define([' | |||||
379 | }; |
|
390 | }; | |
380 |
|
391 | |||
381 | /** |
|
392 | /** | |
382 |
* Select items in the tree of specified |
|
393 | * Select all items in the tree of specified type. | |
383 | * checkbox_id : string among "select-all, "select-folders", "select-notebooks", "select-running-notebooks", "select-files" |
|
394 | * checkbox_id : string among "select-all, "select-folders", "select-notebooks", "select-running-notebooks", "select-files" | |
384 | * state : boolean, true to select and false to deselect |
|
395 | * state : boolean, true to select and false to deselect | |
385 | */ |
|
396 | */ | |
@@ -417,11 +428,13 b' define([' | |||||
417 | var num_directory = 0; |
|
428 | var num_directory = 0; | |
418 | var num_file = 0; |
|
429 | var num_file = 0; | |
419 | var that = this; |
|
430 | var that = this; | |
|
431 | ||||
420 | $('.list_item input[type=checkbox]').each(function(index, item) { |
|
432 | $('.list_item input[type=checkbox]').each(function(index, item) { | |
421 | var parent = $(item).parent().parent(); |
|
433 | var parent = $(item).parent().parent(); | |
422 |
// If the item doesn't have an upload button |
|
434 | // If the item doesn't have an upload button, isn't the | |
423 |
// breadcrumbs, it can be selected. |
|
435 | // breadcrumbs and isn't the parent folder '..', then it can be selected. | |
424 | if (parent.find('.upload_button').length === 0 && parent.data('path') !== '') { |
|
436 | // Breadcrumbs path == ''. | |
|
437 | if (parent.find('.upload_button').length === 0 && parent.data('path') !=='' && parent.data('path') !== utils.url_path_split(that.notebook_path)[0]) { | |||
425 | if (parent.data('type') == 'notebook') { |
|
438 | if (parent.data('type') == 'notebook') { | |
426 | num_notebook++; |
|
439 | num_notebook++; | |
427 | if (that.sessions[parent.data('path')] !== undefined) { |
|
440 | if (that.sessions[parent.data('path')] !== undefined) { | |
@@ -495,14 +508,25 b' define([' | |||||
495 | var total_nums = [num_file+num_directory+num_notebook, num_directory, num_notebook, num_running_notebook, num_file]; |
|
508 | var total_nums = [num_file+num_directory+num_notebook, num_directory, num_notebook, num_running_notebook, num_file]; | |
496 | var selected_nums = [num_sel_file+num_sel_directory+num_sel_notebook, num_sel_directory, num_sel_notebook, num_sel_running_notebook, num_sel_file]; |
|
509 | var selected_nums = [num_sel_file+num_sel_directory+num_sel_notebook, num_sel_directory, num_sel_notebook, num_sel_running_notebook, num_sel_file]; | |
497 |
|
510 | |||
|
511 | // Disable the main checkbox if the list is empty | |||
|
512 | $('#'+checkbox_ids[0]).parent().prop('disabled',total_nums[0] === 0); | |||
498 | for (var i=0; i < 5; i++) { |
|
513 | for (var i=0; i < 5; i++) { | |
|
514 | if (i>0) { | |||
|
515 | // Disable each menu item if there is nothing to select | |||
|
516 | $('#'+checkbox_ids[i]).prop('disabled',total_nums[i] === 0); | |||
|
517 | if (total_nums[i] === 0) { | |||
|
518 | $('#'+checkbox_ids[i]).parent().parent().addClass('disabled'); | |||
|
519 | } else { | |||
|
520 | $('#'+checkbox_ids[i]).parent().parent().removeClass('disabled'); | |||
|
521 | } | |||
|
522 | } | |||
|
523 | // Update badge | |||
|
524 | $('#badge-'+checkbox_ids[i]).text(selected_nums[i]===0 ? '' : selected_nums[i]); | |||
|
525 | // Update each checkbox status | |||
499 | if (selected_nums[i] === 0) { |
|
526 | if (selected_nums[i] === 0) { | |
500 | $('#'+checkbox_ids[i])[0].indeterminate = false; |
|
527 | $('#'+checkbox_ids[i])[0].indeterminate = false; | |
501 | $('#'+checkbox_ids[i]).prop('checked', false); |
|
528 | $('#'+checkbox_ids[i]).prop('checked', false); | |
502 | $('#badge-'+checkbox_ids[i]).text(''); |
|
|||
503 | } else { |
|
529 | } else { | |
504 | // Update badge |
|
|||
505 | $('#badge-'+checkbox_ids[i]).text(selected_nums[i]); |
|
|||
506 | if (selected_nums[i] === total_nums[i]) { |
|
530 | if (selected_nums[i] === total_nums[i]) { | |
507 | $('#'+checkbox_ids[i])[0].indeterminate = false; |
|
531 | $('#'+checkbox_ids[i])[0].indeterminate = false; | |
508 | $('#'+checkbox_ids[i]).prop('checked', true); |
|
532 | $('#'+checkbox_ids[i]).prop('checked', true); |
@@ -184,12 +184,24 b' input.engine_num_input {' | |||||
184 |
|
184 | |||
185 | #tree-selector { |
|
185 | #tree-selector { | |
186 | display: inline-block; |
|
186 | display: inline-block; | |
187 |
padding-right: |
|
187 | padding-right: 5px; | |
|
188 | } | |||
188 |
|
189 | |||
189 | input[type=checkbox] { |
|
190 | #select-all { | |
190 | margin-left: @dashboard_lr_pad; |
|
191 | margin-top:-1px; | |
191 | vertical-align: baseline; |
|
192 | margin-left: @dashboard_lr_pad; | |
192 | } |
|
193 | vertical-align: baseline; | |
|
194 | } | |||
|
195 | ||||
|
196 | #tree-selector-menu { | |||
|
197 | width: 200px; | |||
|
198 | .menuitem label{ | |||
|
199 | margin-bottom: 0px; | |||
|
200 | } | |||
|
201 | input[type=checkbox] { | |||
|
202 | margin-left: 0px; | |||
|
203 | vertical-align: baseline; | |||
|
204 | } | |||
193 | } |
|
205 | } | |
194 |
|
206 | |||
195 | .tab-content .row { |
|
207 | .tab-content .row { |
@@ -78,42 +78,50 b' data-terminals-available="{{terminals_available}}"' | |||||
78 | <div id="notebook_list_header" class="row list_header"> |
|
78 | <div id="notebook_list_header" class="row list_header"> | |
79 | <div class="btn-group dropdown" id='tree-selector'> |
|
79 | <div class="btn-group dropdown" id='tree-selector'> | |
80 | <button type="button" class="btn btn-default btn-xs"><input type="checkbox" class="tree-selector" id="select-all"></input></button> |
|
80 | <button type="button" class="btn btn-default btn-xs"><input type="checkbox" class="tree-selector" id="select-all"></input></button> | |
81 |
<button class="btn btn-default btn-xs dropdown-toggle" type="button" id="tree-selector-btn" |
|
81 | <button class="btn btn-default btn-xs dropdown-toggle" type="button" id="tree-selector-btn" aria-expanded="true"> | |
82 | <span class="caret"></span> |
|
82 | <span class="caret"></span> | |
83 | <span class="sr-only">Toggle Dropdown</span> |
|
83 | <span class="sr-only">Toggle Dropdown</span> | |
84 | </button> |
|
84 | </button> | |
85 | <ul id="tree-selector-menu" class="dropdown-menu" role="menu" aria-labelledby="tree-selector-btn"> |
|
85 | <ul id="tree-selector-menu" class="dropdown-menu" role="menu" aria-labelledby="tree-selector-btn"> | |
86 | <li role="presentation"> |
|
86 | <li role="presentation"> | |
87 | <input type="checkbox" class="tree-selector" id="select-folders"></input> |
|
87 | <a role="menuitem"> | |
88 |
< |
|
88 | <input type="checkbox" class="tree-selector" id="select-folders"></input> | |
89 | <i class="item_icon folder_icon icon-fixed-width"></i> |
|
89 | <label for="select-folders"> | |
90 | Folders |
|
90 | <i class="folder_icon icon-fixed-width"></i> | |
91 | <span class="badge" id="badge-select-folders"></span> |
|
91 | Folders | |
92 | </label> |
|
92 | </label> | |
|
93 | <span class="badge pull-right" id="badge-select-folders"></span> | |||
|
94 | </a> | |||
93 | </li> |
|
95 | </li> | |
94 | <li role="presentation"> |
|
96 | <li role="presentation"> | |
95 | <input type="checkbox" class="tree-selector" id="select-notebooks"></input> |
|
97 | <a role="menuitem"> | |
96 |
< |
|
98 | <input type="checkbox" class="tree-selector" id="select-notebooks"></input> | |
97 | <i class="item_icon notebook_icon icon-fixed-width"></i> |
|
99 | <label for="select-notebooks"> | |
98 | All Notebooks |
|
100 | <i class="notebook_icon icon-fixed-width"></i> | |
99 | <span class="badge" id="badge-select-notebooks"></span> |
|
101 | All Notebooks | |
100 | </label> |
|
102 | </label> | |
|
103 | <span class="badge pull-right" id="badge-select-notebooks"></span> | |||
|
104 | </a> | |||
101 | </li> |
|
105 | </li> | |
102 | <li role="presentation"> |
|
106 | <li role="presentation"> | |
103 | <input type="checkbox" class="tree-selector" id="select-running-notebooks"></input> |
|
107 | <a role="menuitem"> | |
104 |
< |
|
108 | <input type="checkbox" class="tree-selector" id="select-running-notebooks"></input> | |
105 |
< |
|
109 | <label for="select-running-notebooks"> | |
106 | Running |
|
110 | <i class="running_notebook_icon icon-fixed-width"></i> | |
107 | <span class="badge" id="badge-select-running-notebooks"></span> |
|
111 | Running | |
108 | </label> |
|
112 | </label> | |
|
113 | <span class="badge pull-right" id="badge-select-running-notebooks"></span> | |||
|
114 | </a> | |||
109 | </li> |
|
115 | </li> | |
110 | <li role="presentation"> |
|
116 | <li role="presentation"> | |
111 | <input type="checkbox" class="tree-selector" id="select-files"></input> |
|
117 | <a role="menuitem"> | |
112 |
< |
|
118 | <input type="checkbox" class="tree-selector" id="select-files"></input> | |
113 | <i class="item_icon file_icon icon-fixed-width"></i> |
|
119 | <label for="select-files"> | |
114 | Files |
|
120 | <i class="file_icon icon-fixed-width"></i> | |
115 | <span class="badge" id="badge-select-files"></span> |
|
121 | Files | |
116 | </label> |
|
122 | </label> | |
|
123 | <span class="badge pull-right" id="badge-select-files"></span> | |||
|
124 | </a> | |||
117 | </li> |
|
125 | </li> | |
118 | </ul> |
|
126 | </ul> | |
119 | </div> |
|
127 | </div> |
General Comments 0
You need to be logged in to leave comments.
Login now