go back to calendar after editing and creation of time-records (#519)

This commit is contained in:
Kevin Papst
2019-01-23 17:30:45 +01:00
committed by GitHub
parent ee32d6f926
commit 572f01ed74
9 changed files with 38 additions and 27 deletions

View File

@@ -77,7 +77,7 @@ trait TimesheetControllerTrait
*/
protected function edit(Timesheet $entry, Request $request, $redirectRoute, $renderTemplate)
{
$editForm = $this->getEditForm($entry, $request->get('page'));
$editForm = $this->getEditForm($entry, $request->get('page'), $request->get('origin', 'timesheet'));
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
@@ -154,7 +154,7 @@ trait TimesheetControllerTrait
}
}
$createForm = $this->getCreateForm($entry);
$createForm = $this->getCreateForm($entry, $redirectRoute);
$createForm->handleRequest($request);
if ($createForm->isSubmitted() && $createForm->isValid()) {
@@ -203,16 +203,18 @@ trait TimesheetControllerTrait
/**
* @param Timesheet $entry
* @param string $redirectRoute
* @return \Symfony\Component\Form\FormInterface
*/
abstract protected function getCreateForm(Timesheet $entry);
abstract protected function getCreateForm(Timesheet $entry, string $redirectRoute);
/**
* @param Timesheet $entry
* @param int $page
* @param string $redirectRoute
* @return \Symfony\Component\Form\FormInterface
*/
abstract protected function getEditForm(Timesheet $entry, $page);
abstract protected function getEditForm(Timesheet $entry, $page, string $redirectRoute);
/**
* Adds a "successful" flash message to the stack.