From 346151e103431e8de12520b26daae10676b8faf5 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Wed, 3 Feb 2016 20:53:07 -0500 Subject: [PATCH] Add dropdown menu with inline popup for all task actions --- ChangeLog | 1 + app/Controller/Comment.php | 2 +- app/Controller/File.php | 2 +- app/Controller/TaskRecurrence.php | 61 +++++++++++++ app/Controller/Taskduplication.php | 2 +- app/Controller/Taskmodification.php | 41 --------- app/Helper/Layout.php | 2 +- .../AuthenticationProvider.php | 1 + app/ServiceProvider/RouteProvider.php | 25 +----- app/Template/comment/edit.php | 6 +- app/Template/comment/remove.php | 2 +- app/Template/comment/show.php | 4 +- app/Template/file/new.php | 4 +- app/Template/subtask/menu.php | 21 +++++ app/Template/subtask/show.php | 31 +++---- app/Template/task/layout.php | 3 + app/Template/task/menu.php | 72 +++++++++++++++ app/Template/task/remove.php | 2 +- app/Template/task/sidebar.php | 88 +++---------------- app/Template/task_duplication/copy.php | 6 +- app/Template/task_duplication/duplicate.php | 2 +- app/Template/task_duplication/move.php | 6 +- app/Template/task_external_link/remove.php | 2 +- app/Template/task_external_link/show.php | 4 +- .../edit.php} | 6 +- 25 files changed, 207 insertions(+), 189 deletions(-) create mode 100644 app/Controller/TaskRecurrence.php create mode 100644 app/Template/subtask/menu.php create mode 100644 app/Template/task/menu.php rename app/Template/{task_modification/edit_recurrence.php => task_recurrence/edit.php} (88%) diff --git a/ChangeLog b/ChangeLog index 8f48abaae..7e4bdad69 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,7 @@ New features: Improvements: +* Add dropdown menu with inline popup for all task actions * Change sidebar style * Change task summary layout * Use inline popup for subtasks modification diff --git a/app/Controller/Comment.php b/app/Controller/Comment.php index 1e94779f3..2ad3f379c 100644 --- a/app/Controller/Comment.php +++ b/app/Controller/Comment.php @@ -119,7 +119,7 @@ class Comment extends Base $this->flash->failure(t('Unable to update your comment.')); } - return $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comment-'.$comment['id'])); + return $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), false); } $this->edit($values, $errors); diff --git a/app/Controller/File.php b/app/Controller/File.php index b347f67ff..50db3865c 100644 --- a/app/Controller/File.php +++ b/app/Controller/File.php @@ -59,7 +59,7 @@ class File extends Base $this->flash->failure(t('Unable to upload the file.')); } - $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); + $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); } /** diff --git a/app/Controller/TaskRecurrence.php b/app/Controller/TaskRecurrence.php new file mode 100644 index 000000000..f02f3cdcb --- /dev/null +++ b/app/Controller/TaskRecurrence.php @@ -0,0 +1,61 @@ +getTask(); + + if (empty($values)) { + $values = $task; + } + + $this->response->html($this->helper->layout->task('task_recurrence/edit', array( + 'values' => $values, + 'errors' => $errors, + 'task' => $task, + 'recurrence_status_list' => $this->task->getRecurrenceStatusList(), + 'recurrence_trigger_list' => $this->task->getRecurrenceTriggerList(), + 'recurrence_timeframe_list' => $this->task->getRecurrenceTimeframeList(), + 'recurrence_basedate_list' => $this->task->getRecurrenceBasedateList(), + ))); + } + + /** + * Update recurrence form + * + * @access public + */ + public function update() + { + $task = $this->getTask(); + $values = $this->request->getValues(); + + list($valid, $errors) = $this->taskValidator->validateEditRecurrence($values); + + if ($valid) { + if ($this->taskModification->update($values)) { + $this->flash->success(t('Task updated successfully.')); + } else { + $this->flash->failure(t('Unable to update your task.')); + } + + $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); + } + + $this->edit($values, $errors); + } +} diff --git a/app/Controller/Taskduplication.php b/app/Controller/Taskduplication.php index f940eee36..7e7fccd63 100644 --- a/app/Controller/Taskduplication.php +++ b/app/Controller/Taskduplication.php @@ -28,7 +28,7 @@ class Taskduplication extends Base $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task_id))); } else { $this->flash->failure(t('Unable to create this task.')); - $this->response->redirect($this->helper->url->to('taskduplication', 'duplicate', array('project_id' => $task['project_id'], 'task_id' => $task['id']))); + $this->response->redirect($this->helper->url->to('taskduplication', 'duplicate', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); } } diff --git a/app/Controller/Taskmodification.php b/app/Controller/Taskmodification.php index cae1d8ee5..0e9316b28 100644 --- a/app/Controller/Taskmodification.php +++ b/app/Controller/Taskmodification.php @@ -138,45 +138,4 @@ class Taskmodification extends Base $this->edit($values, $errors); } } - - /** - * Edit recurrence form - * - * @access public - */ - public function recurrence() - { - $task = $this->getTask(); - - if ($this->request->isPost()) { - $values = $this->request->getValues(); - - list($valid, $errors) = $this->taskValidator->validateEditRecurrence($values); - - if ($valid) { - if ($this->taskModification->update($values)) { - $this->flash->success(t('Task updated successfully.')); - } else { - $this->flash->failure(t('Unable to update your task.')); - } - - $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']))); - } - } else { - $values = $task; - $errors = array(); - } - - $params = array( - 'values' => $values, - 'errors' => $errors, - 'task' => $task, - 'recurrence_status_list' => $this->task->getRecurrenceStatusList(), - 'recurrence_trigger_list' => $this->task->getRecurrenceTriggerList(), - 'recurrence_timeframe_list' => $this->task->getRecurrenceTimeframeList(), - 'recurrence_basedate_list' => $this->task->getRecurrenceBasedateList(), - ); - - $this->response->html($this->helper->layout->task('task_modification/edit_recurrence', $params)); - } } diff --git a/app/Helper/Layout.php b/app/Helper/Layout.php index 8c00a3113..3db239200 100644 --- a/app/Helper/Layout.php +++ b/app/Helper/Layout.php @@ -60,7 +60,7 @@ class Layout extends Base */ public function task($template, array $params) { - $params['title'] = '#'.$params['task']['id'].' '.$params['task']['title']; + $params['title'] = $params['task']['title']; return $this->subLayout('task/layout', 'task/sidebar', $template, $params); } diff --git a/app/ServiceProvider/AuthenticationProvider.php b/app/ServiceProvider/AuthenticationProvider.php index aaf23083a..dac731607 100644 --- a/app/ServiceProvider/AuthenticationProvider.php +++ b/app/ServiceProvider/AuthenticationProvider.php @@ -87,6 +87,7 @@ class AuthenticationProvider implements ServiceProviderInterface $acl->add('Task', 'remove', Role::PROJECT_MEMBER); $acl->add('Taskcreation', '*', Role::PROJECT_MEMBER); $acl->add('Taskduplication', '*', Role::PROJECT_MEMBER); + $acl->add('TaskRecurrence', '*', Role::PROJECT_MEMBER); $acl->add('TaskImport', '*', Role::PROJECT_MANAGER); $acl->add('Tasklink', '*', Role::PROJECT_MEMBER); $acl->add('Tasklink', array('show'), Role::PROJECT_VIEWER); diff --git a/app/ServiceProvider/RouteProvider.php b/app/ServiceProvider/RouteProvider.php index 78c46bc46..7064884eb 100644 --- a/app/ServiceProvider/RouteProvider.php +++ b/app/ServiceProvider/RouteProvider.php @@ -107,31 +107,10 @@ class RouteProvider implements ServiceProviderInterface $container['route']->addRoute('project/:project_id/task/:task_id/activity', 'activity', 'task'); $container['route']->addRoute('project/:project_id/task/:task_id/screenshot', 'file', 'screenshot'); $container['route']->addRoute('project/:project_id/task/:task_id/upload', 'file', 'create'); - $container['route']->addRoute('project/:project_id/task/:task_id/comment', 'comment', 'create'); - $container['route']->addRoute('project/:project_id/task/:task_id/links', 'tasklink', 'show'); - $container['route']->addRoute('project/:project_id/task/:task_id/link', 'tasklink', 'create'); $container['route']->addRoute('project/:project_id/task/:task_id/transitions', 'task', 'transitions'); $container['route']->addRoute('project/:project_id/task/:task_id/analytics', 'task', 'analytics'); - $container['route']->addRoute('project/:project_id/task/:task_id/remove', 'task', 'remove'); - - $container['route']->addRoute('project/:project_id/task/:task_id/links/external', 'TaskExternalLink', 'show'); - $container['route']->addRoute('project/:project_id/task/:task_id/link/external/new', 'TaskExternalLink', 'find'); - $container['route']->addRoute('project/:project_id/task/:task_id/link/external/save', 'TaskExternalLink', 'create'); - $container['route']->addRoute('project/:project_id/task/:task_id/link/external/:link_id', 'TaskExternalLink', 'edit'); - $container['route']->addRoute('project/:project_id/task/:task_id/link/external/:link_id/remove', 'TaskExternalLink', 'confirm'); - - $container['route']->addRoute('project/:project_id/task/:task_id/edit', 'taskmodification', 'edit'); - $container['route']->addRoute('project/:project_id/task/:task_id/description', 'taskmodification', 'description'); - $container['route']->addRoute('project/:project_id/task/:task_id/recurrence', 'taskmodification', 'recurrence'); - - $container['route']->addRoute('project/:project_id/task/:task_id/close', 'taskstatus', 'close'); - $container['route']->addRoute('project/:project_id/task/:task_id/open', 'taskstatus', 'open'); - - $container['route']->addRoute('project/:project_id/task/:task_id/duplicate', 'taskduplication', 'duplicate'); - $container['route']->addRoute('project/:project_id/task/:task_id/copy', 'taskduplication', 'copy'); - $container['route']->addRoute('project/:project_id/task/:task_id/copy/:dst_project_id', 'taskduplication', 'copy'); - $container['route']->addRoute('project/:project_id/task/:task_id/move', 'taskduplication', 'move'); - $container['route']->addRoute('project/:project_id/task/:task_id/move/:dst_project_id', 'taskduplication', 'move'); + $container['route']->addRoute('project/:project_id/task/:task_id/internal/links', 'tasklink', 'show'); + $container['route']->addRoute('project/:project_id/task/:task_id/external/links', 'TaskExternalLink', 'show'); // Exports $container['route']->addRoute('export/tasks/:project_id', 'export', 'tasks'); diff --git a/app/Template/comment/edit.php b/app/Template/comment/edit.php index e01f3da49..6db952ccc 100644 --- a/app/Template/comment/edit.php +++ b/app/Template/comment/edit.php @@ -2,7 +2,7 @@

