Remove default swimlane
This commit is contained in:
@@ -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'])));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -236,25 +192,6 @@ class SwimlaneController extends BaseController
|
||||
$this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -275,25 +212,6 @@ class SwimlaneController extends BaseController
|
||||
$this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user