summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-02-18 09:42:01 -0500
committerFrederic Guillot <fred@kanboard.net>2017-02-18 09:42:01 -0500
commitde128dbad860478496a0d655b5eb5c1005ebbabe (patch)
tree7fee510e901273472731e8e843981268c593ec40 /app/Controller
parent0430a09c069134622c0161dc2fb9ba3718a73c0d (diff)
Remove default swimlane
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/BoardPopoverController.php4
-rw-r--r--app/Controller/SwimlaneController.php90
-rw-r--r--app/Controller/TaskCreationController.php10
3 files changed, 14 insertions, 90 deletions
diff --git a/app/Controller/BoardPopoverController.php b/app/Controller/BoardPopoverController.php
index a0f5ae12..bbbe815a 100644
--- a/app/Controller/BoardPopoverController.php
+++ b/app/Controller/BoardPopoverController.php
@@ -25,7 +25,7 @@ class BoardPopoverController extends BaseController
'project' => $project,
'nb_tasks' => $this->taskFinderModel->countByColumnAndSwimlaneId($project['id'], $column_id, $swimlane_id),
'column' => $this->columnModel->getColumnTitleById($column_id),
- 'swimlane' => $this->swimlaneModel->getNameById($swimlane_id) ?: t($project['default_swimlane']),
+ 'swimlane' => $this->swimlaneModel->getNameById($swimlane_id),
'values' => array('column_id' => $column_id, 'swimlane_id' => $swimlane_id),
)));
}
@@ -41,7 +41,7 @@ class BoardPopoverController extends BaseController
$values = $this->request->getValues();
$this->taskStatusModel->closeTasksBySwimlaneAndColumn($values['swimlane_id'], $values['column_id']);
- $this->flash->success(t('All tasks of the column "%s" and the swimlane "%s" have been closed successfully.', $this->columnModel->getColumnTitleById($values['column_id']), $this->swimlaneModel->getNameById($values['swimlane_id']) ?: t($project['default_swimlane'])));
+ $this->flash->success(t('All tasks of the column "%s" and the swimlane "%s" have been closed successfully.', $this->columnModel->getColumnTitleById($values['column_id']), $this->swimlaneModel->getNameById($values['swimlane_id'])));
$this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $project['id'])));
}
}
diff --git a/app/Controller/SwimlaneController.php b/app/Controller/SwimlaneController.php
index c7c20ce8..93d19188 100644
--- a/app/Controller/SwimlaneController.php
+++ b/app/Controller/SwimlaneController.php
@@ -42,7 +42,6 @@ class SwimlaneController extends BaseController
$project = $this->getProject();
$this->response->html($this->helper->layout->project('swimlane/index', array(
- 'default_swimlane' => $this->swimlaneModel->getDefault($project['id']),
'active_swimlanes' => $this->swimlaneModel->getAllByStatus($project['id'], SwimlaneModel::ACTIVE),
'inactive_swimlanes' => $this->swimlaneModel->getAllByStatus($project['id'], SwimlaneModel::INACTIVE),
'project' => $project,
@@ -81,59 +80,16 @@ class SwimlaneController extends BaseController
list($valid, $errors) = $this->swimlaneValidator->validateCreation($values);
if ($valid) {
- if ($this->swimlaneModel->create($values) !== false) {
+ if ($this->swimlaneModel->create($project['id'], $values['name'], $values['description']) !== false) {
$this->flash->success(t('Your swimlane have been created successfully.'));
- return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
+ $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])), true);
+ return;
} else {
$errors = array('name' => array(t('Another swimlane with the same name exists in the project')));
}
}
- return $this->create($values, $errors);
- }
-
- /**
- * Edit default swimlane (display the form)
- *
- * @access public
- * @param array $values
- * @param array $errors
- * @throws \Kanboard\Core\Controller\PageNotFoundException
- */
- public function editDefault(array $values = array(), array $errors = array())
- {
- $project = $this->getProject();
- $swimlane = $this->swimlaneModel->getDefault($project['id']);
-
- $this->response->html($this->helper->layout->project('swimlane/edit_default', array(
- 'values' => empty($values) ? $swimlane : $values,
- 'errors' => $errors,
- 'project' => $project,
- )));
- }
-
- /**
- * Change the default swimlane
- *
- * @access public
- */
- public function updateDefault()
- {
- $project = $this->getProject();
-
- $values = $this->request->getValues() + array('show_default_swimlane' => 0);
- list($valid, $errors) = $this->swimlaneValidator->validateDefaultModification($values);
-
- if ($valid) {
- if ($this->swimlaneModel->updateDefault($values)) {
- $this->flash->success(t('The default swimlane have been updated successfully.'));
- return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])), true);
- } else {
- $this->flash->failure(t('Unable to update this swimlane.'));
- }
- }
-
- return $this->editDefault($values, $errors);
+ $this->create($values, $errors);
}
/**
@@ -237,25 +193,6 @@ class SwimlaneController extends BaseController
}
/**
- * Disable default swimlane
- *
- * @access public
- */
- public function disableDefault()
- {
- $this->checkCSRFParam();
- $project = $this->getProject();
-
- if ($this->swimlaneModel->disableDefault($project['id'])) {
- $this->flash->success(t('Swimlane updated successfully.'));
- } else {
- $this->flash->failure(t('Unable to update this swimlane.'));
- }
-
- $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
- }
-
- /**
* Enable a swimlane
*
* @access public
@@ -276,25 +213,6 @@ class SwimlaneController extends BaseController
}
/**
- * Enable default swimlane
- *
- * @access public
- */
- public function enableDefault()
- {
- $this->checkCSRFParam();
- $project = $this->getProject();
-
- if ($this->swimlaneModel->enableDefault($project['id'])) {
- $this->flash->success(t('Swimlane updated successfully.'));
- } else {
- $this->flash->failure(t('Unable to update this swimlane.'));
- }
-
- $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
- }
-
- /**
* Move swimlane position
*
* @access public
diff --git a/app/Controller/TaskCreationController.php b/app/Controller/TaskCreationController.php
index faf2d250..0d808c54 100644
--- a/app/Controller/TaskCreationController.php
+++ b/app/Controller/TaskCreationController.php
@@ -60,8 +60,14 @@ class TaskCreationController extends BaseController
$this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $project['id'])), true);
} else {
$task_id = $this->taskCreationModel->create($values);
- $this->flash->success(t('Task created successfully.'));
- $this->afterSave($project, $values, $task_id);
+
+ if ($task_id > 0) {
+ $this->flash->success(t('Task created successfully.'));
+ $this->afterSave($project, $values, $task_id);
+ } else {
+ $this->flash->failure(t('Unable to create this task.'));
+ $this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $project['id'])), true);
+ }
}
}