diff options
Diffstat (limited to 'app/Helper')
-rw-r--r-- | app/Helper/ModalHelper.php | 73 | ||||
-rw-r--r-- | app/Helper/TaskHelper.php | 31 | ||||
-rw-r--r-- | app/Helper/UrlHelper.php | 4 |
3 files changed, 94 insertions, 14 deletions
diff --git a/app/Helper/ModalHelper.php b/app/Helper/ModalHelper.php new file mode 100644 index 00000000..e6037a8c --- /dev/null +++ b/app/Helper/ModalHelper.php @@ -0,0 +1,73 @@ +<?php + +namespace Kanboard\Helper; + +use Kanboard\Core\Base; + +/** + * Class ModalHelper + * + * @package Kanboard\Helper + * @author Frederic Guillot + */ +class ModalHelper extends Base +{ + public function submitButtons(array $params = array()) + { + return $this->helper->app->component('submit-buttons', array( + 'submitLabel' => isset($params['submitLabel']) ? $params['submitLabel'] : t('Save'), + 'orLabel' => t('or'), + 'cancelLabel' => t('cancel'), + 'color' => isset($params['color']) ? $params['color'] : 'blue', + 'tabindex' => isset($params['tabindex']) ? $params['tabindex'] : null, + 'disabled' => isset($params['disabled']) ? true : false, + )); + } + + public function confirmButtons($controller, $action, array $params = array(), $submitLabel = '', $tabindex = null) + { + return $this->helper->app->component('confirm-buttons', array( + 'url' => $this->helper->url->href($controller, $action, $params, true), + 'submitLabel' => $submitLabel ?: t('Yes'), + 'orLabel' => t('or'), + 'cancelLabel' => t('cancel'), + 'tabindex' => $tabindex, + )); + } + + public function largeIcon($icon, $label, $controller, $action, array $params = array()) + { + $html = '<i class="fa fa-'.$icon.' fa-fw js-modal-large" aria-hidden="true"></i>'; + return $this->helper->url->link($html, $controller, $action, $params, false, 'js-modal-large', $label); + } + + public function large($icon, $label, $controller, $action, array $params = array()) + { + $html = '<i class="fa fa-'.$icon.' fa-fw js-modal-large" aria-hidden="true"></i> '.$label; + return $this->helper->url->link($html, $controller, $action, $params, false, 'js-modal-large'); + } + + public function medium($icon, $label, $controller, $action, array $params = array()) + { + $html = '<i class="fa fa-'.$icon.' fa-fw js-modal-medium" aria-hidden="true"></i> '.$label; + return $this->helper->url->link($html, $controller, $action, $params, false, 'js-modal-medium'); + } + + public function small($icon, $label, $controller, $action, array $params = array()) + { + $html = '<i class="fa fa-'.$icon.' fa-fw js-modal-small" aria-hidden="true"></i> '.$label; + return $this->helper->url->link($html, $controller, $action, $params, false, 'js-modal-small'); + } + + public function mediumButton($icon, $label, $controller, $action, array $params = array()) + { + $html = '<i class="fa fa-'.$icon.' fa-fw js-modal-medium" aria-hidden="true"></i> '.$label; + return $this->helper->url->link($html, $controller, $action, $params, false, 'js-modal-medium btn'); + } + + public function confirm($icon, $label, $controller, $action, array $params = array()) + { + $html = '<i class="fa fa-'.$icon.' fa-fw js-modal-confirm" aria-hidden="true"></i> '.$label; + return $this->helper->url->link($html, $controller, $action, $params, false, 'js-modal-confirm'); + } +} diff --git a/app/Helper/TaskHelper.php b/app/Helper/TaskHelper.php index 92a9228c..a13ad18b 100644 --- a/app/Helper/TaskHelper.php +++ b/app/Helper/TaskHelper.php @@ -42,16 +42,23 @@ class TaskHelper extends Base public function selectTitle(array $values, array $errors) { - $html = $this->helper->form->label(t('Title'), 'title'); - $html .= $this->helper->form->text('title', $values, $errors, array('autofocus', 'required', 'maxlength="200"', 'tabindex="1"'), 'form-input-large'); - return $html; + return $this->helper->form->text( + 'title', + $values, + $errors, + array( + 'autofocus', + 'required', + 'maxlength="200"', + 'tabindex="1"', + 'placeholder="'.t('Title').'"' + ) + ); } public function selectDescription(array $values, array $errors) { - $html = $this->helper->form->label(t('Description'), 'description'); - $html .= $this->helper->form->textEditor('description', $values, $errors, array('tabindex' => 2)); - return $html; + return $this->helper->form->textEditor('description', $values, $errors, array('tabindex' => 2)); } public function selectTags(array $project, array $tags = array()) @@ -152,7 +159,7 @@ class TaskHelper extends Base public function selectScore(array $values, array $errors = array(), array $attributes = array()) { - $attributes = array_merge(array('tabindex="8"'), $attributes); + $attributes = array_merge(array('tabindex="13"'), $attributes); $html = $this->helper->form->label(t('Complexity'), 'score'); $html .= $this->helper->form->number('score', $values, $errors, $attributes); @@ -162,7 +169,7 @@ class TaskHelper extends Base public function selectReference(array $values, array $errors = array(), array $attributes = array()) { - $attributes = array_merge(array('tabindex="9"'), $attributes); + $attributes = array_merge(array('tabindex="14"'), $attributes); $html = $this->helper->form->label(t('Reference'), 'reference'); $html .= $this->helper->form->text('reference', $values, $errors, $attributes, 'form-input-small'); @@ -172,7 +179,7 @@ class TaskHelper extends Base public function selectTimeEstimated(array $values, array $errors = array(), array $attributes = array()) { - $attributes = array_merge(array('tabindex="10"'), $attributes); + $attributes = array_merge(array('tabindex="11"'), $attributes); $html = $this->helper->form->label(t('Original estimate'), 'time_estimated'); $html .= $this->helper->form->numeric('time_estimated', $values, $errors, $attributes); @@ -183,7 +190,7 @@ class TaskHelper extends Base public function selectTimeSpent(array $values, array $errors = array(), array $attributes = array()) { - $attributes = array_merge(array('tabindex="11"'), $attributes); + $attributes = array_merge(array('tabindex="12"'), $attributes); $html = $this->helper->form->label(t('Time spent'), 'time_spent'); $html .= $this->helper->form->numeric('time_spent', $values, $errors, $attributes); @@ -194,13 +201,13 @@ class TaskHelper extends Base public function selectStartDate(array $values, array $errors = array(), array $attributes = array()) { - $attributes = array_merge(array('tabindex="12"'), $attributes); + $attributes = array_merge(array('tabindex="10"'), $attributes); return $this->helper->form->datetime(t('Start Date'), 'date_started', $values, $errors, $attributes); } public function selectDueDate(array $values, array $errors = array(), array $attributes = array()) { - $attributes = array_merge(array('tabindex="13"'), $attributes); + $attributes = array_merge(array('tabindex="9"'), $attributes); return $this->helper->form->date(t('Due Date'), 'date_due', $values, $errors, $attributes); } diff --git a/app/Helper/UrlHelper.php b/app/Helper/UrlHelper.php index 93177ed5..bfcf07e6 100644 --- a/app/Helper/UrlHelper.php +++ b/app/Helper/UrlHelper.php @@ -42,9 +42,9 @@ class UrlHelper extends Base */ public function button($icon, $label, $controller, $action, array $params = array(), $class = '') { - $icon = '<i class="fa '.$icon.' fa-fw"></i> '; + $html = '<i class="fa fa-'.$icon.' fa-fw"></i> '.$label; $class = 'btn '.$class; - return $this->link($icon.$label, $controller, $action, $params, false, $class); + return $this->link($html, $controller, $action, $params, false, $class); } /** |