From b333439b2ee3ae5ca856127bed23a9520a5e295b Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 30 Sep 2015 22:44:52 +0200 Subject: [PATCH] monitoring: Add spinner to inline command forms refs #5543 --- .../Command/Object/CheckNowCommandForm.php | 18 +++--- .../Object/DeleteCommentCommandForm.php | 13 +++-- .../Object/DeleteDowntimeCommandForm.php | 55 ++++++++++--------- .../RemoveAcknowledgementCommandForm.php | 29 ++++++++-- 4 files changed, 70 insertions(+), 45 deletions(-) diff --git a/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php b/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php index 5a38c02b0f..dced177e45 100644 --- a/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php @@ -18,7 +18,7 @@ class CheckNowCommandForm extends ObjectsCommandForm */ public function init() { - $this->setAttrib('class', 'link'); + $this->setAttrib('class', 'inline'); } /** @@ -32,15 +32,17 @@ public function addSubmitButton() 'button', 'btn_submit', array( + 'class' => 'link-button spinner', + 'decorators' => array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'div', 'class' => 'control-group form-controls')) + ), + 'escape' => false, 'ignore' => true, + 'label' => $this->getView()->icon('reschedule') . $this->translate('Check now'), 'type' => 'submit', - 'value' => $this->translate('Check now'), - 'label' => '' - . $this->translate('Check now'), - 'decorators' => array('ViewHelper'), - 'escape' => false, - 'class' => 'action-link link', - 'title' => $this->translate('Schedule the next active check to run immediately') + 'title' => $this->translate('Schedule the next active check to run immediately'), + 'value' => $this->translate('Check now') ) ) )); diff --git a/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php b/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php index f8ad101ae9..47ac8d4d0d 100644 --- a/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php @@ -17,7 +17,7 @@ class DeleteCommentCommandForm extends CommandForm */ public function init() { - $this->setAttrib('class', 'link'); + $this->setAttrib('class', 'inline'); } /** @@ -65,13 +65,16 @@ public function addSubmitButton() 'button', 'btn_submit', array( - 'ignore' => true, + 'class' => 'link-button spinner', + 'decorators' => array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'div', 'class' => 'control-group form-controls')) + ), 'escape' => false, - 'type' => 'submit', - 'class' => 'action-link link', + 'ignore' => true, 'label' => $this->getView()->icon('cancel'), 'title' => $this->translate('Delete this comment'), - 'decorators' => array('ViewHelper') + 'type' => 'submit' ) ); return $this; diff --git a/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php b/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php index fd14172241..8da80e87e1 100644 --- a/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php @@ -20,6 +20,30 @@ public function init() $this->setAttrib('class', 'inline'); } + /** + * {@inheritdoc} + */ + public function addSubmitButton() + { + $this->addElement( + 'button', + 'btn_submit', + array( + 'class' => 'link-button spinner', + 'decorators' => array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'div', 'class' => 'control-group form-controls')) + ), + 'escape' => false, + 'ignore' => true, + 'label' => $this->getView()->icon('cancel'), + 'title' => $this->translate('Delete this downtime'), + 'type' => 'submit' + ) + ); + return $this; + } + /** * {@inheritdoc} */ @@ -31,17 +55,17 @@ public function createElements(array $formData = array()) 'hidden', 'downtime_id', array( - 'required' => true, - 'validators' => array('NotEmpty'), - 'decorators' => array('ViewHelper') + 'decorators' => array('ViewHelper'), + 'required' => true, + 'validators' => array('NotEmpty') ) ), array( 'hidden', 'downtime_is_service', array( - 'filters' => array('Boolean'), - 'decorators' => array('ViewHelper') + 'decorators' => array('ViewHelper'), + 'filters' => array('Boolean') ) ), array( @@ -56,27 +80,6 @@ public function createElements(array $formData = array()) return $this; } - /** - * {@inheritdoc} - */ - public function addSubmitButton() - { - $this->addElement( - 'button', - 'btn_submit', - array( - 'ignore' => true, - 'escape' => false, - 'type' => 'submit', - 'class' => 'action-link link', - 'label' => $this->getView()->icon('trash'), - 'title' => $this->translate('Delete this downtime'), - 'decorators' => array('ViewHelper') - ) - ); - return $this; - } - /** * {@inheritdoc} */ diff --git a/modules/monitoring/application/forms/Command/Object/RemoveAcknowledgementCommandForm.php b/modules/monitoring/application/forms/Command/Object/RemoveAcknowledgementCommandForm.php index c30adf9d0c..8baf493163 100644 --- a/modules/monitoring/application/forms/Command/Object/RemoveAcknowledgementCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/RemoveAcknowledgementCommandForm.php @@ -17,18 +17,35 @@ class RemoveAcknowledgementCommandForm extends ObjectsCommandForm */ public function init() { - $this->setAttrib('class', 'inline link-like'); + $this->setAttrib('class', 'inline'); } /** - * (non-PHPDoc) - * @see \Icinga\Web\Form::getSubmitLabel() For the method documentation. + * {@inheritdoc} */ - public function getSubmitLabel() + public function addSubmitButton() { - return mtp( - 'monitoring', 'Remove problem acknowledgement', 'Remove problem acknowledgements', count($this->objects) + $this->addElement( + 'button', + 'btn_submit', + array( + 'class' => 'link-button spinner', + 'decorators' => array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'div', 'class' => 'control-group form-controls')) + ), + 'escape' => false, + 'ignore' => true, + 'label' => $this->getView()->icon('cancel'), + 'title' => $this->translatePlural( + 'Remove problem acknowledgement', + 'Remove problem acknowledgements', + count($this->objects) + ), + 'type' => 'submit' + ) ); + return $this; } /**