From fdcad4928ef62c5569ef7b746c8862d1f0b93eb3 Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Thu, 12 Feb 2015 15:06:37 +0100 Subject: [PATCH 01/12] Tinystatesummary: Adjust styles for summaries and headers refs #7976 --- .../list/components/hostssummary.phtml | 6 +-- .../list/components/servicesummary.phtml | 10 ++-- .../partials/host/servicesummary.phtml | 10 ++-- modules/monitoring/public/css/module.less | 14 +++--- public/css/icinga/defaults.less | 48 +++++++++++-------- 5 files changed, 43 insertions(+), 45 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/components/hostssummary.phtml b/modules/monitoring/application/views/scripts/list/components/hostssummary.phtml index 2e19ff352..64bd63165 100644 --- a/modules/monitoring/application/views/scripts/list/components/hostssummary.phtml +++ b/modules/monitoring/application/views/scripts/list/components/hostssummary.phtml @@ -4,9 +4,7 @@ use Icinga\Web\Url; $selfUrl = 'monitoring/list/hosts'; $currentUrl = Url::fromRequest()->getRelativeUrl(); - -?> -

compact ? ' data-base-target="col1"' : '' ?>> +?>
compact ? ' data-base-target="col1"' : '' ?>> qlink(sprintf($this->translate('%s hosts:'), $this->stats->hosts_total), $selfUrl); ?> stats->hosts_up): ?> @@ -81,4 +79,4 @@ $currentUrl = Url::fromRequest()->getRelativeUrl(); -

+ diff --git a/modules/monitoring/application/views/scripts/list/components/servicesummary.phtml b/modules/monitoring/application/views/scripts/list/components/servicesummary.phtml index c870b09b0..11d7b5d07 100644 --- a/modules/monitoring/application/views/scripts/list/components/servicesummary.phtml +++ b/modules/monitoring/application/views/scripts/list/components/servicesummary.phtml @@ -1,10 +1,10 @@ getRelativeUrl(); - -?>

compact ? ' data-base-target="col1"' : '' ?>> +?>
compact ? ' data-base-target="col1"' : '' ?>> qlink(sprintf($this->translate('%s services:'), $this->stats->services_total), $selfUrl) ?> stats->services_ok): ?> @@ -15,9 +15,7 @@ $currentUrl = Url::fromRequest()->getRelativeUrl(); array('title' => sprintf($this->translate('Services with state %s'), $this->translate('OK'))) ) ?> - 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $state) { $pre = 'services_' . $state; if ($this->stats->$pre) { @@ -70,7 +68,6 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $ echo "\n"; } } - ?> stats->services_pending): ?> qlink( @@ -81,5 +78,4 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $ ) ?> -

- + diff --git a/modules/monitoring/application/views/scripts/partials/host/servicesummary.phtml b/modules/monitoring/application/views/scripts/partials/host/servicesummary.phtml index 641dd026a..d45415c72 100644 --- a/modules/monitoring/application/views/scripts/partials/host/servicesummary.phtml +++ b/modules/monitoring/application/views/scripts/partials/host/servicesummary.phtml @@ -1,11 +1,10 @@ $this->object->host_name)); $currentUrl = Url::fromRequest()->without('limit')->getRelativeUrl(); - -?> -

compact ? ' data-base-target="col1"' : '' ?>> +?>
compact ? ' data-base-target="col1"' : '' ?>> stats->services_total > 0): ?> qlink(sprintf($this->translatePlural('%d configured service:', '%d configured services:', $object->stats->services_total), $object->stats->services_total), $selfUrl) ?> @@ -21,7 +20,6 @@ $currentUrl = Url::fromRequest()->without('limit')->getRelativeUrl(); ) ?> 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $state) { $pre = 'services_' . $state; if ($object->stats->$pre) { @@ -74,7 +72,6 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $ echo "\n"; } } - ?> stats->services_pending): ?> qlink( @@ -85,5 +82,4 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $ ) ?> -

