Ticket #35576: 35576.diff
File 35576.diff, 2.4 KB (added by , 9 years ago) |
---|
-
nav-menu.js
61 61 this.initToggles(); 62 62 63 63 this.initPreviewing(); 64 65 this.hideButtonControlsIfSearchEmpty(); 64 66 }, 65 67 68 /** 69 * Hides the button controls when the user comes back to the page when page is refreshed. 70 */ 71 hideButtonControlsIfSearchEmpty : function(){ 72 var activePanel = $('.control-section.open .tabs-panel-active'), 73 hashValue = window.location.hash.substr(1); 74 75 if( activePanel.length && hashValue && hashValue.indexOf( 'search' ) > 1 ){ 76 if( ! activePanel.find('li').length ) 77 activePanel.closest('.posttypediv, .taxonomydiv').find('.button-controls').hide(); 78 } 79 }, 80 66 81 jQueryExtensions : function() { 67 82 // jQuery extensions 68 83 $.fn.extend({ … … 1021 1036 1022 1037 attachTabsPanelListeners : function() { 1023 1038 $('#menu-settings-column').bind('click', function(e) { 1024 var selectAreaMatch, panelId, wrapper, items, 1039 var selectAreaMatch, panelId, wrapper, items, postTypeDiv, button_controls, 1025 1040 target = $(e.target); 1026 1041 1027 1042 if ( target.hasClass('nav-tab-link') ) { … … 1042 1057 // select the search bar 1043 1058 $('.quick-search', wrapper).focus(); 1044 1059 1060 postTypeDiv = target.closest('.posttypediv, .taxonomydiv'); 1061 button_controls = postTypeDiv.find('.button-controls'); 1062 1063 //hide select All if no items are in search panel 1064 if( ! postTypeDiv.find('.tabs-panel-active li').length && panelId.indexOf('search') >= 0 ){ 1065 button_controls.hide(); 1066 } 1067 else{ 1068 button_controls.show(); 1069 } 1070 1045 1071 e.preventDefault(); 1046 1072 } else if ( target.hasClass('select-all') ) { 1047 1073 selectAreaMatch = /#(.*)$/.exec(e.target.href); … … 1174 1200 form = document.getElementById('nav-menu-meta'), 1175 1201 pattern = /menu-item[(\[^]\]*/, 1176 1202 $items = $('<div>').html(resp).find('li'), 1203 button_controls = panel.closest('.posttypediv, .taxonomydiv').find('.button-controls'), 1177 1204 $item; 1178 1205 1179 1206 if( ! $items.length ) { 1180 1207 $('.categorychecklist', panel).html( '<li><p>' + navMenuL10n.noResultsFound + '</p></li>' ); 1181 1208 $( '.spinner', panel ).removeClass( 'is-active' ); 1209 button_controls.hide(); 1182 1210 return; 1183 1211 } 1184 1212 … … 1206 1234 1207 1235 $('.categorychecklist', panel).html( $items ); 1208 1236 $( '.spinner', panel ).removeClass( 'is-active' ); 1237 button_controls.show(); 1209 1238 }, 1210 1239 1211 1240 removeMenuItem : function(el) {