-
+ form->csrf() ?> form->hidden('id', $values) ?> @@ -29,8 +29,8 @@
url->doc(t('Write your text in Markdown'), 'syntax-guide') ?>
- + - url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
diff --git a/app/Template/comment/remove.php b/app/Template/comment/remove.php index afc3346f7..1b5004f4a 100644 --- a/app/Template/comment/remove.php +++ b/app/Template/comment/remove.php @@ -12,6 +12,6 @@
url->link(t('Yes'), 'comment', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id']), true, 'btn btn-red') ?> - url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
\ No newline at end of file diff --git a/app/Template/comment/show.php b/app/Template/comment/show.php index 444576535..26b300e87 100644 --- a/app/Template/comment/show.php +++ b/app/Template/comment/show.php @@ -18,10 +18,10 @@
  • user->isAdmin() || $this->user->isCurrentUser($comment['user_id']))): ?>
  • - url->link(t('remove'), 'comment', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id'])) ?> + url->link(t('remove'), 'comment', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id']), false, 'popover') ?>
  • - url->link(t('edit'), 'comment', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id'])) ?> + url->link(t('edit'), 'comment', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id']), false, 'popover') ?>
  • diff --git a/app/Template/file/new.php b/app/Template/file/new.php index a1a59eaef..1702638dc 100644 --- a/app/Template/file/new.php +++ b/app/Template/file/new.php @@ -7,8 +7,8 @@
    text->bytes($max_size) : $max_size ?>
    - + - url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
    \ No newline at end of file diff --git a/app/Template/subtask/menu.php b/app/Template/subtask/menu.php new file mode 100644 index 000000000..f14b09b23 --- /dev/null +++ b/app/Template/subtask/menu.php @@ -0,0 +1,21 @@ + diff --git a/app/Template/subtask/show.php b/app/Template/subtask/show.php index 027e94956..cf56a1dee 100644 --- a/app/Template/subtask/show.php +++ b/app/Template/subtask/show.php @@ -62,32 +62,21 @@ - + render('subtask/menu', array( + 'project' => $project, + 'task' => $task, + 'subtask' => $subtask, + 'redirect' => $redirect, + 'first_position' => $first_position, + 'last_position' => $last_position, + )) ?> + +

    user->hasProjectAccess('subtask', 'save', $task['project_id'])): ?> diff --git a/app/Template/task/layout.php b/app/Template/task/layout.php index 070ae37d0..9cbbfec9d 100644 --- a/app/Template/task/layout.php +++ b/app/Template/task/layout.php @@ -1,6 +1,9 @@
    \ No newline at end of file diff --git a/app/Template/task/sidebar.php b/app/Template/task/sidebar.php index c184e095f..c60a18109 100644 --- a/app/Template/task/sidebar.php +++ b/app/Template/task/sidebar.php @@ -1,5 +1,5 @@ diff --git a/app/Template/task_duplication/copy.php b/app/Template/task_duplication/copy.php index 415b86100..fe2c599a1 100644 --- a/app/Template/task_duplication/copy.php +++ b/app/Template/task_duplication/copy.php @@ -6,7 +6,7 @@

    -
    + form->csrf() ?> form->hidden('id', $values) ?> @@ -39,9 +39,9 @@

    - + - url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
    diff --git a/app/Template/task_duplication/duplicate.php b/app/Template/task_duplication/duplicate.php index 4b50d9ca0..376f6b3bd 100644 --- a/app/Template/task_duplication/duplicate.php +++ b/app/Template/task_duplication/duplicate.php @@ -10,6 +10,6 @@
    url->link(t('Yes'), 'taskduplication', 'duplicate', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?> - url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
    \ No newline at end of file diff --git a/app/Template/task_duplication/move.php b/app/Template/task_duplication/move.php index d8d1ba056..8ab81f5bf 100644 --- a/app/Template/task_duplication/move.php +++ b/app/Template/task_duplication/move.php @@ -6,7 +6,7 @@

    -
    + form->csrf() ?> form->hidden('id', $values) ?> @@ -39,9 +39,9 @@

    - + - url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
    diff --git a/app/Template/task_external_link/remove.php b/app/Template/task_external_link/remove.php index f55e751cb..015352552 100644 --- a/app/Template/task_external_link/remove.php +++ b/app/Template/task_external_link/remove.php @@ -10,6 +10,6 @@
    url->link(t('Yes'), 'TaskExternalLink', 'remove', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), true, 'btn btn-red') ?> - url->link(t('cancel'), 'TaskExternalLink', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + url->link(t('cancel'), 'TaskExternalLink', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
    \ No newline at end of file diff --git a/app/Template/task_external_link/show.php b/app/Template/task_external_link/show.php index 7e8b1948d..2dc3d1dd1 100644 --- a/app/Template/task_external_link/show.php +++ b/app/Template/task_external_link/show.php @@ -38,8 +38,8 @@ diff --git a/app/Template/task_modification/edit_recurrence.php b/app/Template/task_recurrence/edit.php similarity index 88% rename from app/Template/task_modification/edit_recurrence.php rename to app/Template/task_recurrence/edit.php index dc4faa7a7..3c7f23182 100644 --- a/app/Template/task_modification/edit_recurrence.php +++ b/app/Template/task_recurrence/edit.php @@ -15,7 +15,7 @@ -
    + form->csrf() ?> @@ -38,9 +38,9 @@ form->select('recurrence_basedate', $recurrence_basedate_list, $values, $errors) ?>
    - + - url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?> + url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>