diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/Controller/Gantt.php | 3 | ||||
-rw-r--r-- | app/Controller/Taskcreation.php | 2 | ||||
-rw-r--r-- | app/Helper/Task.php | 82 | ||||
-rw-r--r-- | app/Template/board/popover_category.php | 3 | ||||
-rw-r--r-- | app/Template/gantt/task_creation.php | 27 | ||||
-rw-r--r-- | app/Template/task_creation/form.php | 29 | ||||
-rw-r--r-- | app/Template/task_modification/edit_task.php | 15 |
7 files changed, 99 insertions, 62 deletions
diff --git a/app/Controller/Gantt.php b/app/Controller/Gantt.php index ac0e6fad..f312130c 100644 --- a/app/Controller/Gantt.php +++ b/app/Controller/Gantt.php @@ -103,6 +103,7 @@ class Gantt extends Base $project = $this->getProject(); $this->response->html($this->template->render('gantt/task_creation', array( + 'project' => $project, 'errors' => $errors, 'values' => $values + array( 'project_id' => $project['id'], @@ -113,8 +114,6 @@ class Gantt extends Base 'colors_list' => $this->color->getList(), 'categories_list' => $this->category->getList($project['id']), 'swimlanes_list' => $this->swimlane->getList($project['id'], false, true), - 'date_format' => $this->config->get('application_date_format'), - 'date_formats' => $this->dateParser->getAvailableFormats(), 'title' => $project['name'].' > '.t('New task') ))); } diff --git a/app/Controller/Taskcreation.php b/app/Controller/Taskcreation.php index ed2ac1b9..396d5f6f 100644 --- a/app/Controller/Taskcreation.php +++ b/app/Controller/Taskcreation.php @@ -38,8 +38,6 @@ class Taskcreation extends Base 'colors_list' => $this->color->getList(), 'categories_list' => $this->category->getList($project['id']), 'swimlanes_list' => $swimlanes_list, - 'date_format' => $this->config->get('application_date_format'), - 'date_formats' => $this->dateParser->getAvailableFormats(), 'title' => $project['name'].' > '.t('New task') ))); } diff --git a/app/Helper/Task.php b/app/Helper/Task.php index 06f7d58e..57ad6c91 100644 --- a/app/Helper/Task.php +++ b/app/Helper/Task.php @@ -51,7 +51,43 @@ class Task extends Base $html = $this->helper->form->label(t('Assignee'), 'owner_id'); $html .= $this->helper->form->select('owner_id', $users, $values, $errors, $attributes); - $html .= '<a href="#" class="assign-me" data-target-id="form-owner_id" data-current-id="'.$this->userSession->getId().'" title="'.t('Assign to me').'">'.t('Me').'</a>'; + $html .= ' <a href="#" class="assign-me" data-target-id="form-owner_id" data-current-id="'.$this->userSession->getId().'" title="'.t('Assign to me').'">'.t('Me').'</a>'; + + return $html; + } + + public function selectCategory(array $categories, array $values, array $errors = array(), array $attributes = array(), $allow_one_item = false) + { + $attributes = array_merge(array('tabindex="4"'), $attributes); + $html = ''; + + if (! (! $allow_one_item && count($categories) === 1 && key($categories) == 0)) { + $html .= $this->helper->form->label(t('Category'), 'category_id'); + $html .= $this->helper->form->select('category_id', $categories, $values, $errors, $attributes); + } + + return $html; + } + + public function selectSwimlane(array $swimlanes, array $values, array $errors = array(), array $attributes = array()) + { + $attributes = array_merge(array('tabindex="5"'), $attributes); + $html = ''; + + if (! (count($swimlanes) === 1 && key($swimlanes) == 0)) { + $html .= $this->helper->form->label(t('Swimlane'), 'swimlane_id'); + $html .= $this->helper->form->select('swimlane_id', $swimlanes, $values, $errors, $attributes); + } + + return $html; + } + + public function selectColumn(array $columns, array $values, array $errors = array(), array $attributes = array()) + { + $attributes = array_merge(array('tabindex="6"'), $attributes); + + $html = $this->helper->form->label(t('Column'), 'column_id'); + $html .= $this->helper->form->select('column_id', $columns, $values, $errors, $attributes); return $html; } @@ -72,6 +108,50 @@ class Task extends Base return $html; } + public function selectScore(array $values, array $errors = array(), array $attributes = array()) + { + $attributes = array_merge(array('tabindex="8"'), $attributes); + + $html = $this->helper->form->label(t('Complexity'), 'score'); + $html .= $this->helper->form->number('score', $values, $errors, $attributes); + + return $html; + } + + public function selectTimeEstimate(array $values, array $errors = array(), array $attributes = array()) + { + $attributes = array_merge(array('tabindex="9"'), $attributes); + + $html = $this->helper->form->label(t('Original estimate'), 'time_estimated'); + $html .= $this->helper->form->numeric('time_estimated', $values, $errors, $attributes); + $html .= ' '.t('hours'); + + return $html; + } + + public function selectStartDate(array $values, array $errors = array(), array $attributes = array()) + { + $placeholder = $this->helper->text->in($this->config->get('application_date_format'), $this->dateParser->getAvailableFormats()); + $attributes = array_merge(array('tabindex="10"', 'placeholder="'.$placeholder.'"'), $attributes); + + $html = $this->helper->form->label(t('Start Date'), 'date_started'); + $html .= $this->helper->form->text('date_started', $values, $errors, $attributes, 'form-date'); + + return $html; + } + + public function selectDueDate(array $values, array $errors = array(), array $attributes = array()) + { + $placeholder = $this->helper->text->in($this->config->get('application_date_format'), $this->dateParser->getAvailableFormats()); + $attributes = array_merge(array('tabindex="11"', 'placeholder="'.$placeholder.'"'), $attributes); + + $html = $this->helper->form->label(t('Due Date'), 'date_due'); + $html .= $this->helper->form->text('date_due', $values, $errors, $attributes, 'form-date'); + $html .= '<div class="form-help">'.t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')).'</div>'; + + return $html; + } + public function formatPriority(array $project, array $task) { $html = ''; diff --git a/app/Template/board/popover_category.php b/app/Template/board/popover_category.php index 224ce8d1..e65593cd 100644 --- a/app/Template/board/popover_category.php +++ b/app/Template/board/popover_category.php @@ -9,8 +9,7 @@ <?= $this->form->hidden('id', $values) ?> <?= $this->form->hidden('project_id', $values) ?> - <?= $this->form->label(t('Category'), 'category_id') ?> - <?= $this->form->select('category_id', $categories_list, $values, array(), array('autofocus')) ?><br/> + <?= $this->task->selectCategory($categories_list, $values, array(), array('autofocus'), true) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> diff --git a/app/Template/gantt/task_creation.php b/app/Template/gantt/task_creation.php index 7997e231..a08f41b4 100644 --- a/app/Template/gantt/task_creation.php +++ b/app/Template/gantt/task_creation.php @@ -33,26 +33,13 @@ </div> <div class="form-column"> - <?= $this->form->label(t('Assignee'), 'owner_id') ?> - <?= $this->form->select('owner_id', $users_list, $values, $errors, array('tabindex="3"')) ?><br/> - - <?= $this->form->label(t('Category'), 'category_id') ?> - <?= $this->form->select('category_id', $categories_list, $values, $errors, array('tabindex="4"')) ?><br/> - - <?php if (! (count($swimlanes_list) === 1 && key($swimlanes_list) === 0)): ?> - <?= $this->form->label(t('Swimlane'), 'swimlane_id') ?> - <?= $this->form->select('swimlane_id', $swimlanes_list, $values, $errors, array('tabindex="5"')) ?><br/> - <?php endif ?> - - <?= $this->form->label(t('Complexity'), 'score') ?> - <?= $this->form->number('score', $values, $errors, array('tabindex="6"')) ?><br/> - - <?= $this->form->label(t('Start Date'), 'date_started') ?> - <?= $this->form->text('date_started', $values, $errors, array('placeholder="'.$this->text->in($date_format, $date_formats).'"', 'tabindex="7"'), 'form-date') ?> - - <?= $this->form->label(t('Due Date'), 'date_due') ?> - <?= $this->form->text('date_due', $values, $errors, array('placeholder="'.$this->text->in($date_format, $date_formats).'"', 'tabindex="8"'), 'form-date') ?><br/> - <div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div> + <?= $this->task->selectAssignee($users_list, $values, $errors) ?> + <?= $this->task->selectCategory($categories_list, $values, $errors) ?> + <?= $this->task->selectSwimlane($swimlanes_list, $values, $errors) ?> + <?= $this->task->selectPriority($project, $values) ?> + <?= $this->task->selectScore($values, $errors) ?> + <?= $this->task->selectStartDate($values, $errors) ?> + <?= $this->task->selectDueDate($values, $errors) ?> </div> <div class="form-actions"> diff --git a/app/Template/task_creation/form.php b/app/Template/task_creation/form.php index a814219b..b222f00f 100644 --- a/app/Template/task_creation/form.php +++ b/app/Template/task_creation/form.php @@ -47,31 +47,14 @@ <div class="form-column"> <?= $this->form->hidden('project_id', $values) ?> - <?= $this->task->selectAssignee($users_list, $values, $errors) ?> - - <?= $this->form->label(t('Category'), 'category_id') ?> - <?= $this->form->select('category_id', $categories_list, $values, $errors, array('tabindex="4"')) ?> - - <?php if (! (count($swimlanes_list) === 1 && key($swimlanes_list) === 0)): ?> - <?= $this->form->label(t('Swimlane'), 'swimlane_id') ?> - <?= $this->form->select('swimlane_id', $swimlanes_list, $values, $errors, array('tabindex="5"')) ?> - <?php endif ?> - - <?= $this->form->label(t('Column'), 'column_id') ?> - <?= $this->form->select('column_id', $columns_list, $values, $errors, array('tabindex="6"')) ?> - + <?= $this->task->selectCategory($categories_list, $values, $errors) ?> + <?= $this->task->selectSwimlane($swimlanes_list, $values, $errors) ?> + <?= $this->task->selectColumn($columns_list, $values, $errors) ?> <?= $this->task->selectPriority($project, $values) ?> - - <?= $this->form->label(t('Complexity'), 'score') ?> - <?= $this->form->number('score', $values, $errors, array('tabindex="9"')) ?> - - <?= $this->form->label(t('Original estimate'), 'time_estimated') ?> - <?= $this->form->numeric('time_estimated', $values, $errors, array('tabindex="10"')) ?> <?= t('hours') ?> - - <?= $this->form->label(t('Due Date'), 'date_due') ?> - <?= $this->form->text('date_due', $values, $errors, array('placeholder="'.$this->text->in($date_format, $date_formats).'"', 'tabindex="11"'), 'form-date') ?> - <div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div> + <?= $this->task->selectScore($values, $errors) ?> + <?= $this->task->selectTimeEstimate($values, $errors) ?> + <?= $this->task->selectDueDate($values, $errors) ?> </div> <div class="form-actions"> diff --git a/app/Template/task_modification/edit_task.php b/app/Template/task_modification/edit_task.php index 1daa318c..fe7fb009 100644 --- a/app/Template/task_modification/edit_task.php +++ b/app/Template/task_modification/edit_task.php @@ -43,20 +43,11 @@ <div class="form-column"> <?= $this->form->hidden('id', $values) ?> <?= $this->form->hidden('project_id', $values) ?> - <?= $this->task->selectAssignee($users_list, $values, $errors) ?> - - <?= $this->form->label(t('Category'), 'category_id') ?> - <?= $this->form->select('category_id', $categories_list, $values, $errors, array('tabindex="4"')) ?> - - <?= $this->form->label(t('Complexity'), 'score') ?> - <?= $this->form->number('score', $values, $errors, array('tabindex="6"')) ?> - + <?= $this->task->selectCategory($categories_list, $values, $errors) ?> <?= $this->task->selectPriority($project, $values) ?> - - <?= $this->form->label(t('Due Date'), 'date_due') ?> - <?= $this->form->text('date_due', $values, $errors, array('placeholder="'.$this->text->in($date_format, $date_formats).'"', 'tabindex="8"'), 'form-date') ?> - <div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div> + <?= $this->task->selectScore($values, $errors) ?> + <?= $this->task->selectDueDate($values, $errors) ?> </div> <div class="form-actions"> |