summaryrefslogtreecommitdiff
path: root/app/Template/subtask
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-05-24 16:02:25 -0400
committerFrederic Guillot <fred@kanboard.net>2015-05-24 16:02:25 -0400
commiteeac2329baab1fdae7cbf6c707ed2ffd8beb4c1b (patch)
tree511c2fe47f8fbb1ea90e59e7a7a7f5e3530aa9ed /app/Template/subtask
parent65e9e5d1bed9f88ecfd43eb2c1e780a7c22c151f (diff)
Helpers refactoring
Diffstat (limited to 'app/Template/subtask')
-rw-r--r--app/Template/subtask/create.php22
-rw-r--r--app/Template/subtask/edit.php26
-rw-r--r--app/Template/subtask/remove.php4
-rw-r--r--app/Template/subtask/restriction_change_status.php10
-rw-r--r--app/Template/subtask/show.php20
5 files changed, 41 insertions, 41 deletions
diff --git a/app/Template/subtask/create.php b/app/Template/subtask/create.php
index 8c5aae11..82e378f5 100644
--- a/app/Template/subtask/create.php
+++ b/app/Template/subtask/create.php
@@ -2,26 +2,26 @@
<h2><?= t('Add a sub-task') ?></h2>
</div>
-<form method="post" action="<?= $this->u('subtask', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off">
+<form method="post" action="<?= $this->url->href('subtask', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off">
- <?= $this->formCsrf() ?>
+ <?= $this->form->csrf() ?>
- <?= $this->formHidden('task_id', $values) ?>
+ <?= $this->form->hidden('task_id', $values) ?>
- <?= $this->formLabel(t('Title'), 'title') ?>
- <?= $this->formText('title', $values, $errors, array('required', 'autofocus', 'maxlength="255"')) ?><br/>
+ <?= $this->form->label(t('Title'), 'title') ?>
+ <?= $this->form->text('title', $values, $errors, array('required', 'autofocus', 'maxlength="255"')) ?><br/>
- <?= $this->formLabel(t('Assignee'), 'user_id') ?>
- <?= $this->formSelect('user_id', $users_list, $values, $errors) ?><br/>
+ <?= $this->form->label(t('Assignee'), 'user_id') ?>
+ <?= $this->form->select('user_id', $users_list, $values, $errors) ?><br/>
- <?= $this->formLabel(t('Original estimate'), 'time_estimated') ?>
- <?= $this->formNumeric('time_estimated', $values, $errors) ?> <?= t('hours') ?><br/>
+ <?= $this->form->label(t('Original estimate'), 'time_estimated') ?>
+ <?= $this->form->numeric('time_estimated', $values, $errors) ?> <?= t('hours') ?><br/>
- <?= $this->formCheckbox('another_subtask', t('Create another sub-task'), 1, isset($values['another_subtask']) && $values['another_subtask'] == 1) ?>
+ <?= $this->form->checkbox('another_subtask', t('Create another sub-task'), 1, isset($values['another_subtask']) && $values['another_subtask'] == 1) ?>
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
<?= t('or') ?>
- <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
+ <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</div>
</form>
diff --git a/app/Template/subtask/edit.php b/app/Template/subtask/edit.php
index 3058ff44..2e583069 100644
--- a/app/Template/subtask/edit.php
+++ b/app/Template/subtask/edit.php
@@ -2,28 +2,28 @@
<h2><?= t('Edit a sub-task') ?></h2>
</div>
-<form method="post" action="<?= $this->u('subtask', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>" autocomplete="off">
+<form method="post" action="<?= $this->url->href('subtask', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>" autocomplete="off">
- <?= $this->formCsrf() ?>
+ <?= $this->form->csrf() ?>
- <?= $this->formHidden('id', $values) ?>
- <?= $this->formHidden('task_id', $values) ?>
+ <?= $this->form->hidden('id', $values) ?>
+ <?= $this->form->hidden('task_id', $values) ?>
- <?= $this->formLabel(t('Title'), 'title') ?>
- <?= $this->formText('title', $values, $errors, array('required', 'autofocus', 'maxlength="255"')) ?><br/>
+ <?= $this->form->label(t('Title'), 'title') ?>
+ <?= $this->form->text('title', $values, $errors, array('required', 'autofocus', 'maxlength="255"')) ?><br/>
- <?= $this->formLabel(t('Assignee'), 'user_id') ?>
- <?= $this->formSelect('user_id', $users_list, $values, $errors) ?><br/>
+ <?= $this->form->label(t('Assignee'), 'user_id') ?>
+ <?= $this->form->select('user_id', $users_list, $values, $errors) ?><br/>
- <?= $this->formLabel(t('Original estimate'), 'time_estimated') ?>
- <?= $this->formNumeric('time_estimated', $values, $errors) ?> <?= t('hours') ?><br/>
+ <?= $this->form->label(t('Original estimate'), 'time_estimated') ?>
+ <?= $this->form->numeric('time_estimated', $values, $errors) ?> <?= t('hours') ?><br/>
- <?= $this->formLabel(t('Time spent'), 'time_spent') ?>
- <?= $this->formNumeric('time_spent', $values, $errors) ?> <?= t('hours') ?><br/>
+ <?= $this->form->label(t('Time spent'), 'time_spent') ?>
+ <?= $this->form->numeric('time_spent', $values, $errors) ?> <?= t('hours') ?><br/>
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
<?= t('or') ?>
- <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
+ <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</div>
</form>
diff --git a/app/Template/subtask/remove.php b/app/Template/subtask/remove.php
index c623791d..65ade31d 100644
--- a/app/Template/subtask/remove.php
+++ b/app/Template/subtask/remove.php
@@ -10,8 +10,8 @@
<p><strong><?= $this->e($subtask['title']) ?></strong></p>
<div class="form-actions">
- <?= $this->a(t('Yes'), 'subtask', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id']), true, 'btn btn-red') ?>
+ <?= $this->url->link(t('Yes'), 'subtask', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id']), true, 'btn btn-red') ?>
<?= t('or') ?>
- <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
+ <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</div>
</div> \ No newline at end of file
diff --git a/app/Template/subtask/restriction_change_status.php b/app/Template/subtask/restriction_change_status.php
index 99e022f8..88e91d82 100644
--- a/app/Template/subtask/restriction_change_status.php
+++ b/app/Template/subtask/restriction_change_status.php
@@ -2,14 +2,14 @@
<h2><?= t('You already have one subtask in progress') ?></h2>
</div>
- <form action="<?= $this->u('subtask', 'changeRestrictionStatus', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>" method="post">
+ <form action="<?= $this->url->href('subtask', 'changeRestrictionStatus', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>" method="post">
- <?= $this->formCsrf() ?>
- <?= $this->formHidden('redirect', array('redirect' => $redirect)) ?>
+ <?= $this->form->csrf() ?>
+ <?= $this->form->hidden('redirect', array('redirect' => $redirect)) ?>
<p><?= t('Select the new status of the subtask: "%s"', $subtask_inprogress['title']) ?></p>
- <?= $this->formRadios('status', $status_list) ?>
- <?= $this->formHidden('id', $subtask_inprogress) ?>
+ <?= $this->form->radios('status', $status_list) ?>
+ <?= $this->form->hidden('id', $subtask_inprogress) ?>
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-red"/>
diff --git a/app/Template/subtask/show.php b/app/Template/subtask/show.php
index e5368265..c9690f08 100644
--- a/app/Template/subtask/show.php
+++ b/app/Template/subtask/show.php
@@ -22,14 +22,14 @@
<tr>
<td>
<?php if (! isset($not_editable)): ?>
- <?= $this->toggleSubtaskStatus($subtask, 'task') ?>
+ <?= $this->subtask->toggleStatus($subtask, 'task') ?>
<?php else: ?>
<?= $this->render('subtask/icons', array('subtask' => $subtask)) . $this->e($subtask['title']) ?>
<?php endif ?>
</td>
<td>
<?php if (! empty($subtask['username'])): ?>
- <?= $this->a($this->e($subtask['name'] ?: $subtask['username']), 'user', 'show', array('user_id' => $subtask['user_id'])) ?>
+ <?= $this->url->link($this->e($subtask['name'] ?: $subtask['username']), 'user', 'show', array('user_id' => $subtask['user_id'])) ?>
<?php endif ?>
</td>
<td>
@@ -46,19 +46,19 @@
<ul>
<?php if ($subtask['position'] != $first_position): ?>
<li>
- <?= $this->a(t('Move Up'), 'subtask', 'movePosition', array('project_id' => $project['id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'up'), true) ?>
+ <?= $this->url->link(t('Move Up'), 'subtask', 'movePosition', array('project_id' => $project['id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'up'), true) ?>
</li>
<?php endif ?>
<?php if ($subtask['position'] != $last_position): ?>
<li>
- <?= $this->a(t('Move Down'), 'subtask', 'movePosition', array('project_id' => $project['id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'down'), true) ?>
+ <?= $this->url->link(t('Move Down'), 'subtask', 'movePosition', array('project_id' => $project['id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'down'), true) ?>
</li>
<?php endif ?>
<li>
- <?= $this->a(t('Edit'), 'subtask', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>
+ <?= $this->url->link(t('Edit'), 'subtask', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>
</li>
<li>
- <?= $this->a(t('Remove'), 'subtask', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>
+ <?= $this->url->link(t('Remove'), 'subtask', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>
</li>
</ul>
</td>
@@ -68,10 +68,10 @@
</table>
<?php if (! isset($not_editable)): ?>
- <form method="post" action="<?= $this->u('subtask', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off">
- <?= $this->formCsrf() ?>
- <?= $this->formHidden('task_id', array('task_id' => $task['id'])) ?>
- <?= $this->formText('title', array(), array(), array('required', 'placeholder="'.t('Type here to create a new sub-task').'"')) ?>
+ <form method="post" action="<?= $this->url->href('subtask', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off">
+ <?= $this->form->csrf() ?>
+ <?= $this->form->hidden('task_id', array('task_id' => $task['id'])) ?>
+ <?= $this->form->text('title', array(), array(), array('required', 'placeholder="'.t('Type here to create a new sub-task').'"')) ?>
<input type="submit" value="<?= t('Add') ?>" class="btn btn-blue"/>
</form>
<?php endif ?>