Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Update Resources/js/router_test.html #1

Merged
merged 9 commits into from

5 participants

ConneXNL Jacek Jędrzejewski Christophe Coevoet Daniel William Durand
Commits on Mar 27, 2012
  1. Jacek Jędrzejewski
  2. Jacek Jędrzejewski
  3. Jacek Jędrzejewski

    coding standards

    eXtreme authored
  4. Christophe Coevoet

    Merge pull request #26 from eXtreme/master

    stof authored
    Keep current flashes for one more request
  5. Christophe Coevoet
Commits on Apr 6, 2012
  1. Daniel
  2. Daniel

    Fixed indentation.

    hdramos authored
  3. William Durand

    Merge pull request #28 from dramos/patch-1

    willdurand authored
    Added how to install using the vendors script.
Commits on Apr 10, 2012
This page is out of date. Refresh to see the latest.
16 Controller/Controller.php
View
@@ -17,6 +17,8 @@
use Symfony\Component\Config\ConfigCache;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\HttpKernel\Kernel;
+use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag;
/**
* Controller class.
@@ -57,6 +59,20 @@ public function __construct($serializer, ExposedRoutesExtractorInterface $expose
*/
public function indexAction(Request $request, $_format)
{
+ if (version_compare(Kernel::VERSION, '2.1.0-dev', '<')) {
+ if (null !== $session = $request->getSession()) {
+ // keep current flashes for one more request
+ $session->setFlashes($session->getFlashes());
+ }
+ } else {
+ $session = $request->getSession();
+
+ if (null !== $session && $session->getFlashBag() instanceof AutoExpireFlashBag) {
+ // keep current flashes for one more request if using AutoExpireFlashBag
+ $session->getFlashBag()->setAll($session->getFlashBag()->peekAll());
+ }
+ }
+
$cache = new ConfigCache($this->cacheDir.'/fosJsRouting.json', $this->debug);
if (!$cache->isFresh()) {
$content = $this->serializer->serialize(
8 Resources/doc/README.markdown
View
@@ -9,6 +9,14 @@ Installation
Add this bundle as a submodule:
git submodule add git://github.com/FriendsOfSymfony/FOSJsRoutingBundle.git vendor/bundles/FOS/JsRoutingBundle
+
+Or add the following lines in your `deps` file:
+
+``` ini
+[FOSJsRoutingBundle]
+ git=git://github.com/FriendsOfSymfony/FOSJsRoutingBundle.git
+ target=/bundles/FOS/JsRoutingBundle
+```
Register the namespace in `app/autoload.php`:
12 Resources/js/router_test.html
View
@@ -54,6 +54,18 @@
assertEquals('/posts', router.generate('posts'));
assertEquals('/posts.json', router.generate('posts', {'_format': 'json'}));
}
+
+ function testGenerateQueryStringWithoutDefaults() {
+ var router = new fos.Router({base_url: ''}, {
+ posts: {
+ tokens: [['variable', '/', '[1-9]+[0-9]*', 'page'], ['text', '/blog-posts']],
+ defaults: {'page' : 1}
+ }
+ });
+
+ assertEquals('/blog-posts?extra=1', router.generate('posts', {page: 1, extra: 1}));
+ }
+
function testAllowSlashes() {
var router = new fos.Router({base_url: ''}, {
posts: {
2  vendor/vendors.php
View
@@ -14,7 +14,7 @@
$vendorDir = __DIR__;
$deps = array(
- array('symfony', 'http://github.com/symfony/symfony', isset($_SERVER['SYMFONY_VERSION']) ? $_SERVER['SYMFONY_VERSION'] : 'origin/master'),
+ array('symfony', 'git://github.com/symfony/symfony.git', isset($_SERVER['SYMFONY_VERSION']) ? $_SERVER['SYMFONY_VERSION'] : 'origin/master'),
);
foreach ($deps as $dep) {
Something went wrong with that request. Please try again.