diff options
Diffstat (limited to 'app/Helper/TaskHelper.php')
-rw-r--r-- | app/Helper/TaskHelper.php | 98 |
1 files changed, 60 insertions, 38 deletions
diff --git a/app/Helper/TaskHelper.php b/app/Helper/TaskHelper.php index 678b4bed..71596b60 100644 --- a/app/Helper/TaskHelper.php +++ b/app/Helper/TaskHelper.php @@ -40,34 +40,28 @@ class TaskHelper extends Base return $this->taskRecurrenceModel->getRecurrenceBasedateList(); } - public function selectTitle(array $values, array $errors) + public function renderTitleField(array $values, array $errors) { - $html = $this->helper->form->label(t('Title'), 'title'); - $html .= $this->helper->form->text('title', $values, $errors, array('autofocus', 'required', 'maxlength="200"', 'tabindex="1"'), 'form-input-large'); - return $html; - } - - public function selectDescription(array $values, array $errors) - { - $html = $this->helper->form->label(t('Description'), 'description'); - $html .= '<div class="markdown-editor-container">'; - $html .= $this->helper->form->textarea( - 'description', + return $this->helper->form->text( + 'title', $values, $errors, array( - 'placeholder="'.t('Leave a description').'"', - 'tabindex="2"', - 'data-mention-search-url="'.$this->helper->url->href('UserAjaxController', 'mention', array('project_id' => $values['project_id'])).'"' - ), - 'markdown-editor' + 'autofocus', + 'required', + 'maxlength="200"', + 'tabindex="1"', + 'placeholder="'.t('Title').'"' + ) ); + } - $html .= '</div>'; - return $html; + 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']); @@ -89,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'); @@ -97,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); @@ -111,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 = ''; @@ -124,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 = ''; @@ -137,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); @@ -147,7 +141,7 @@ class TaskHelper extends Base return $html; } - public function selectPriority(array $project, array $values) + public function renderPriorityField(array $project, array $values) { $html = ''; @@ -163,9 +157,9 @@ 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="8"'), $attributes); + $attributes = array_merge(array('tabindex="13"'), $attributes); $html = $this->helper->form->label(t('Complexity'), 'score'); $html .= $this->helper->form->number('score', $values, $errors, $attributes); @@ -173,9 +167,9 @@ 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="9"'), $attributes); + $attributes = array_merge(array('tabindex="14"'), $attributes); $html = $this->helper->form->label(t('Reference'), 'reference'); $html .= $this->helper->form->text('reference', $values, $errors, $attributes, 'form-input-small'); @@ -183,9 +177,9 @@ 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="10"'), $attributes); + $attributes = array_merge(array('tabindex="11"'), $attributes); $html = $this->helper->form->label(t('Original estimate'), 'time_estimated'); $html .= $this->helper->form->numeric('time_estimated', $values, $errors, $attributes); @@ -194,9 +188,9 @@ 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="11"'), $attributes); + $attributes = array_merge(array('tabindex="12"'), $attributes); $html = $this->helper->form->label(t('Time spent'), 'time_spent'); $html .= $this->helper->form->numeric('time_spent', $values, $errors, $attributes); @@ -205,15 +199,15 @@ 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="12"'), $attributes); + $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="13"'), $attributes); + $attributes = array_merge(array('tabindex="9"'), $attributes); return $this->helper->form->date(t('Due Date'), 'date_due', $values, $errors, $attributes); } @@ -238,4 +232,32 @@ class TaskHelper extends Base return $this->taskModel->getProgress($task, $this->columns[$task['project_id']]); } + + public function getNewTaskDropdown($projectId, $swimlaneId, $columnId) + { + $providers = $this->externalTaskManager->getProvidersList(); + + if (empty($providers)) { + return ''; + } + + $html = '<small class="pull-right"><div class="dropdown">'; + $html .= '<a href="#" class="dropdown-menu"><i class="fa fa-cloud-download" aria-hidden="true"></i> <i class="fa fa-caret-down"></i></a><ul>'; + + foreach ($providers as $providerName) { + $link = $this->helper->url->link( + t('New External Task: %s', $providerName), + 'ExternalTaskCreationController', + 'step1', + array('project_id' => $projectId, 'swimlane_id' => $swimlaneId, 'column_id' => $columnId, 'provider_name' => $providerName), + false, + 'js-modal-replace' + ); + + $html .= '<li><i class="fa fa-fw fa-plus-square" aria-hidden="true"></i> '.$link.'</li>'; + } + + $html .= '</ul></div></small>'; + return $html; + } } |