Show subtask modification forms in inline popup
This commit is contained in:
@@ -22,6 +22,7 @@ New features:
|
|||||||
|
|
||||||
Improvements:
|
Improvements:
|
||||||
|
|
||||||
|
* Use inline popup for subtasks modification
|
||||||
* Move homepage menus to the user dropdown
|
* Move homepage menus to the user dropdown
|
||||||
* Have a new task assigned to the creator by default instead of "no assignee"
|
* Have a new task assigned to the creator by default instead of "no assignee"
|
||||||
* Show progress for task links in board tooltips
|
* Show progress for task links in board tooltips
|
||||||
|
|||||||
@@ -29,6 +29,23 @@ class Subtask extends Base
|
|||||||
return $subtask;
|
return $subtask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show list of subtasks
|
||||||
|
*/
|
||||||
|
public function show()
|
||||||
|
{
|
||||||
|
$task = $this->getTask();
|
||||||
|
|
||||||
|
$this->response->html($this->helper->layout->task('subtask/show', array(
|
||||||
|
'users_list' => $this->projectUserRole->getAssignableUsersList($task['project_id']),
|
||||||
|
'task' => $task,
|
||||||
|
'project' => $this->getProject(),
|
||||||
|
'subtasks' => $this->subtask->getAll($task['id']),
|
||||||
|
'editable' => true,
|
||||||
|
'redirect' => 'subtask',
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creation form
|
* Creation form
|
||||||
*
|
*
|
||||||
@@ -73,10 +90,10 @@ class Subtask extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($values['another_subtask']) && $values['another_subtask'] == 1) {
|
if (isset($values['another_subtask']) && $values['another_subtask'] == 1) {
|
||||||
$this->response->redirect($this->helper->url->to('subtask', 'create', array('project_id' => $task['project_id'], 'task_id' => $task['id'], 'another_subtask' => 1)));
|
return $this->create(array('project_id' => $task['project_id'], 'task_id' => $task['id'], 'another_subtask' => 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']), 'subtasks'));
|
return $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']), 'subtasks'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->create($values, $errors);
|
$this->create($values, $errors);
|
||||||
@@ -122,7 +139,7 @@ class Subtask extends Base
|
|||||||
$this->flash->failure(t('Unable to update your sub-task.'));
|
$this->flash->failure(t('Unable to update your sub-task.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']), 'subtasks'));
|
return $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->edit($values, $errors);
|
$this->edit($values, $errors);
|
||||||
@@ -161,7 +178,7 @@ class Subtask extends Base
|
|||||||
$this->flash->failure(t('Unable to remove this sub-task.'));
|
$this->flash->failure(t('Unable to remove this sub-task.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']), 'subtasks'));
|
$this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -249,6 +266,8 @@ class Subtask extends Base
|
|||||||
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id'])));
|
$this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $task['project_id'])));
|
||||||
case 'dashboard':
|
case 'dashboard':
|
||||||
$this->response->redirect($this->helper->url->to('app', 'index'));
|
$this->response->redirect($this->helper->url->to('app', 'index'));
|
||||||
|
case 'subtask':
|
||||||
|
$this->response->redirect($this->helper->url->to('subtask', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
|
||||||
default:
|
default:
|
||||||
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'subtasks'));
|
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'subtasks'));
|
||||||
}
|
}
|
||||||
@@ -267,8 +286,9 @@ class Subtask extends Base
|
|||||||
$subtask_id = $this->request->getIntegerParam('subtask_id');
|
$subtask_id = $this->request->getIntegerParam('subtask_id');
|
||||||
$direction = $this->request->getStringParam('direction');
|
$direction = $this->request->getStringParam('direction');
|
||||||
$method = $direction === 'up' ? 'moveUp' : 'moveDown';
|
$method = $direction === 'up' ? 'moveUp' : 'moveDown';
|
||||||
|
$redirect = $this->request->getStringParam('redirect', 'task');
|
||||||
|
|
||||||
$this->subtask->$method($task_id, $subtask_id);
|
$this->subtask->$method($task_id, $subtask_id);
|
||||||
$this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $project_id, 'task_id' => $task_id), 'subtasks'));
|
$this->response->redirect($this->helper->url->to($redirect, 'show', array('project_id' => $project_id, 'task_id' => $task_id), 'subtasks'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<h2><?= t('Add a sub-task') ?></h2>
|
<h2><?= t('Add a sub-task') ?></h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form method="post" action="<?= $this->url->href('subtask', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off">
|
<form class="popover-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->csrf() ?>
|
||||||
<?= $this->form->hidden('task_id', $values) ?>
|
<?= $this->form->hidden('task_id', $values) ?>
|
||||||
@@ -15,6 +15,6 @@
|
|||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue">
|
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue">
|
||||||
<?= t('or') ?>
|
<?= t('or') ?>
|
||||||
<?= $this->url->link(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']), false, 'close-popover') ?>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<h2><?= t('Edit a sub-task') ?></h2>
|
<h2><?= t('Edit a sub-task') ?></h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<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">
|
<form class="popover-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->form->csrf() ?>
|
<?= $this->form->csrf() ?>
|
||||||
<?= $this->form->hidden('id', $values) ?>
|
<?= $this->form->hidden('id', $values) ?>
|
||||||
@@ -15,6 +15,6 @@
|
|||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue">
|
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue">
|
||||||
<?= t('or') ?>
|
<?= t('or') ?>
|
||||||
<?= $this->url->link(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']), false, 'close-popover') ?>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -12,6 +12,6 @@
|
|||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<?= $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') ?>
|
<?= $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') ?>
|
<?= t('or') ?>
|
||||||
<?= $this->url->link(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']), false, 'close-popover') ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
|
<div class="page-header">
|
||||||
|
<h2><?= t('Sub-Tasks') ?></h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="subtasks" class="task-show-section">
|
<div id="subtasks" class="task-show-section">
|
||||||
|
|
||||||
<?php if (! empty($subtasks)): ?>
|
<?php if (! empty($subtasks)): ?>
|
||||||
<div class="page-header">
|
|
||||||
<h2><?= t('Sub-Tasks') ?></h2>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php $first_position = $subtasks[0]['position']; ?>
|
<?php $first_position = $subtasks[0]['position']; ?>
|
||||||
<?php $last_position = $subtasks[count($subtasks) - 1]['position']; ?>
|
<?php $last_position = $subtasks[count($subtasks) - 1]['position']; ?>
|
||||||
@@ -20,7 +21,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<?php if ($editable): ?>
|
<?php if ($editable): ?>
|
||||||
<?= $this->subtask->toggleStatus($subtask, 'task') ?>
|
<?= $this->subtask->toggleStatus($subtask, $redirect) ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?= $this->render('subtask/icons', array('subtask' => $subtask)) . $this->e($subtask['title']) ?>
|
<?= $this->render('subtask/icons', array('subtask' => $subtask)) . $this->e($subtask['title']) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
@@ -66,19 +67,19 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<?php if ($subtask['position'] != $first_position): ?>
|
<?php if ($subtask['position'] != $first_position): ?>
|
||||||
<li>
|
<li>
|
||||||
<?= $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) ?>
|
<?= $this->url->link(t('Move Up'), 'subtask', 'movePosition', array('project_id' => $project['id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'up', 'redirect' => $redirect), true) ?>
|
||||||
</li>
|
</li>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php if ($subtask['position'] != $last_position): ?>
|
<?php if ($subtask['position'] != $last_position): ?>
|
||||||
<li>
|
<li>
|
||||||
<?= $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) ?>
|
<?= $this->url->link(t('Move Down'), 'subtask', 'movePosition', array('project_id' => $project['id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'down', 'redirect' => $redirect), true) ?>
|
||||||
</li>
|
</li>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<li>
|
<li>
|
||||||
<?= $this->url->link(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']), false, 'popover') ?>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<?= $this->url->link(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']), false, 'popover') ?>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -90,11 +91,6 @@
|
|||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if ($editable && $this->user->hasProjectAccess('subtask', 'save', $task['project_id'])): ?>
|
<?php if ($editable && $this->user->hasProjectAccess('subtask', 'save', $task['project_id'])): ?>
|
||||||
<?php if (empty($subtasks)): ?>
|
|
||||||
<div class="page-header">
|
|
||||||
<h2><?= t('Sub-Tasks') ?></h2>
|
|
||||||
</div>
|
|
||||||
<?php endif ?>
|
|
||||||
<form method="post" action="<?= $this->url->href('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->form->csrf() ?>
|
<?= $this->form->csrf() ?>
|
||||||
<?= $this->form->hidden('task_id', array('task_id' => $task['id'])) ?>
|
<?= $this->form->hidden('task_id', array('task_id' => $task['id'])) ?>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
'project' => $project,
|
'project' => $project,
|
||||||
'users_list' => isset($users_list) ? $users_list : array(),
|
'users_list' => isset($users_list) ? $users_list : array(),
|
||||||
'editable' => $this->user->hasProjectAccess('subtask', 'edit', $project['id']),
|
'editable' => $this->user->hasProjectAccess('subtask', 'edit', $project['id']),
|
||||||
|
'redirect' => 'task',
|
||||||
)) ?>
|
)) ?>
|
||||||
|
|
||||||
<?= $this->render('tasklink/show', array(
|
<?= $this->render('tasklink/show', array(
|
||||||
|
|||||||
@@ -22,6 +22,18 @@
|
|||||||
<?= $this->hook->render('template:task:sidebar:information') ?>
|
<?= $this->hook->render('template:task:sidebar:information') ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<h2><?= t('Sub-Tasks') ?></h2>
|
||||||
|
<ul>
|
||||||
|
<li <?= $this->app->checkMenuSelection('subtask', 'show') ?>>
|
||||||
|
<?= $this->url->link(t('View all sub-tasks'), 'subtask', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
|
||||||
|
</li>
|
||||||
|
<?php if ($this->user->hasProjectAccess('subtask', 'create', $task['project_id'])): ?>
|
||||||
|
<li <?= $this->app->checkMenuSelection('subtask', 'create') ?>>
|
||||||
|
<?= $this->url->link(t('Add a sub-task'), 'subtask', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
|
||||||
|
</li>
|
||||||
|
<?php endif ?>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<h2><?= t('Links') ?></h2>
|
<h2><?= t('Links') ?></h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li <?= $this->app->checkMenuSelection('tasklink', 'show') ?>>
|
<li <?= $this->app->checkMenuSelection('tasklink', 'show') ?>>
|
||||||
@@ -52,9 +64,6 @@
|
|||||||
<li <?= $this->app->checkMenuSelection('taskmodification', 'recurrence') ?>>
|
<li <?= $this->app->checkMenuSelection('taskmodification', 'recurrence') ?>>
|
||||||
<?= $this->url->link(t('Edit recurrence'), 'taskmodification', 'recurrence', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
|
<?= $this->url->link(t('Edit recurrence'), 'taskmodification', 'recurrence', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
|
||||||
</li>
|
</li>
|
||||||
<li <?= $this->app->checkMenuSelection('subtask', 'create') ?>>
|
|
||||||
<?= $this->url->link(t('Add a sub-task'), 'subtask', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
|
|
||||||
</li>
|
|
||||||
<li <?= $this->app->checkMenuSelection('comment', 'create') ?>>
|
<li <?= $this->app->checkMenuSelection('comment', 'create') ?>>
|
||||||
<?= $this->url->link(t('Add a comment'), 'comment', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
|
<?= $this->url->link(t('Add a comment'), 'comment', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -13,7 +13,7 @@ Popover.prototype.open = function(link) {
|
|||||||
self.app.dropdown.close();
|
self.app.dropdown.close();
|
||||||
|
|
||||||
$.get(link, function(content) {
|
$.get(link, function(content) {
|
||||||
$("body").append('<div id="popover-container"><div id="popover-content">' + content + '</div></div>');
|
$("body").prepend('<div id="popover-container"><div id="popover-content">' + content + '</div></div>');
|
||||||
self.app.refresh();
|
self.app.refresh();
|
||||||
self.router.dispatch(this.app);
|
self.router.dispatch(this.app);
|
||||||
self.afterOpen();
|
self.afterOpen();
|
||||||
@@ -91,7 +91,7 @@ Popover.prototype.afterSubmit = function(data, request, self) {
|
|||||||
var redirect = request.getResponseHeader("X-Ajax-Redirect");
|
var redirect = request.getResponseHeader("X-Ajax-Redirect");
|
||||||
|
|
||||||
if (redirect) {
|
if (redirect) {
|
||||||
window.location = redirect === 'self' ? window.location.href : redirect;
|
window.location = redirect === 'self' ? window.location.href.split("#")[0] : redirect;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$("#popover-content").html(data);
|
$("#popover-content").html(data);
|
||||||
|
|||||||
Reference in New Issue
Block a user