diff options
Diffstat (limited to 'app/Helper/TaskHelper.php')
-rw-r--r-- | app/Helper/TaskHelper.php | 119 |
1 files changed, 68 insertions, 51 deletions
diff --git a/app/Helper/TaskHelper.php b/app/Helper/TaskHelper.php index e1d65cca..71596b60 100644 --- a/app/Helper/TaskHelper.php +++ b/app/Helper/TaskHelper.php @@ -40,32 +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 .= $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').'"' + ) ); + } - 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']); @@ -87,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'); @@ -95,18 +91,21 @@ 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); $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 .= ' '; + $html .= '<small>'; + $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 .= '</small>'; 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 = ''; @@ -119,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 = ''; @@ -132,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); @@ -142,11 +141,11 @@ class TaskHelper extends Base return $html; } - public function selectPriority(array $project, array $values) + public function renderPriorityField(array $project, array $values) { $html = ''; - if ($project['priority_end'] > $project['priority_start']) { + if ($project['priority_end'] != $project['priority_start']) { $range = range($project['priority_start'], $project['priority_end']); $options = array_combine($range, $range); $values += array('priority' => $project['priority_default']); @@ -158,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); @@ -168,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'); @@ -178,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); @@ -189,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); @@ -200,33 +199,23 @@ 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()) { - $placeholder = date($this->configModel->get('application_date_format', 'm/d/Y H:i')); - $attributes = array_merge(array('tabindex="12"', 'placeholder="'.$placeholder.'"'), $attributes); - - $html = $this->helper->form->label(t('Start Date'), 'date_started'); - $html .= $this->helper->form->text('date_started', $values, $errors, $attributes, 'form-datetime'); - - return $html; + $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()) { - $placeholder = date($this->configModel->get('application_date_format', 'm/d/Y')); - $attributes = array_merge(array('tabindex="13"', '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'); - - return $html; + $attributes = array_merge(array('tabindex="9"'), $attributes); + return $this->helper->form->date(t('Due Date'), 'date_due', $values, $errors, $attributes); } public function formatPriority(array $project, array $task) { $html = ''; - if ($project['priority_end'] > $project['priority_start']) { + if ($project['priority_end'] != $project['priority_start']) { $html .= '<span class="task-board-priority" title="'.t('Task priority').'">'; $html .= $task['priority'] >= 0 ? 'P'.$task['priority'] : '-P'.abs($task['priority']); $html .= '</span>'; @@ -243,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; + } } |