From 71864056bc3f60ca34ffd030308ddeb71c624b9e Mon Sep 17 00:00:00 2001 From: yuri Date: Thu, 2 Aug 2018 15:05:00 +0300 Subject: [PATCH] navbar panel height --- client/src/views/global-search/panel.js | 24 ++++++++++++++++++------ client/src/views/notification/panel.js | 14 +++++++++++--- frontend/less/espo/variables.less | 2 +- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/client/src/views/global-search/panel.js b/client/src/views/global-search/panel.js index 3f517becbf..22c1bcb48b 100644 --- a/client/src/views/global-search/panel.js +++ b/client/src/views/global-search/panel.js @@ -32,8 +32,14 @@ Espo.define('views/global-search/panel', 'view', function (Dep) { template: 'global-search/panel', - afterRender: function () { + setup: function () { + this.maxSize = this.getConfig().get('globalSearchMaxSize') || 10; + this.navbarPanelHeightSpace = this.getThemeManager().getParam('navbarPanelHeightSpace') || 100; + this.navbarPanelBodyMaxHeight = this.getThemeManager().getParam('navbarPanelBodyMaxHeight') || 600; + }, + + afterRender: function () { this.listenToOnce(this.collection, 'sync', function () { this.createView('list', 'views/record/list-expanded', { el: this.options.el + ' .list-container', @@ -46,7 +52,7 @@ Espo.define('views/global-search/panel', 'view', function (Dep) { view: 'views/global-search/name-field', params: { containerEl: this.options.el - }, + } } ] ], @@ -59,12 +65,18 @@ Espo.define('views/global-search/panel', 'view', function (Dep) { }, function (view) { view.render(); }); - }.bind(this)); - this.collection.maxSize = this.getConfig().get('recordsPerPageSmall') || 10; + }, this); + + this.collection.reset(); + this.collection.maxSize = this.maxSize; this.collection.fetch(); + + var windowHeight = $(window).height(); + if (windowHeight - this.navbarPanelBodyMaxHeight < this.navbarPanelHeightSpace) { + var maxHeight = windowHeight - this.navbarPanelHeightSpace; + this.$el.find('> .panel > .panel-body').css('maxHeight', maxHeight + 'px'); + } } }); - }); - diff --git a/client/src/views/notification/panel.js b/client/src/views/notification/panel.js index be815655be..24c6c18d7e 100644 --- a/client/src/views/notification/panel.js +++ b/client/src/views/notification/panel.js @@ -51,9 +51,12 @@ Espo.define('views/notification/panel', 'view', function (Dep) { this.wait(true); this.getCollectionFactory().create('Notification', function (collection) { this.collection = collection; - collection.maxSize = 5; + collection.maxSize = this.getConfig().get('notificationsMaxSize') || 5; this.wait(false); }, this); + + this.navbarPanelHeightSpace = this.getThemeManager().getParam('navbarPanelHeightSpace') || 100; + this.navbarPanelBodyMaxHeight = this.getThemeManager().getParam('navbarPanelBodyMaxHeight') || 600; }, afterRender: function () { @@ -71,7 +74,7 @@ Espo.define('views/notification/panel', 'view', function (Dep) { view: 'views/notification/fields/container', params: { containerEl: this.options.el - }, + } } ] ], @@ -86,8 +89,13 @@ Espo.define('views/notification/panel', 'view', function (Dep) { }); }, this); this.collection.fetch(); + + var windowHeight = $(window).height(); + if (windowHeight - this.navbarPanelBodyMaxHeight < this.navbarPanelHeightSpace) { + var maxHeight = windowHeight - this.navbarPanelHeightSpace; + this.$el.find('> .panel > .panel-body').css('maxHeight', maxHeight + 'px'); + } } }); - }); diff --git a/frontend/less/espo/variables.less b/frontend/less/espo/variables.less index 464766efe7..f3683610ce 100644 --- a/frontend/less/espo/variables.less +++ b/frontend/less/espo/variables.less @@ -137,7 +137,7 @@ @panel-border-width: 2px; -@navbar-panel-body-max-height: 350px; +@navbar-panel-body-max-height: 600px; @form-group-margin-bottom: 12px;