Open form to create customer filters in modal box
This commit is contained in:
@@ -18,23 +18,37 @@ class CustomFilterController extends BaseController
|
||||
* Display list of filters
|
||||
*
|
||||
* @access public
|
||||
* @param array $values
|
||||
* @param array $errors
|
||||
* @throws \Kanboard\Core\Controller\PageNotFoundException
|
||||
*/
|
||||
public function index(array $values = array(), array $errors = array())
|
||||
public function index()
|
||||
{
|
||||
$project = $this->getProject();
|
||||
|
||||
$this->response->html($this->helper->layout->project('custom_filter/index', array(
|
||||
'values' => $values + array('project_id' => $project['id']),
|
||||
'errors' => $errors,
|
||||
'project' => $project,
|
||||
'custom_filters' => $this->customFilterModel->getAll($project['id'], $this->userSession->getId()),
|
||||
'title' => t('Custom filters'),
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show creation form for custom filters
|
||||
*
|
||||
* @access public
|
||||
* @param array $values
|
||||
* @param array $errors
|
||||
*/
|
||||
public function create(array $values = array(), array $errors = array())
|
||||
{
|
||||
$project = $this->getProject();
|
||||
|
||||
$this->response->html($this->template->render('custom_filter/create', array(
|
||||
'values' => $values + array('project_id' => $project['id']),
|
||||
'errors' => $errors,
|
||||
'project' => $project,
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a new custom filter
|
||||
*
|
||||
@@ -52,13 +66,14 @@ class CustomFilterController extends BaseController
|
||||
if ($valid) {
|
||||
if ($this->customFilterModel->create($values) !== false) {
|
||||
$this->flash->success(t('Your custom filter have been created successfully.'));
|
||||
return $this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id'])));
|
||||
$this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id'])), true);
|
||||
return;
|
||||
} else {
|
||||
$this->flash->failure(t('Unable to create your custom filter.'));
|
||||
}
|
||||
}
|
||||
|
||||
return $this->index($values, $errors);
|
||||
$this->create($values, $errors);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user