[icinga-checkins] icinga.org: icingaweb2-module-director/master: js: scroll to highlighted object

git at icinga.org git at icinga.org
Sat Oct 29 01:31:05 CEST 2016


Module: icingaweb2-module-director
Branch: master
Commit: 0c0694605cc30206059f92cf40bdfaa2a0dbb160
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=0c0694605cc30206059f92cf40bdfaa2a0dbb160

Author: Thomas Gelf <thomas at gelf.net>
Date:   Thu Oct 27 23:40:34 2016 +0000

js: scroll to highlighted object

---

 public/css/module.less |    1 +
 public/js/module.js    |   12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/public/css/module.less b/public/css/module.less
index 6c81c6a..6018212 100644
--- a/public/css/module.less
+++ b/public/css/module.less
@@ -108,6 +108,7 @@ pre.generated-config {
 
 
   .highlight {
+    border-bottom: 1px dashed @gray-light;
     &::before {
       // icon: right-big
       font-family: 'ifont';
diff --git a/public/js/module.js b/public/js/module.js
index 0d5d2c2..5a458cd 100644
--- a/public/js/module.js
+++ b/public/js/module.js
@@ -239,6 +239,7 @@
             this.backupAllExtensibleSetDefaultValues($container);
             this.putFocusOnFirstObjectTypeElement($container);
             this.highlightFormErrors($container);
+            this.scrollHighlightIntoView($container);
             this.hideInactiveFormDescriptions($container);
             if (iid = $container.data('activeExtensibleEntry')) {
                 $('#' + iid).focus();
@@ -263,6 +264,17 @@
             }
         },
 
+        scrollHighlightIntoView: function ($container) {
+            $hl = $container.find('.highlight');
+            $content = $container.find('> div.content');
+
+            if ($hl.length) {
+              $container.animate({
+                scrollTop: $hl.offset().top - $content.offset().top
+              }, 700);
+            }
+        },
+
         backupAllExtensibleSetDefaultValues: function($container) {
             var self = this;
             $container.find('.extensible-set').each(function (idx, eSet) {



More information about the icinga-checkins mailing list