Move task form elements to Task helper
This commit is contained in:
parent
9570793f68
commit
d8e452d375
|
|
@ -24,6 +24,7 @@ Improvements:
|
|||
* Have a new task assigned to the creator by default instead of "no assignee"
|
||||
* Show progress for task links in board tooltips
|
||||
* Simplify code to handle ajax popover and redirects
|
||||
* Move task form elements to Task helper
|
||||
|
||||
Version 1.0.24
|
||||
--------------
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 = '';
|
||||
|
|
|
|||
|
|
@ -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"/>
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
Loading…
Reference in New Issue