diff --git a/IPython/html/static/tree/js/notebooklist.js b/IPython/html/static/tree/js/notebooklist.js index a685f01..45209b0 100644 --- a/IPython/html/static/tree/js/notebooklist.js +++ b/IPython/html/static/tree/js/notebooklist.js @@ -123,7 +123,15 @@ define([ // Bind events for selection checkboxes. $('.tree-selector').change(function(){that.select($(this).attr('id'),$(this).is(':checked'))}); - + $('#button-select-all').click(function(e) { + // toggle checkbox if the click doesn't come from the checkbox already + if (!$(e.target).is('input[type=checkbox]')) { + var checkbox = $('#select-all'); + checkbox.prop('checked', !checkbox.prop('checked')); + that.select('select-all',checkbox.prop('checked')); + } + }); + // Make the dropdown sticky // Dirty solution by stopping click propagation // $('#tree-selector-menu').click(function(event){event.stopPropagation();}) @@ -132,7 +140,8 @@ define([ $(this).parent().toggleClass('open'); }); $('body').on('click', function (e) { - if (!$('#tree-selector-btn').is(e.target) && $('#tree-selector-btn').has(e.target).length === 0 && $('.open').has(e.target).length === 0) { + // Close the menu if a click happens outside of the menu list (and of the tree-selector-btn) + if (!$('#tree-selector-btn').is(e.target) && $('#tree-selector-btn').has(e.target).length === 0 && $('#tree-selector-menu').has(e.target).length === 0) { $('#tree-selector-btn').parent().removeClass('open'); } }); @@ -520,8 +529,13 @@ define([ $('#'+checkbox_ids[i]).parent().parent().removeClass('disabled'); } } - // Update badge - $('#badge-'+checkbox_ids[i]).text(selected_nums[i]===0 ? '' : selected_nums[i]); + // Update counters + // Turn empty counter into a ' ' on the main checkbox for correct button height. + var empty_counter = i===0 ? ' ' : ''; + $('#counter-'+checkbox_ids[i]).html(selected_nums[i]===0 ? empty_counter : selected_nums[i]); + // Alternative : display selected/total + // $('#counter-'+checkbox_ids[i]).html(selected_nums[i]===0 ? empty_counter : selected_nums[i] + '/' + total_nums[i]); + // Update each checkbox status if (selected_nums[i] === 0) { $('#'+checkbox_ids[i])[0].indeterminate = false; diff --git a/IPython/html/static/tree/less/tree.less b/IPython/html/static/tree/less/tree.less index 64902ff..3db4bf6 100644 --- a/IPython/html/static/tree/less/tree.less +++ b/IPython/html/static/tree/less/tree.less @@ -12,7 +12,6 @@ @btn_small_height: 24px; @btn_mini_height: 22px; @dark_dashboard_color: @breadcrumb-color; -@list_stripe_color: lighten(@page-backdrop-color,3%); // The left padding of the selector button's contents. @dashboard-selectorbtn-lpad: 7px; @@ -183,25 +182,23 @@ input.engine_num_input { } #tree-selector { - display: inline-block; - padding-right: 5px; + padding-right: 0px; +} + +#button-select-all { + min-width: 50px; } #select-all { - margin-top:-1px; margin-left: @dashboard_lr_pad; - vertical-align: baseline; + margin-right: 2px; } #tree-selector-menu { - width: 200px; - .menuitem label{ - margin-bottom: 0px; - } - input[type=checkbox] { - margin-left: 0px; - vertical-align: baseline; - } + width: 200px; + input[type=checkbox] { + margin-left: 0px; + } } .tab-content .row { diff --git a/IPython/html/templates/tree.html b/IPython/html/templates/tree.html index c31f5c1..5c38cb5 100644 --- a/IPython/html/templates/tree.html +++ b/IPython/html/templates/tree.html @@ -77,9 +77,8 @@ data-terminals-available="{{terminals_available}}"