- + diff --git a/modules/monitoring/public/css/module.less b/modules/monitoring/public/css/module.less index b0793ee8d..387df892b 100644 --- a/modules/monitoring/public/css/module.less +++ b/modules/monitoring/public/css/module.less @@ -91,19 +91,19 @@ div.contacts div.notification-periods { margin-top: 0.5em; } -h1.tinystatesummary .badges { +div.tinystatesummary { + .page-header(); + font-size: 1em; + .badges { display: inline-block; margin-bottom: 4px; margin-left: 1em; -} - -h1.tinystatesummary .state > a { + } + .state > a { color: white; font-size: 0.8em; padding: 2px 5px; -} - -h1.tinystatesummary .state.handled a { + } } /* State badges */ diff --git a/public/css/icinga/defaults.less b/public/css/icinga/defaults.less index d3c718db2..3dc277300 100644 --- a/public/css/icinga/defaults.less +++ b/public/css/icinga/defaults.less @@ -24,7 +24,20 @@ @colorPending: #77aaff; @colorInvalid: #999; +/* Mixins */ +.page-header(@borderSize: 2px; @fontSize: 2em; @textColor: @colorTextDarkDefault) { + font-size: @fontSize; + color: @textColor; + border-bottom: @borderSize solid @colorPetrol; + a { + text-decoration: none; + color: inherit; + &:hover { + text-decoration: underline; + } + } +} /*** Base rules ***/ * { @@ -76,9 +89,7 @@ a:hover { /* W3C Recommendation (except h4) */ h1 { - font-size: 2em; - color: @colorTextDefault; - border-bottom: 2px solid @colorPetrol; + .page-header(); } h2 { @@ -87,19 +98,16 @@ h2 { } h3 { - font-size: 1.17em; - color: @colorTextDefault; - border-bottom: 1px solid @colorPetrol; + .page-header(1px, 1.17em); } h4 { - font-size: 1em; - color: @colorPetrol; + font-size: 1em; + color: @colorPetrol; } h5 { - font-size: .83em; - border-bottom: 1px solid @colorPetrol; + .page-header(1px, .83em); } h6 { @@ -107,17 +115,19 @@ h6 { color: @colorPetrol; } -h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { - text-decoration: none; - color: inherit; -} +h1, h2, h3, h4, h5, h6 { + a { + text-decoration: none; + color: inherit; -h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover { - text-decoration: underline; + &:hover { + text-decoration: underline; + } + } } button { - font-family: inherit; + font-family: inherit; } #fontsize-calc { @@ -128,6 +138,4 @@ button { position: absolute; top: -2em; } -/*** END of Base rules */ - - +/*** END of Base rules */ \ No newline at end of file From f586714f022e62a73129b9689841ff34ba7b5df9 Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Thu, 12 Feb 2015 16:14:07 +0100 Subject: [PATCH 02/12] Skip Links: Select a more useful object Skip links can select a container and find a usable element inside. Adapt project jquery variable style. refs #7976 --- public/css/icinga/menu.less | 5 ++++- public/js/icinga/events.js | 21 ++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/public/css/icinga/menu.less b/public/css/icinga/menu.less index 873e6abb0..6653a250a 100644 --- a/public/css/icinga/menu.less +++ b/public/css/icinga/menu.less @@ -298,5 +298,8 @@ a:focus { } } .skip-links-inline { - margin-top: -3.5em; + margin-top: -4em; + ul > li > a { + width: 16em; + } } diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index cae835351..57c365649 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -335,14 +335,25 @@ }, handleAnchor: function(query) { - var element = $(query); - if (element.length > 0) { + var $element = $(query); + if ($element.length > 0) { + // Try to find the first header. It is more pleasant to users + // to select the header instead a container + var $header = $element.find(':header:first'); + if ($header.length > 0) { + $element = $header; + } else { + var $input = $element.find(':header:first'); + if ($input.length > 0) { + $element = $input + } + } // If we want to focus an element which has no tabindex // add one that we can focus is - if (element.prop('tabindex') < 0) { - element.prop('tabindex', 0); + if ($element.prop('tabindex') < 0) { + $element.prop('tabindex', 0); } - element.focus(); + $element.focus(); } }, From 513de11f20f993d4e434a73375ae015685980e3e Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Thu, 12 Feb 2015 16:43:08 +0100 Subject: [PATCH 03/12] Header: Application config and authentication refs #7976 --- .../views/scripts/config/application.phtml | 14 ++++++----- .../config/authentication/create.phtml | 20 ++++++++++------ .../config/authentication/modify.phtml | 10 ++++++-- .../config/authentication/remove.phtml | 10 ++++++-- .../config/authentication/reorder.phtml | 24 ++++++++++++++++++- 5 files changed, 60 insertions(+), 18 deletions(-) diff --git a/application/views/scripts/config/application.phtml b/application/views/scripts/config/application.phtml index 1ffd120b4..c34aa8349 100644 --- a/application/views/scripts/config/application.phtml +++ b/application/views/scripts/config/application.phtml @@ -1,11 +1,13 @@
-tabs->render($this); ?> + tabs->render($this); ?>
-messageBox)): ?> - messageBox->render() ?> - - -form ?> +

