From 797e69720908a9e2960dca1d1781c1eda1f6e8fd Mon Sep 17 00:00:00 2001 From: Wim Rijnders Date: Mon, 21 Jan 2013 08:41:50 +0100 Subject: [PATCH] Refresh redirects back to calling page. --- src/GitList/Controller/MainController.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/GitList/Controller/MainController.php b/src/GitList/Controller/MainController.php index d7d4f63..96144ac 100644 --- a/src/GitList/Controller/MainController.php +++ b/src/GitList/Controller/MainController.php @@ -5,6 +5,7 @@ namespace GitList\Controller; use Silex\Application; use Silex\ControllerProviderInterface; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\Request; class MainController implements ControllerProviderInterface { @@ -21,17 +22,11 @@ class MainController implements ControllerProviderInterface })->bind('homepage'); - $route->get('/refresh', function() use ($app ) { + $route->get('/refresh', function(Request $request) use ($app ) { $app['git']->deleteCached(); - # These don't work: - #echo sfContext::getInstance()->getRequest()->getReferer(); - #$app->redirect($request->attributes->get('referer')); - #$app->redirect( $app->getRequest()->getReferer() ); - - # TODO: Fix following to return to referring page - # Or get rid of hardcoded path - return $app->redirect( "/gitlist/"); + # Go back to calling page + return $app->redirect($request->headers->get('Referer')); })->bind('refresh');