Skip to content

Apache Lucene open-source search software

SOLR-8210 Scroll menu when browser window is small

Upayavirae777e4adb71b
diff --git a/solr/webapp/web/index.html b/solr/webapp/web/index.html
index d64002eb733..3378929c397 100644
--- a/solr/webapp/web/index.html
+++ b/solr/webapp/web/index.html
@@ -80,7 +80,7 @@ limitations under the License.
</head>
<body ng-controller="MainController">
- <div id="wrapper">
+ <div id="wrapper" scrollable-when-small>
<div id="header">
diff --git a/solr/webapp/web/js/angular/app.js b/solr/webapp/web/js/angular/app.js
index 3986a74d1d9..d888cc9e14c 100644
--- a/solr/webapp/web/js/angular/app.js
+++ b/solr/webapp/web/js/angular/app.js
@@ -156,6 +156,20 @@ solrAdminApp.config([
}
};
})
+.directive('scrollableWhenSmall', function($window) {
+ return {
+ link: function(scope, element, attrs) {
+ var w = angular.element($window);
+
+ var checkFixedMenu = function() {
+ var shouldScroll = w.height() < (element.height() + $('#header').height() + 40);
+ element.toggleClass( 'scroll', shouldScroll);
+ };
+ w.bind('resize', checkFixedMenu);
+ w.bind('load', checkFixedMenu);
+ }
+ }
+})
.filter('readableSeconds', function() {
return function(input) {
seconds = parseInt(input||0, 10);
@@ -680,8 +694,6 @@ var solr_admin = function( app_config )
// load cores (indexInfo = false
success : function( response )
{
- check_fixed_menu();
- $( window ).resize( check_fixed_menu );
var system_url = config.solr_path + '/admin/info/system?wt=json';
$.ajax
@@ -762,9 +774,4 @@ var solr_admin = function( app_config )
'</code></pre></div>'
);
};
-
- check_fixed_menu = function check_fixed_menu()
- {
- $( '#wrapper' ).toggleClass( 'scroll', $( window ).height() < $( '#menu-wrapper' ).height() + $( '#header' ).height() + 40 );
- }
*/