+ +

+ messageBox)): ?> + messageBox->render() ?> + + form ?>
diff --git a/application/views/scripts/config/authentication/create.phtml b/application/views/scripts/config/authentication/create.phtml index 427758292..5f840aea0 100644 --- a/application/views/scripts/config/authentication/create.phtml +++ b/application/views/scripts/config/authentication/create.phtml @@ -1,10 +1,16 @@
tabs->showOnlyCloseButton() ?>
-

translate('Create New Authentication Backend'); ?>

-

- translate( - 'Create a new backend for authenticating your users. This backend will be added at the end of your authentication order.' - ); ?> -

- \ No newline at end of file +
+

+ translate('Create New Authentication Backend'); ?> +

+

+ translate( + 'Create a new backend for authenticating your users. This backend will be added at the end of your authentication order.' + ); ?> +

+
+ +
+
diff --git a/application/views/scripts/config/authentication/modify.phtml b/application/views/scripts/config/authentication/modify.phtml index b01d7095a..5aeee7d12 100644 --- a/application/views/scripts/config/authentication/modify.phtml +++ b/application/views/scripts/config/authentication/modify.phtml @@ -1,5 +1,11 @@
tabs->showOnlyCloseButton() ?>
-

translate('Edit Backend'); ?>

- \ No newline at end of file +
+

+ translate('Edit Backend'); ?> +

+
+ +
+
diff --git a/application/views/scripts/config/authentication/remove.phtml b/application/views/scripts/config/authentication/remove.phtml index 424aff9a0..cdd615ac7 100644 --- a/application/views/scripts/config/authentication/remove.phtml +++ b/application/views/scripts/config/authentication/remove.phtml @@ -1,5 +1,11 @@
tabs->showOnlyCloseButton() ?>
-

translate('Remove Backend'); ?>

- \ No newline at end of file +
+

+ translate('Remove Backend'); ?> +

+
+ +
+
\ No newline at end of file diff --git a/application/views/scripts/config/authentication/reorder.phtml b/application/views/scripts/config/authentication/reorder.phtml index 83f285285..a31062025 100644 --- a/application/views/scripts/config/authentication/reorder.phtml +++ b/application/views/scripts/config/authentication/reorder.phtml @@ -2,10 +2,32 @@ From 069e86c2fd1ea692a3af513ad454c097a49e428e Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Thu, 12 Feb 2015 17:10:38 +0100 Subject: [PATCH 04/12] Header: Add header and skip links to resource configuration refs #7976 --- .../views/scripts/config/resource.phtml | 26 ++++++++++++++++--- .../scripts/config/resource/create.phtml | 12 ++++++--- .../scripts/config/resource/modify.phtml | 10 +++++-- .../scripts/config/resource/remove.phtml | 10 +++++-- 4 files changed, 48 insertions(+), 10 deletions(-) diff --git a/application/views/scripts/config/resource.phtml b/application/views/scripts/config/resource.phtml index 384993f52..013dfed19 100644 --- a/application/views/scripts/config/resource.phtml +++ b/application/views/scripts/config/resource.phtml @@ -2,18 +2,38 @@
+

+ +

+ +

+ +

icon('plus', null, array('aria-hidden' => 'true')); ?> translate('Create A New Resource'); ?>

- +

+ +

+
-resources as $name): ?> + resources as $name): ?> - +
translate('Resource'); ?> translate('Remove'); ?>
@@ -26,7 +46,7 @@
diff --git a/application/views/scripts/config/resource/create.phtml b/application/views/scripts/config/resource/create.phtml index 0750a5aa9..c70bd4779 100644 --- a/application/views/scripts/config/resource/create.phtml +++ b/application/views/scripts/config/resource/create.phtml @@ -1,6 +1,12 @@
tabs->showOnlyCloseButton() ?>
-

translate('Create A New Resource'); ?>

-

translate('Resources are entities that provide data to Icinga Web 2.'); ?>

- \ No newline at end of file +
+

+ translate('Create A New Resource'); ?> +

+

translate('Resources are entities that provide data to Icinga Web 2.'); ?>

