diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-11-27 18:33:00 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-11-27 18:33:00 -0500 |
commit | de2501f070a7bf41b766ee1139d1322213e387e9 (patch) | |
tree | d6a2c53ce9c70e40d6e412b72e5eeb04e3a0e2c4 /app | |
parent | de1b9416d2c359e57f386760cfa29f2a12bf5b51 (diff) |
Improve tabindex for project settings forms
Diffstat (limited to 'app')
-rw-r--r-- | app/Helper/FormHelper.php | 32 | ||||
-rw-r--r-- | app/Template/category/edit.php | 4 | ||||
-rw-r--r-- | app/Template/category/index.php | 2 | ||||
-rw-r--r-- | app/Template/column/create.php | 10 | ||||
-rw-r--r-- | app/Template/swimlane/create.php | 6 | ||||
-rw-r--r-- | app/Template/swimlane/edit.php | 6 | ||||
-rw-r--r-- | app/Template/swimlane/edit_default.php | 2 | ||||
-rw-r--r-- | app/Template/swimlane/table.php | 7 |
8 files changed, 48 insertions, 21 deletions
diff --git a/app/Helper/FormHelper.php b/app/Helper/FormHelper.php index e44c5d06..fb088d23 100644 --- a/app/Helper/FormHelper.php +++ b/app/Helper/FormHelper.php @@ -131,16 +131,34 @@ class FormHelper extends Base * Display a checkbox field * * @access public - * @param string $name Field name - * @param string $label Form label - * @param string $value Form value - * @param boolean $checked Field selected or not - * @param string $class CSS class + * @param string $name Field name + * @param string $label Form label + * @param string $value Form value + * @param boolean $checked Field selected or not + * @param string $class CSS class + * @param array $attributes * @return string */ - public function checkbox($name, $label, $value, $checked = false, $class = '') + public function checkbox($name, $label, $value, $checked = false, $class = '', array $attributes = array()) { - return '<label><input type="checkbox" name="'.$name.'" class="'.$class.'" value="'.$this->helper->text->e($value).'" '.($checked ? 'checked="checked"' : '').'> '.$this->helper->text->e($label).'</label>'; + $htmlAttributes = ''; + + if ($checked) { + $attributes['checked'] = 'checked'; + } + + foreach ($attributes as $attribute => $value) { + $htmlAttributes .= sprintf('%s="%s"', $attribute, $this->helper->text->e($value)); + } + + return sprintf( + '<label><input type="checkbox" name="%s" class="%s" value="%s" %s> %s</label>', + $name, + $class, + $this->helper->text->e($value), + $htmlAttributes, + $this->helper->text->e($label) + ); } /** diff --git a/app/Template/category/edit.php b/app/Template/category/edit.php index 72fd40de..d8ca313d 100644 --- a/app/Template/category/edit.php +++ b/app/Template/category/edit.php @@ -10,10 +10,10 @@ <?= $this->form->hidden('project_id', $values) ?> <?= $this->form->label(t('Category Name'), 'name') ?> - <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> + <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"', 'tabindex="1"')) ?> <?= $this->form->label(t('Description'), 'description') ?> - <?= $this->form->textEditor('description', $values, $errors) ?> + <?= $this->form->textEditor('description', $values, $errors, array('tabindex' => 2)) ?> <div class="form-actions"> <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> diff --git a/app/Template/category/index.php b/app/Template/category/index.php index ac60d9a8..336b79a2 100644 --- a/app/Template/category/index.php +++ b/app/Template/category/index.php @@ -15,9 +15,11 @@ <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a> <ul> <li> + <i class="fa fa-pencil-square-o fa-fw" aria-hidden="true"></i> <?= $this->url->link(t('Edit'), 'CategoryController', 'edit', array('project_id' => $project['id'], 'category_id' => $category_id), false, 'popover') ?> </li> <li> + <i class="fa fa-trash-o fa-fw" aria-hidden="true"></i> <?= $this->url->link(t('Remove'), 'CategoryController', 'confirm', array('project_id' => $project['id'], 'category_id' => $category_id), false, 'popover') ?> </li> </ul> diff --git a/app/Template/column/create.php b/app/Template/column/create.php index 71c94062..f4cded52 100644 --- a/app/Template/column/create.php +++ b/app/Template/column/create.php @@ -8,18 +8,18 @@ <?= $this->form->hidden('project_id', $values) ?> <?= $this->form->label(t('Title'), 'title') ?> - <?= $this->form->text('title', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> + <?= $this->form->text('title', $values, $errors, array('autofocus', 'required', 'maxlength="50"', 'tabindex="1"')) ?> <?= $this->form->label(t('Task limit'), 'task_limit') ?> - <?= $this->form->number('task_limit', $values, $errors) ?> + <?= $this->form->number('task_limit', $values, $errors, array('tabindex="2"')) ?> - <?= $this->form->checkbox('hide_in_dashboard', t('Hide tasks in this column in the dashboard'), 1) ?> + <?= $this->form->checkbox('hide_in_dashboard', t('Hide tasks in this column in the dashboard'), 1, false, '', array('tabindex' => 3)) ?> <?= $this->form->label(t('Description'), 'description') ?> - <?= $this->form->textEditor('description', $values, $errors) ?> + <?= $this->form->textEditor('description', $values, $errors, array('tabindex' => 4)) ?> <div class="form-actions"> - <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> + <button type="submit" class="btn btn-blue" tabindex="5"><?= t('Save') ?></button> <?= t('or') ?> <?= $this->url->link(t('cancel'), 'column', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> </div> diff --git a/app/Template/swimlane/create.php b/app/Template/swimlane/create.php index 0eb25411..207b526c 100644 --- a/app/Template/swimlane/create.php +++ b/app/Template/swimlane/create.php @@ -7,13 +7,13 @@ <?= $this->form->hidden('project_id', $values) ?> <?= $this->form->label(t('Name'), 'name') ?> - <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> + <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"', 'tabindex="1"')) ?> <?= $this->form->label(t('Description'), 'description') ?> - <?= $this->form->textEditor('description', $values, $errors) ?> + <?= $this->form->textEditor('description', $values, $errors, array('tabindex' => 2)) ?> <div class="form-actions"> - <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> + <button type="submit" class="btn btn-blue" tabindex="3"><?= t('Save') ?></button> <?= t('or') ?> <?= $this->url->link(t('cancel'), 'SwimlaneController', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> </div> diff --git a/app/Template/swimlane/edit.php b/app/Template/swimlane/edit.php index 2cbabb60..d225b345 100644 --- a/app/Template/swimlane/edit.php +++ b/app/Template/swimlane/edit.php @@ -10,13 +10,13 @@ <?= $this->form->hidden('project_id', $values) ?> <?= $this->form->label(t('Name'), 'name') ?> - <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> + <?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"', 'tabindex="1"')) ?> <?= $this->form->label(t('Description'), 'description') ?> - <?= $this->form->textEditor('description', $values, $errors) ?> + <?= $this->form->textEditor('description', $values, $errors, array('tabindex' => 2)) ?> <div class="form-actions"> - <button type="submit" class="btn btn-blue"><?= t('Save') ?></button> + <button type="submit" class="btn btn-blue" tabindex="3"><?= t('Save') ?></button> <?= t('or') ?> <?= $this->url->link(t('cancel'), 'SwimlaneController', 'index', array('project_id' => $project['id']), false, 'close-popover') ?> </div> diff --git a/app/Template/swimlane/edit_default.php b/app/Template/swimlane/edit_default.php index f271c513..8a0c0a15 100644 --- a/app/Template/swimlane/edit_default.php +++ b/app/Template/swimlane/edit_default.php @@ -6,7 +6,7 @@ <?= $this->form->hidden('id', $values) ?> <?= $this->form->label(t('Name'), 'default_swimlane') ?> - <?= $this->form->text('default_swimlane', $values, $errors, array('required', 'maxlength="50"')) ?> + <?= $this->form->text('default_swimlane', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> <?= $this->form->checkbox('show_default_swimlane', t('Show default swimlane'), 1, $values['show_default_swimlane'] == 1) ?> diff --git a/app/Template/swimlane/table.php b/app/Template/swimlane/table.php index cefef9de..81daed01 100644 --- a/app/Template/swimlane/table.php +++ b/app/Template/swimlane/table.php @@ -20,12 +20,15 @@ <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a> <ul> <li> + <i class="fa fa-pencil-square-o fa-fw" aria-hidden="true"></i> <?= $this->url->link(t('Edit'), 'SwimlaneController', 'editDefault', array('project_id' => $project['id']), false, 'popover') ?> </li> <li> <?php if ($default_swimlane['show_default_swimlane'] == 1): ?> + <i class="fa fa-toggle-off fa-fw" aria-hidden="true"></i> <?= $this->url->link(t('Disable'), 'SwimlaneController', 'disableDefault', array('project_id' => $project['id']), true) ?> <?php else: ?> + <i class="fa fa-toggle-on fa-fw" aria-hidden="true"></i> <?= $this->url->link(t('Enable'), 'SwimlaneController', 'enableDefault', array('project_id' => $project['id']), true) ?> <?php endif ?> </li> @@ -55,16 +58,20 @@ <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a> <ul> <li> + <i class="fa fa-pencil-square-o fa-fw" aria-hidden="true"></i> <?= $this->url->link(t('Edit'), 'SwimlaneController', 'edit', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), false, 'popover') ?> </li> <li> <?php if ($swimlane['is_active']): ?> + <i class="fa fa-toggle-off fa-fw" aria-hidden="true"></i> <?= $this->url->link(t('Disable'), 'SwimlaneController', 'disable', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true) ?> <?php else: ?> + <i class="fa fa-toggle-on fa-fw" aria-hidden="true"></i> <?= $this->url->link(t('Enable'), 'SwimlaneController', 'enable', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), true) ?> <?php endif ?> </li> <li> + <i class="fa fa-trash-o fa-fw" aria-hidden="true"></i> <?= $this->url->link(t('Remove'), 'SwimlaneController', 'confirm', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id']), false, 'popover') ?> </li> </ul> |