-
-
- = $this->url->link(t('View all groups'), 'group', 'index') ?> -
- = $this->url->link(t('View group members'), 'group', 'users', array('group_id' => $group['id'])) ?> -
= t('There is no user available.') ?>
- - - -diff --git a/app/Controller/GroupHelper.php b/app/Controller/GroupAjaxController.php
similarity index 76%
rename from app/Controller/GroupHelper.php
rename to app/Controller/GroupAjaxController.php
index 06e5ec711..496e9ef2f 100644
--- a/app/Controller/GroupHelper.php
+++ b/app/Controller/GroupAjaxController.php
@@ -5,12 +5,12 @@ namespace Kanboard\Controller;
use Kanboard\Formatter\GroupAutoCompleteFormatter;
/**
- * Group Helper
+ * Group Ajax Controller
*
- * @package controller
- * @author Frederic Guillot
+ * @package Kanboard\Controller
+ * @author Frederic Guillot
*/
-class GroupHelper extends BaseController
+class GroupAjaxController extends BaseController
{
/**
* Group auto-completion (Ajax)
diff --git a/app/Controller/GroupCreationController.php b/app/Controller/GroupCreationController.php
new file mode 100644
index 000000000..7d0bb93cc
--- /dev/null
+++ b/app/Controller/GroupCreationController.php
@@ -0,0 +1,49 @@
+response->html($this->template->render('group_creation/show', array(
+ 'errors' => $errors,
+ 'values' => $values,
+ )));
+ }
+
+ /**
+ * Validate and save a new group
+ *
+ * @access public
+ */
+ public function save()
+ {
+ $values = $this->request->getValues();
+ list($valid, $errors) = $this->groupValidator->validateCreation($values);
+
+ if ($valid) {
+ if ($this->group->create($values['name']) !== false) {
+ $this->flash->success(t('Group created successfully.'));
+ return $this->response->redirect($this->helper->url->to('GroupListController', 'index'), true);
+ } else {
+ $this->flash->failure(t('Unable to create your group.'));
+ }
+ }
+
+ return $this->show($values, $errors);
+ }
+}
diff --git a/app/Controller/Group.php b/app/Controller/GroupListController.php
similarity index 56%
rename from app/Controller/Group.php
rename to app/Controller/GroupListController.php
index 2f91e72ab..17f3b2a96 100644
--- a/app/Controller/Group.php
+++ b/app/Controller/GroupListController.php
@@ -5,10 +5,10 @@ namespace Kanboard\Controller;
/**
* Group Controller
*
- * @package controller
- * @author Frederic Guillot
+ * @package Kanboard\Controller
+ * @author Frederic Guillot
*/
-class Group extends BaseController
+class GroupListController extends BaseController
{
/**
* List all groups
@@ -18,7 +18,7 @@ class Group extends BaseController
public function index()
{
$paginator = $this->paginator
- ->setUrl('group', 'index')
+ ->setUrl('GroupListController', 'index')
->setMax(30)
->setOrder('name')
->setQuery($this->group->getQuery())
@@ -41,7 +41,7 @@ class Group extends BaseController
$group = $this->group->getById($group_id);
$paginator = $this->paginator
- ->setUrl('group', 'users', array('group_id' => $group_id))
+ ->setUrl('GroupListController', 'users', array('group_id' => $group_id))
->setMax(30)
->setOrder('username')
->setQuery($this->groupMember->getQuery($group_id))
@@ -54,86 +54,6 @@ class Group extends BaseController
)));
}
- /**
- * Display a form to create a new group
- *
- * @access public
- * @param array $values
- * @param array $errors
- */
- public function create(array $values = array(), array $errors = array())
- {
- $this->response->html($this->helper->layout->app('group/create', array(
- 'errors' => $errors,
- 'values' => $values,
- 'title' => t('New group')
- )));
- }
-
- /**
- * Validate and save a new group
- *
- * @access public
- */
- public function save()
- {
- $values = $this->request->getValues();
- list($valid, $errors) = $this->groupValidator->validateCreation($values);
-
- if ($valid) {
- if ($this->group->create($values['name']) !== false) {
- $this->flash->success(t('Group created successfully.'));
- return $this->response->redirect($this->helper->url->to('group', 'index'));
- } else {
- $this->flash->failure(t('Unable to create your group.'));
- }
- }
-
- return $this->create($values, $errors);
- }
-
- /**
- * Display a form to update a group
- *
- * @access public
- * @param array $values
- * @param array $errors
- */
- public function edit(array $values = array(), array $errors = array())
- {
- if (empty($values)) {
- $values = $this->group->getById($this->request->getIntegerParam('group_id'));
- }
-
- $this->response->html($this->helper->layout->app('group/edit', array(
- 'errors' => $errors,
- 'values' => $values,
- 'title' => t('Edit group')
- )));
- }
-
- /**
- * Validate and save a group
- *
- * @access public
- */
- public function update()
- {
- $values = $this->request->getValues();
- list($valid, $errors) = $this->groupValidator->validateModification($values);
-
- if ($valid) {
- if ($this->group->update($values) !== false) {
- $this->flash->success(t('Group updated successfully.'));
- return $this->response->redirect($this->helper->url->to('group', 'index'));
- } else {
- $this->flash->failure(t('Unable to update your group.'));
- }
- }
-
- return $this->edit($values, $errors);
- }
-
/**
* Form to associate a user to a group
*
@@ -150,12 +70,11 @@ class Group extends BaseController
$values['group_id'] = $group_id;
}
- $this->response->html($this->helper->layout->app('group/associate', array(
+ $this->response->html($this->template->render('group/associate', array(
'users' => $this->user->prepareList($this->groupMember->getNotMembers($group_id)),
'group' => $group,
'errors' => $errors,
'values' => $values,
- 'title' => t('Add group member to "%s"', $group['name']),
)));
}
@@ -171,7 +90,7 @@ class Group extends BaseController
if (isset($values['group_id']) && isset($values['user_id'])) {
if ($this->groupMember->addUser($values['group_id'], $values['user_id'])) {
$this->flash->success(t('Group member added successfully.'));
- return $this->response->redirect($this->helper->url->to('group', 'users', array('group_id' => $values['group_id'])));
+ return $this->response->redirect($this->helper->url->to('GroupListController', 'users', array('group_id' => $values['group_id'])), true);
} else {
$this->flash->failure(t('Unable to add group member.'));
}
@@ -192,10 +111,9 @@ class Group extends BaseController
$group = $this->group->getById($group_id);
$user = $this->user->getById($user_id);
- $this->response->html($this->helper->layout->app('group/dissociate', array(
+ $this->response->html($this->template->render('group/dissociate', array(
'group' => $group,
'user' => $user,
- 'title' => t('Remove user from group "%s"', $group['name']),
)));
}
@@ -216,7 +134,7 @@ class Group extends BaseController
$this->flash->failure(t('Unable to remove this user from the group.'));
}
- $this->response->redirect($this->helper->url->to('group', 'users', array('group_id' => $group_id)));
+ $this->response->redirect($this->helper->url->to('GroupListController', 'users', array('group_id' => $group_id)), true);
}
/**
@@ -229,9 +147,8 @@ class Group extends BaseController
$group_id = $this->request->getIntegerParam('group_id');
$group = $this->group->getById($group_id);
- $this->response->html($this->helper->layout->app('group/remove', array(
+ $this->response->html($this->template->render('group/remove', array(
'group' => $group,
- 'title' => t('Remove group'),
)));
}
@@ -251,6 +168,6 @@ class Group extends BaseController
$this->flash->failure(t('Unable to remove this group.'));
}
- $this->response->redirect($this->helper->url->to('group', 'index'));
+ $this->response->redirect($this->helper->url->to('GroupListController', 'index'), true);
}
}
diff --git a/app/Controller/GroupModificationController.php b/app/Controller/GroupModificationController.php
new file mode 100644
index 000000000..1f225a14e
--- /dev/null
+++ b/app/Controller/GroupModificationController.php
@@ -0,0 +1,53 @@
+group->getById($this->request->getIntegerParam('group_id'));
+ }
+
+ $this->response->html($this->template->render('group_modification/show', array(
+ 'errors' => $errors,
+ 'values' => $values,
+ )));
+ }
+
+ /**
+ * Validate and save a group
+ *
+ * @access public
+ */
+ public function save()
+ {
+ $values = $this->request->getValues();
+ list($valid, $errors) = $this->groupValidator->validateModification($values);
+
+ if ($valid) {
+ if ($this->group->update($values) !== false) {
+ $this->flash->success(t('Group updated successfully.'));
+ return $this->response->redirect($this->helper->url->to('GroupListController', 'index'), true);
+ } else {
+ $this->flash->failure(t('Unable to update your group.'));
+ }
+ }
+
+ return $this->show($values, $errors);
+ }
+}
diff --git a/app/ServiceProvider/AuthenticationProvider.php b/app/ServiceProvider/AuthenticationProvider.php
index 82f61e111..5540bf889 100644
--- a/app/ServiceProvider/AuthenticationProvider.php
+++ b/app/ServiceProvider/AuthenticationProvider.php
@@ -132,7 +132,9 @@ class AuthenticationProvider implements ServiceProviderInterface
$acl->add('Config', '*', Role::APP_ADMIN);
$acl->add('Currency', '*', Role::APP_ADMIN);
$acl->add('Gantt', array('projects', 'saveProjectDate'), Role::APP_MANAGER);
- $acl->add('Group', '*', Role::APP_ADMIN);
+ $acl->add('GroupListController', '*', Role::APP_ADMIN);
+ $acl->add('GroupCreationController', '*', Role::APP_ADMIN);
+ $acl->add('GroupModificationController', '*', Role::APP_ADMIN);
$acl->add('Link', '*', Role::APP_ADMIN);
$acl->add('ProjectCreation', 'create', Role::APP_MANAGER);
$acl->add('Projectuser', '*', Role::APP_MANAGER);
diff --git a/app/ServiceProvider/RouteProvider.php b/app/ServiceProvider/RouteProvider.php
index 2788e3a7e..a6d6abef8 100644
--- a/app/ServiceProvider/RouteProvider.php
+++ b/app/ServiceProvider/RouteProvider.php
@@ -161,13 +161,8 @@ class RouteProvider implements ServiceProviderInterface
$container['route']->addRoute('user/:user_id/avatar', 'AvatarFile', 'show');
// Groups
- $container['route']->addRoute('groups', 'group', 'index');
- $container['route']->addRoute('groups/create', 'group', 'create');
- $container['route']->addRoute('group/:group_id/associate', 'group', 'associate');
- $container['route']->addRoute('group/:group_id/dissociate/:user_id', 'group', 'dissociate');
- $container['route']->addRoute('group/:group_id/edit', 'group', 'edit');
- $container['route']->addRoute('group/:group_id/members', 'group', 'users');
- $container['route']->addRoute('group/:group_id/remove', 'group', 'confirm');
+ $container['route']->addRoute('groups', 'GroupListController', 'index');
+ $container['route']->addRoute('group/:group_id/members', 'GroupListController', 'users');
// Config
$container['route']->addRoute('settings', 'config', 'index');
diff --git a/app/Template/group/associate.php b/app/Template/group/associate.php
index 9de46f35a..87787568d 100644
--- a/app/Template/group/associate.php
+++ b/app/Template/group/associate.php
@@ -1,25 +1,20 @@
- = t('There is no user available.') ?>
-
-
= t('Do you really want to remove the user "%s" from the group "%s"?', $user['name'] ?: $user['username'], $group['name']) ?>
+= t('Do you really want to remove the user "%s" from the group "%s"?', $user['name'] ?: $user['username'], $group['name']) ?>
-= t('Do you really want to remove this group: "%s"?', $group['name']) ?>
+= t('Do you really want to remove this group: "%s"?', $group['name']) ?>
-