Rename methods to render fields in TaskHelper and SubtaskHelper
This commit is contained in:
parent
07f9700179
commit
5ce0ebdd26
|
|
@ -50,7 +50,7 @@ class SubtaskHelper extends Base
|
|||
return $this->helper->url->link($this->getTitle($subtask), 'SubtaskStatusController', 'change', $params, false, $class);
|
||||
}
|
||||
|
||||
public function selectTitle(array $values, array $errors = array(), array $attributes = array())
|
||||
public function renderTitleField(array $values, array $errors = array(), array $attributes = array())
|
||||
{
|
||||
$attributes = array_merge(array('tabindex="1"', 'required', 'maxlength="255"'), $attributes);
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ class SubtaskHelper extends Base
|
|||
return $html;
|
||||
}
|
||||
|
||||
public function selectAssignee(array $users, array $values, array $errors = array(), array $attributes = array())
|
||||
public function renderAssigneeField(array $users, array $values, array $errors = array(), array $attributes = array())
|
||||
{
|
||||
$attributes = array_merge(array('tabindex="2"'), $attributes);
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ class SubtaskHelper extends Base
|
|||
return $html;
|
||||
}
|
||||
|
||||
public function selectTimeEstimated(array $values, array $errors = array(), array $attributes = array())
|
||||
public function renderTimeEstimatedField(array $values, array $errors = array(), array $attributes = array())
|
||||
{
|
||||
$attributes = array_merge(array('tabindex="3"'), $attributes);
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ class SubtaskHelper extends Base
|
|||
return $html;
|
||||
}
|
||||
|
||||
public function selectTimeSpent(array $values, array $errors = array(), array $attributes = array())
|
||||
public function renderTimeSpentField(array $values, array $errors = array(), array $attributes = array())
|
||||
{
|
||||
$attributes = array_merge(array('tabindex="4"'), $attributes);
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class TaskHelper extends Base
|
|||
return $this->taskRecurrenceModel->getRecurrenceBasedateList();
|
||||
}
|
||||
|
||||
public function selectTitle(array $values, array $errors)
|
||||
public function renderTitleField(array $values, array $errors)
|
||||
{
|
||||
return $this->helper->form->text(
|
||||
'title',
|
||||
|
|
@ -56,12 +56,12 @@ class TaskHelper extends Base
|
|||
);
|
||||
}
|
||||
|
||||
public function selectDescription(array $values, array $errors)
|
||||
public function renderDescriptionField(array $values, array $errors)
|
||||
{
|
||||
return $this->helper->form->textEditor('description', $values, $errors, array('tabindex' => 2));
|
||||
}
|
||||
|
||||
public function selectTags(array $project, array $tags = array())
|
||||
public function renderTagField(array $project, array $tags = array())
|
||||
{
|
||||
$options = $this->tagModel->getAssignableList($project['id']);
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ class TaskHelper extends Base
|
|||
return $html;
|
||||
}
|
||||
|
||||
public function selectColor(array $values)
|
||||
public function renderColorField(array $values)
|
||||
{
|
||||
$colors = $this->colorModel->getList();
|
||||
$html = $this->helper->form->label(t('Color'), 'color_id');
|
||||
|
|
@ -91,7 +91,7 @@ class TaskHelper extends Base
|
|||
return $html;
|
||||
}
|
||||
|
||||
public function selectAssignee(array $users, array $values, array $errors = array(), array $attributes = array())
|
||||
public function renderAssigneeField(array $users, array $values, array $errors = array(), array $attributes = array())
|
||||
{
|
||||
$attributes = array_merge(array('tabindex="3"'), $attributes);
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ class TaskHelper extends Base
|
|||
return $html;
|
||||
}
|
||||
|
||||
public function selectCategory(array $categories, array $values, array $errors = array(), array $attributes = array(), $allow_one_item = false)
|
||||
public function renderCategoryField(array $categories, array $values, array $errors = array(), array $attributes = array(), $allow_one_item = false)
|
||||
{
|
||||
$attributes = array_merge(array('tabindex="4"'), $attributes);
|
||||
$html = '';
|
||||
|
|
@ -118,7 +118,7 @@ class TaskHelper extends Base
|
|||
return $html;
|
||||
}
|
||||
|
||||
public function selectSwimlane(array $swimlanes, array $values, array $errors = array(), array $attributes = array())
|
||||
public function renderSwimlaneField(array $swimlanes, array $values, array $errors = array(), array $attributes = array())
|
||||
{
|
||||
$attributes = array_merge(array('tabindex="5"'), $attributes);
|
||||
$html = '';
|
||||
|
|
@ -131,7 +131,7 @@ class TaskHelper extends Base
|
|||
return $html;
|
||||
}
|
||||
|
||||
public function selectColumn(array $columns, array $values, array $errors = array(), array $attributes = array())
|
||||
public function renderColumnField(array $columns, array $values, array $errors = array(), array $attributes = array())
|
||||
{
|
||||
$attributes = array_merge(array('tabindex="6"'), $attributes);
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ class TaskHelper extends Base
|
|||
return $html;
|
||||
}
|
||||
|
||||
public function selectPriority(array $project, array $values)
|
||||
public function renderPriorityField(array $project, array $values)
|
||||
{
|
||||
$html = '';
|
||||
|
||||
|
|
@ -157,7 +157,7 @@ class TaskHelper extends Base
|
|||
return $html;
|
||||
}
|
||||
|
||||
public function selectScore(array $values, array $errors = array(), array $attributes = array())
|
||||
public function renderScoreField(array $values, array $errors = array(), array $attributes = array())
|
||||
{
|
||||
$attributes = array_merge(array('tabindex="13"'), $attributes);
|
||||
|
||||
|
|
@ -167,7 +167,7 @@ class TaskHelper extends Base
|
|||
return $html;
|
||||
}
|
||||
|
||||
public function selectReference(array $values, array $errors = array(), array $attributes = array())
|
||||
public function renderReferenceField(array $values, array $errors = array(), array $attributes = array())
|
||||
{
|
||||
$attributes = array_merge(array('tabindex="14"'), $attributes);
|
||||
|
||||
|
|
@ -177,7 +177,7 @@ class TaskHelper extends Base
|
|||
return $html;
|
||||
}
|
||||
|
||||
public function selectTimeEstimated(array $values, array $errors = array(), array $attributes = array())
|
||||
public function renderTimeEstimatedField(array $values, array $errors = array(), array $attributes = array())
|
||||
{
|
||||
$attributes = array_merge(array('tabindex="11"'), $attributes);
|
||||
|
||||
|
|
@ -188,7 +188,7 @@ class TaskHelper extends Base
|
|||
return $html;
|
||||
}
|
||||
|
||||
public function selectTimeSpent(array $values, array $errors = array(), array $attributes = array())
|
||||
public function renderTimeSpentField(array $values, array $errors = array(), array $attributes = array())
|
||||
{
|
||||
$attributes = array_merge(array('tabindex="12"'), $attributes);
|
||||
|
||||
|
|
@ -199,13 +199,13 @@ class TaskHelper extends Base
|
|||
return $html;
|
||||
}
|
||||
|
||||
public function selectStartDate(array $values, array $errors = array(), array $attributes = array())
|
||||
public function renderStartDateField(array $values, array $errors = array(), array $attributes = array())
|
||||
{
|
||||
$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())
|
||||
public function renderDueDateField(array $values, array $errors = array(), array $attributes = array())
|
||||
{
|
||||
$attributes = array_merge(array('tabindex="9"'), $attributes);
|
||||
return $this->helper->form->date(t('Due Date'), 'date_due', $values, $errors, $attributes);
|
||||
|
|
@ -251,7 +251,7 @@ class TaskHelper extends Base
|
|||
'step1',
|
||||
array('project_id' => $projectId, 'swimlane_id' => $swimlaneId, 'column_id' => $columnId, 'provider_name' => $providerName),
|
||||
false,
|
||||
'popover-link'
|
||||
'js-modal-replace'
|
||||
);
|
||||
|
||||
$html .= '<li><i class="fa fa-fw fa-plus-square" aria-hidden="true"></i> '.$link.'</li>';
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@
|
|||
<div class="alert alert-error"><?= $this->text->e($error_message) ?></div>
|
||||
<?php endif ?>
|
||||
|
||||
<?= $this->modal->submitButtons(t('Next')) ?>
|
||||
<?= $this->modal->submitButtons(array('submitLabel' => t('Next'))) ?>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@
|
|||
|
||||
<?= $this->form->csrf() ?>
|
||||
<?= $this->form->hidden('task_id', $values) ?>
|
||||
<?= $this->subtask->selectTitle($values, $errors, array('autofocus')) ?>
|
||||
<?= $this->subtask->selectAssignee($users_list, $values, $errors) ?>
|
||||
<?= $this->subtask->selectTimeEstimated($values, $errors) ?>
|
||||
<?= $this->subtask->renderTitleField($values, $errors, array('autofocus')) ?>
|
||||
<?= $this->subtask->renderAssigneeField($users_list, $values, $errors) ?>
|
||||
<?= $this->subtask->renderTimeEstimatedField($values, $errors) ?>
|
||||
|
||||
<?= $this->hook->render('template:subtask:form:create', array('values' => $values, 'errors' => $errors)) ?>
|
||||
|
||||
<?= $this->form->checkbox('another_subtask', t('Create another sub-task'), 1, isset($values['another_subtask']) && $values['another_subtask'] == 1) ?>
|
||||
|
|
|
|||
|
|
@ -6,10 +6,12 @@
|
|||
<?= $this->form->csrf() ?>
|
||||
<?= $this->form->hidden('id', $values) ?>
|
||||
<?= $this->form->hidden('task_id', $values) ?>
|
||||
<?= $this->subtask->selectTitle($values, $errors, array('autofocus')) ?>
|
||||
<?= $this->subtask->selectAssignee($users_list, $values, $errors) ?>
|
||||
<?= $this->subtask->selectTimeEstimated($values, $errors) ?>
|
||||
<?= $this->subtask->selectTimeSpent($values, $errors) ?>
|
||||
|
||||
<?= $this->subtask->renderTitleField($values, $errors, array('autofocus')) ?>
|
||||
<?= $this->subtask->renderAssigneeField($users_list, $values, $errors) ?>
|
||||
<?= $this->subtask->renderTimeEstimatedField($values, $errors) ?>
|
||||
<?= $this->subtask->renderTimeSpentField($values, $errors) ?>
|
||||
|
||||
<?= $this->hook->render('template:subtask:form:edit', array('values' => $values, 'errors' => $errors)) ?>
|
||||
|
||||
<?= $this->modal->submitButtons() ?>
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
<?= $this->form->hidden('swimlane_id', $values) ?>
|
||||
<?= $this->form->hidden('project_id', $values) ?>
|
||||
|
||||
<?= $this->task->selectColor($values) ?>
|
||||
<?= $this->task->selectAssignee($users_list, $values, $errors) ?>
|
||||
<?= $this->task->selectCategory($categories_list, $values, $errors) ?>
|
||||
<?= $this->task->renderColorField($values) ?>
|
||||
<?= $this->task->renderAssigneeField($users_list, $values, $errors) ?>
|
||||
<?= $this->task->renderCategoryField($categories_list, $values, $errors) ?>
|
||||
|
||||
<?= $this->form->label(t('Tasks'), 'tasks') ?>
|
||||
<?= $this->form->textarea('tasks', $values, $errors, array('placeholder="'.t('My task title').'"')) ?>
|
||||
|
|
|
|||
|
|
@ -7,31 +7,31 @@
|
|||
|
||||
<div class="task-form-container">
|
||||
<div class="task-form-main-column">
|
||||
<?= $this->task->selectTitle($values, $errors) ?>
|
||||
<?= $this->task->selectDescription($values, $errors) ?>
|
||||
<?= $this->task->selectTags($project) ?>
|
||||
<?= $this->task->renderTitleField($values, $errors) ?>
|
||||
<?= $this->task->renderDescriptionField($values, $errors) ?>
|
||||
<?= $this->task->renderTagField($project) ?>
|
||||
|
||||
<?= $this->hook->render('template:task:form:first-column', array('values' => $values, 'errors' => $errors)) ?>
|
||||
</div>
|
||||
|
||||
<div class="task-form-secondary-column">
|
||||
<?= $this->task->selectColor($values) ?>
|
||||
<?= $this->task->selectAssignee($users_list, $values, $errors) ?>
|
||||
<?= $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->task->renderColorField($values) ?>
|
||||
<?= $this->task->renderAssigneeField($users_list, $values, $errors) ?>
|
||||
<?= $this->task->renderCategoryField($categories_list, $values, $errors) ?>
|
||||
<?= $this->task->renderSwimlaneField($swimlanes_list, $values, $errors) ?>
|
||||
<?= $this->task->renderColumnField($columns_list, $values, $errors) ?>
|
||||
<?= $this->task->renderPriorityField($project, $values) ?>
|
||||
|
||||
<?= $this->hook->render('template:task:form:second-column', array('values' => $values, 'errors' => $errors)) ?>
|
||||
</div>
|
||||
|
||||
<div class="task-form-secondary-column">
|
||||
<?= $this->task->selectDueDate($values, $errors) ?>
|
||||
<?= $this->task->selectStartDate($values, $errors) ?>
|
||||
<?= $this->task->selectTimeEstimated($values, $errors) ?>
|
||||
<?= $this->task->selectTimeSpent($values, $errors) ?>
|
||||
<?= $this->task->selectScore($values, $errors) ?>
|
||||
<?= $this->task->selectReference($values, $errors) ?>
|
||||
<?= $this->task->renderDueDateField($values, $errors) ?>
|
||||
<?= $this->task->renderStartDateField($values, $errors) ?>
|
||||
<?= $this->task->renderTimeEstimatedField($values, $errors) ?>
|
||||
<?= $this->task->renderTimeSpentField($values, $errors) ?>
|
||||
<?= $this->task->renderScoreField($values, $errors) ?>
|
||||
<?= $this->task->renderReferenceField($values, $errors) ?>
|
||||
|
||||
<?= $this->hook->render('template:task:form:third-column', array('values' => $values, 'errors' => $errors)) ?>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -8,29 +8,29 @@
|
|||
|
||||
<div class="task-form-container">
|
||||
<div class="task-form-main-column">
|
||||
<?= $this->task->selectTitle($values, $errors) ?>
|
||||
<?= $this->task->selectDescription($values, $errors) ?>
|
||||
<?= $this->task->selectTags($project, $tags) ?>
|
||||
<?= $this->task->renderTitleField($values, $errors) ?>
|
||||
<?= $this->task->renderDescriptionField($values, $errors) ?>
|
||||
<?= $this->task->renderTagField($project, $tags) ?>
|
||||
|
||||
<?= $this->hook->render('template:task:form:first-column', array('values' => $values, 'errors' => $errors)) ?>
|
||||
</div>
|
||||
|
||||
<div class="task-form-secondary-column">
|
||||
<?= $this->task->selectColor($values) ?>
|
||||
<?= $this->task->selectAssignee($users_list, $values, $errors) ?>
|
||||
<?= $this->task->selectCategory($categories_list, $values, $errors) ?>
|
||||
<?= $this->task->selectPriority($project, $values) ?>
|
||||
<?= $this->task->renderColorField($values) ?>
|
||||
<?= $this->task->renderAssigneeField($users_list, $values, $errors) ?>
|
||||
<?= $this->task->renderCategoryField($categories_list, $values, $errors) ?>
|
||||
<?= $this->task->renderPriorityField($project, $values) ?>
|
||||
|
||||
<?= $this->hook->render('template:task:form:second-column', array('values' => $values, 'errors' => $errors)) ?>
|
||||
</div>
|
||||
|
||||
<div class="task-form-secondary-column">
|
||||
<?= $this->task->selectDueDate($values, $errors) ?>
|
||||
<?= $this->task->selectStartDate($values, $errors) ?>
|
||||
<?= $this->task->selectTimeEstimated($values, $errors) ?>
|
||||
<?= $this->task->selectTimeSpent($values, $errors) ?>
|
||||
<?= $this->task->selectScore($values, $errors) ?>
|
||||
<?= $this->task->selectReference($values, $errors) ?>
|
||||
<?= $this->task->renderDueDateField($values, $errors) ?>
|
||||
<?= $this->task->renderStartDateField($values, $errors) ?>
|
||||
<?= $this->task->renderTimeEstimatedField($values, $errors) ?>
|
||||
<?= $this->task->renderTimeSpentField($values, $errors) ?>
|
||||
<?= $this->task->renderScoreField($values, $errors) ?>
|
||||
<?= $this->task->renderReferenceField($values, $errors) ?>
|
||||
|
||||
<?= $this->hook->render('template:task:form:third-column', array('values' => $values, 'errors' => $errors)) ?>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ class TaskHelperTest extends Base
|
|||
public function testSelectPriority()
|
||||
{
|
||||
$helper = new TaskHelper($this->container);
|
||||
$this->assertNotEmpty($helper->selectPriority(array('priority_end' => '1', 'priority_start' => '5', 'priority_default' => '2'), array()));
|
||||
$this->assertNotEmpty($helper->selectPriority(array('priority_end' => '3', 'priority_start' => '1', 'priority_default' => '2'), array()));
|
||||
$this->assertEmpty($helper->selectPriority(array('priority_end' => '3', 'priority_start' => '3', 'priority_default' => '2'), array()));
|
||||
$this->assertNotEmpty($helper->renderPriorityField(array('priority_end' => '1', 'priority_start' => '5', 'priority_default' => '2'), array()));
|
||||
$this->assertNotEmpty($helper->renderPriorityField(array('priority_end' => '3', 'priority_start' => '1', 'priority_default' => '2'), array()));
|
||||
$this->assertEmpty($helper->renderPriorityField(array('priority_end' => '3', 'priority_start' => '3', 'priority_default' => '2'), array()));
|
||||
}
|
||||
|
||||
public function testFormatPriority()
|
||||
|
|
|
|||
Loading…
Reference in New Issue