+
+ +
+
\ No newline at end of file diff --git a/application/views/scripts/config/resource/modify.phtml b/application/views/scripts/config/resource/modify.phtml index d355aeb4c..48255261b 100644 --- a/application/views/scripts/config/resource/modify.phtml +++ b/application/views/scripts/config/resource/modify.phtml @@ -1,5 +1,11 @@
tabs->showOnlyCloseButton() ?>
-

translate('Edit Existing Resource'); ?>

- \ No newline at end of file +
+

+ translate('Edit Existing Resource'); ?> +

+
+ +
+
\ No newline at end of file diff --git a/application/views/scripts/config/resource/remove.phtml b/application/views/scripts/config/resource/remove.phtml index 14829ab40..ad5ed59cb 100644 --- a/application/views/scripts/config/resource/remove.phtml +++ b/application/views/scripts/config/resource/remove.phtml @@ -1,5 +1,11 @@
tabs->showOnlyCloseButton() ?>
-

translate('Remove Existing Resource'); ?>

- \ No newline at end of file +
+

+ translate('Remove Existing Resource'); ?> +

+
+ +
+
\ No newline at end of file From 9bf8488f68aacbe8ad5937b002fff97ec79c33b5 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 13 Feb 2015 09:59:34 +0100 Subject: [PATCH 05/12] js: Remove out-commented function hrefIsHashtag from events.js --- public/js/icinga/events.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index 57c365649..528899dcb 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -517,14 +517,6 @@ return $target; }, - /* - hrefIsHashtag: function(href) { - // WARNING: IE gives full URL :( - // Also it doesn't support negativ indexes in substr - return href.substr(href.length - 1, 1) == '#'; - }, - */ - unbindGlobalHandlers: function () { $.each(self.icinga.behaviors, function (name, behavior) { behavior.unbind($(document)); From cd11cf3469f4317e6b18948b414c0c9b9bb23637 Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Fri, 13 Feb 2015 11:45:20 +0100 Subject: [PATCH 06/12] Fix close button: Test the anchor if it belongs to us --- public/js/icinga/events.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index 528899dcb..3fbb9cf79 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -415,7 +415,8 @@ event.preventDefault(); // This is an anchor only - if (href.substr(0, 1) === '#' && href.substr(1, 1) !== '!') { + if (href.substr(0, 1) === '#' && href.length > 1 + && href.substr(1, 1) !== '!') { self.handleAnchor(href); return; } From 97f5018247027fd0c3894b7114d3f9e251774200 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 16 Feb 2015 10:23:54 +0100 Subject: [PATCH 07/12] WCAG/1.1.1: Fix example for accessible icon fonts to work with NVDA too refs #8358 --- doc/accessibility/ifont.html | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/doc/accessibility/ifont.html b/doc/accessibility/ifont.html index 481cbff71..32f122127 100644 --- a/doc/accessibility/ifont.html +++ b/doc/accessibility/ifont.html @@ -10,22 +10,9 @@ .icon-star:before { content: "★"; } - .sr-only { - border: 0; - clip: rect(0 0 0 0); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; - } - - - Top rated article - + - + \ No newline at end of file From 243bc6ec0cdcddc6363533a28d2d62055e32740f Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 16 Feb 2015 10:26:03 +0100 Subject: [PATCH 08/12] Make the view helpers qlink, img and icon handle aria-tags automatically refs #8358 refs #8360 --- library/Icinga/Web/View/helpers/url.php | 63 +++++++++++++++---------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/library/Icinga/Web/View/helpers/url.php b/library/Icinga/Web/View/helpers/url.php index 1f1450b5e..9fa5d4a69 100644 --- a/library/Icinga/Web/View/helpers/url.php +++ b/library/Icinga/Web/View/helpers/url.php @@ -27,55 +27,68 @@ $this->addHelperFunction('url', function ($path = null, $params = null) { return $url; }); +$this->addHelperFunction('qlink', function ($title, $url, $params = null, $properties = array(), $escape = true) use ($view) { + if (array_key_exists('title', $properties) && !array_key_exists('aria-label', $properties)) { + $properties['aria-label'] = $properties['title']; + } -$this->addHelperFunction('qlink', function ($title, $url, $params = null, $properties = array()) use ($view) { return sprintf( '%s', $view->url($url, $params), $view->propertiesToString($properties), - $view->escape($title) + $escape ? $view->escape($title) : $title ); }); -$this->addHelperFunction('img', function ($url, array $properties = array()) use ($view) { +$this->addHelperFunction('img', function ($url, $params = null, array $properties = array()) use ($view) { if (! array_key_exists('alt', $properties)) { $properties['alt'] = ''; } + if (array_key_exists('title', $properties)) { + if (! array_key_exists('aria-label', $properties)) { + $properties['aria-label'] = $properties['title']; + } + } elseif (! array_key_exists('aria-hidden', $properties)) { + $properties['aria-hidden'] = 'true'; + } + return sprintf( '', - $view->url($url), + $view->url($url, $params), $view->propertiesToString($properties) ); }); $this->addHelperFunction('icon', function ($img, $title = null, array $properties = array()) use ($view) { - $isClass = strpos($img, '.') === false; - $class = null; - - if ($isClass) { - $class = 'icon-' . $img; - } else { - $class = 'icon'; - } - if ($title !== null) { - $properties['alt'] = $title; - $properties['title'] = $title; - } - - if ($class !== null) { - if (isset($props['class'])) { - $properties['class'] .= ' ' . $class; + if (strpos($img, '.') !== false) { + if (array_key_exists('class', $properties)) { + $properties['class'] .= ' icon'; } else { - $properties['class'] = $class; + $properties['class'] = 'icon'; } - } - if ($isClass) { - return sprintf('', $view->propertiesToString($properties)); - } else { return $view->img('img/icons/' . $img, $properties); } + + if ($title !== null) { + $properties['role'] = 'img'; + $properties['title'] = $title; + + if (! array_key_exists('aria-label', $properties)) { + $properties['aria-label'] = $title; + } + } elseif (! array_key_exists('aria-hidden', $properties)) { + $properties['aria-hidden'] = 'true'; + } + + if (isset($properties['class'])) { + $properties['class'] .= ' icon-' . $img; + } else { + $properties['class'] = 'icon-' . $img; + } + + return sprintf('', $view->propertiesToString($properties)); }); $this->addHelperFunction('propertiesToString', function ($properties) use ($view) { From 5321c2f9e5bd7ae23a5b5ea5d8d1492f99662c63 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 16 Feb 2015 10:52:42 +0100 Subject: [PATCH 09/12] Mute icons properly using the new automatic mechanisms of our view helpers refs #8360 --- application/layouts/scripts/pdf.phtml | 2 +- .../views/scripts/authentication/login.phtml | 4 ++-- .../scripts/config/authentication/reorder.phtml | 2 +- application/views/scripts/config/resource.phtml | 2 +- .../Icinga/Web/Form/Decorator/NoScriptApply.php | 2 +- library/Icinga/Web/Widget/FilterEditor.php | 2 +- library/Icinga/Web/Widget/Tab.php | 4 ++-- library/Icinga/Web/Widget/Tabs.php | 2 +- .../views/scripts/alertsummary/index.phtml | 6 +++--- .../application/views/scripts/config/index.phtml | 4 ++-- .../application/views/scripts/hosts/show.phtml | 14 +++++++------- .../views/scripts/list/contactgroups.phtml | 2 +- .../application/views/scripts/list/contacts.phtml | 2 +- .../partials/command/objects-command-form.phtml | 4 ++-- .../application/views/scripts/services/show.phtml | 14 +++++++------- .../scripts/show/components/acknowledgement.phtml | 2 +- .../scripts/show/components/checkstatistics.phtml | 2 +- .../views/scripts/show/components/command.phtml | 2 +- .../views/scripts/show/components/comments.phtml | 2 +- .../views/scripts/show/components/contacts.phtml | 4 ++-- .../views/scripts/show/components/downtime.phtml | 2 +- .../views/scripts/show/components/hostgroups.phtml | 2 +- .../scripts/show/components/servicegroups.phtml | 2 +- .../setup/application/forms/AuthenticationPage.php | 4 ++-- 24 files changed, 44 insertions(+), 44 deletions(-) diff --git a/application/layouts/scripts/pdf.phtml b/application/layouts/scripts/pdf.phtml index 38c9bdc2c..c5b28ecbf 100644 --- a/application/layouts/scripts/pdf.phtml +++ b/application/layouts/scripts/pdf.phtml @@ -31,7 +31,7 @@ if ( isset($pdf) ) } -img('img/logo_icinga_big_dark.png', array('align' => 'right', 'width' => '75')) ?> +img('img/logo_icinga_big_dark.png', null, array('align' => 'right', 'width' => '75')) ?>