From 6e1ba30acc8153de90e641b82db99754ccd80932 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 3 Jun 2015 14:56:23 +0200 Subject: [PATCH] Styling: re-organize and style comments --- .../scripts/show/components/comments.phtml | 146 +++++++++++------- .../scripts/show/components/contacts.phtml | 6 +- modules/monitoring/public/css/module.less | 79 ++++++++++ 3 files changed, 168 insertions(+), 63 deletions(-) diff --git a/modules/monitoring/application/views/scripts/show/components/comments.phtml b/modules/monitoring/application/views/scripts/show/components/comments.phtml index c4b947e3c..3d806c577 100644 --- a/modules/monitoring/application/views/scripts/show/components/comments.phtml +++ b/modules/monitoring/application/views/scripts/show/components/comments.phtml @@ -1,62 +1,90 @@ - - translate('Comments'); ?> - - hasPermission('monitoring/command/comment/add')) { - /** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */ - if ($object->getType() === $object::TYPE_HOST) { - echo $this->qlink( - $this->translate('Add comment'), - 'monitoring/host/add-comment', - array('host' => $object->getName()), - array( - 'icon' => 'comment', - 'data-base-target' => '_self', - 'title' => $this->translate('Add a new comment to this host') - ) - ); - } else { - echo $this->qlink( - $this->translate('Add comment'), - 'monitoring/service/add-comment', - array('host' => $object->getHost()->getName(), 'service' => $object->getName()), - array( - 'icon' => 'comment', - 'data-base-target' => '_self', - 'title' => $this->translate('Add a new comment to this service') - ) - ); - } - } else { - echo '-'; - } ?> - - - comments as $comment) { - // Ticket hook sample - $commentText = $this->tickets ? preg_replace_callback( - $this->tickets->getPattern(), - array($this->tickets, 'createLink'), - $this->escape($comment->comment) - ) : $this->escape($comment->comment); +$addLink = ''; - ?> - - escape($comment->author); ?> (timeAgo($comment->timestamp); ?>) - - populate( - array( - 'comment_id' => $comment->id, - 'comment_is_service' => isset($comment->service_description) - ) - ); - echo $delCommentForm; - } ?> - (translate('Comment'); ?>): ', $commentText); ?> - - - +if ($this->hasPermission('monitoring/command/comment/add')) { + /** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */ + if ($object->getType() === $object::TYPE_HOST) { + $addLink = $this->qlink( + $this->translate('Add comment'), + 'monitoring/host/add-comment', + array('host' => $object->getName()), + array( + 'icon' => 'comment', + 'data-base-target' => '_self', + 'title' => $this->translate('Add a new comment to this host') + ) + ); + } else { + $addLink = $this->qlink( + $this->translate('Add comment'), + 'monitoring/service/add-comment', + array('host' => $object->getHost()->getName(), 'service' => $object->getName()), + array( + 'icon' => 'comment', + 'data-base-target' => '_self', + 'title' => $this->translate('Add a new comment to this service') + ) + ); + } +} + +if (empty($object->comments) && ! $addLink) { + return; +} + +?> + + translate('Comments'); + + if (! empty($object->comments) && $addLink) { + echo '
' . $addLink; + } + + ?> + +comments)): ?> + + + + + + + diff --git a/modules/monitoring/application/views/scripts/show/components/contacts.phtml b/modules/monitoring/application/views/scripts/show/components/contacts.phtml index f445e10d1..641efb597 100644 --- a/modules/monitoring/application/views/scripts/show/components/contacts.phtml +++ b/modules/monitoring/application/views/scripts/show/components/contacts.phtml @@ -13,9 +13,8 @@ if (! empty($object->contacts)) { } printf( - "%s%s %s\n", + "%s%s\n", $this->translate('Contacts'), - $this->icon('user'), implode(', ', $list) ); @@ -33,9 +32,8 @@ if (! empty($object->contactgroups)) { } printf( - "%s%s %s\n", + "%s%s\n", $this->translate('Contactgroups'), - $this->icon('users'), implode(', ', $list) ); diff --git a/modules/monitoring/public/css/module.less b/modules/monitoring/public/css/module.less index c64f24b84..3e2d41bbf 100644 --- a/modules/monitoring/public/css/module.less +++ b/modules/monitoring/public/css/module.less @@ -189,6 +189,33 @@ table.avp form.object-features div.header h4 { margin: 0; } +table.avp { + th { + font-weight: normal; + font-size: 0.9em; + padding-top: 0.2em; + padding-bottom: 0.3em; + } + + td { + color: #666; + padding-bottom: 0.3em; + th, td { + padding: 0; + } + } + + a, button.link-like { + color: @colorPetrol; + } + + .go-ahead { + a, button.link-like { + color: #222; + } + } +} + table.avp .customvar ul { list-style-type: none; margin: 0; @@ -242,3 +269,55 @@ td.state { text-transform: capitalize; } } + +.inline-comments { + padding: 0; + margin: 0; + + .time-ago { + font-style: italic; + color: #919191; + } + + li { + list-style-type: none; + margin-bottom: 8px; + } + + h4 { + border-bottom: 1px solid gray; + font-weight: normal; + font-size: inherit; + color: inherit; + margin: 0; + } + + h4 .author { + font-weight: bold; + } + + h4 form { + display: none; + } + + h4 form { + float: right; + } + + li:hover h4 { + background: #F9F9F9; + position: relative; + + form { + display: inline; + } + } + + p { + margin: 0; + + a { + color: #222; + } + } +}