From de2501f070a7bf41b766ee1139d1322213e387e9 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 27 Nov 2016 18:33:00 -0500 Subject: Improve tabindex for project settings forms --- app/Helper/FormHelper.php | 32 +++++++++++++++++++++++++------- app/Template/category/edit.php | 4 ++-- app/Template/category/index.php | 2 ++ app/Template/column/create.php | 10 +++++----- app/Template/swimlane/create.php | 6 +++--- app/Template/swimlane/edit.php | 6 +++--- app/Template/swimlane/edit_default.php | 2 +- app/Template/swimlane/table.php | 7 +++++++ 8 files changed, 48 insertions(+), 21 deletions(-) (limited to 'app') 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 ''; + $htmlAttributes = ''; + + if ($checked) { + $attributes['checked'] = 'checked'; + } + + foreach ($attributes as $attribute => $value) { + $htmlAttributes .= sprintf('%s="%s"', $attribute, $this->helper->text->e($value)); + } + + return sprintf( + '', + $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 @@ form->hidden('project_id', $values) ?> form->label(t('Category Name'), 'name') ?> - form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> + form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"', 'tabindex="1"')) ?> form->label(t('Description'), 'description') ?> - form->textEditor('description', $values, $errors) ?> + form->textEditor('description', $values, $errors, array('tabindex' => 2)) ?>
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 @@ 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 @@ form->hidden('project_id', $values) ?> form->label(t('Title'), 'title') ?> - form->text('title', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> + form->text('title', $values, $errors, array('autofocus', 'required', 'maxlength="50"', 'tabindex="1"')) ?> form->label(t('Task limit'), 'task_limit') ?> - form->number('task_limit', $values, $errors) ?> + form->number('task_limit', $values, $errors, array('tabindex="2"')) ?> - form->checkbox('hide_in_dashboard', t('Hide tasks in this column in the dashboard'), 1) ?> + form->checkbox('hide_in_dashboard', t('Hide tasks in this column in the dashboard'), 1, false, '', array('tabindex' => 3)) ?> form->label(t('Description'), 'description') ?> - form->textEditor('description', $values, $errors) ?> + form->textEditor('description', $values, $errors, array('tabindex' => 4)) ?>
- + url->link(t('cancel'), 'column', 'index', array('project_id' => $project['id']), false, 'close-popover') ?>
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 @@ form->hidden('project_id', $values) ?> form->label(t('Name'), 'name') ?> - form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> + form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"', 'tabindex="1"')) ?> form->label(t('Description'), 'description') ?> - form->textEditor('description', $values, $errors) ?> + form->textEditor('description', $values, $errors, array('tabindex' => 2)) ?>
- + url->link(t('cancel'), 'SwimlaneController', 'index', array('project_id' => $project['id']), false, 'close-popover') ?>
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 @@ form->hidden('project_id', $values) ?> form->label(t('Name'), 'name') ?> - form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> + form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"', 'tabindex="1"')) ?> form->label(t('Description'), 'description') ?> - form->textEditor('description', $values, $errors) ?> + form->textEditor('description', $values, $errors, array('tabindex' => 2)) ?>
- + url->link(t('cancel'), 'SwimlaneController', 'index', array('project_id' => $project['id']), false, 'close-popover') ?>
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 @@ form->hidden('id', $values) ?> form->label(t('Name'), 'default_swimlane') ?> - form->text('default_swimlane', $values, $errors, array('required', 'maxlength="50"')) ?> + form->text('default_swimlane', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?> 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 @@