@@ -6,15 +6,15 @@ Port of the incredible plugin [chCmsExposeRoutingPlugin](https://github.com/them
66Installation
77------------
88
9- For the management of the bundle you have 2 options: * submodules * or * Composer * .
9+ For the management of the bundle you have 2 options: * Composer * or * submodules * .
1010
11- ### Through Composer (Symfony 2.1):
11+ ### Through Composer (Symfony 2.1+ ):
1212
1313Add the following lines in your ` composer.json ` file:
1414
1515``` js
1616" require" : {
17- " friendsofsymfony/jsrouting-bundle" : " 1.1.* "
17+ " friendsofsymfony/jsrouting-bundle" : " ~ 1.1"
1818}
1919```
2020
@@ -26,7 +26,7 @@ Run Composer to download and install the bundle:
2626
2727 $ git submodule add git://github.com/FriendsOfSymfony/FOSJsRoutingBundle.git vendor/bundles/FOS/JsRoutingBundle
2828
29- Or add the following lines in your ` deps ` file:
29+ Or add the following lines to your ` deps ` file:
3030
3131``` ini
3232[FOSJsRoutingBundle]
7979
8080Just add these two lines in your layout:
8181
82- <script type="text/javascript" src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>
83- <script type="text/javascript" src="{{ path('fos_js_routing_js', {"callback": "fos.Router.setData"}) }}"></script>
82+ <script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>
83+ <script src="{{ path('fos_js_routing_js', {"callback": "fos.Router.setData"}) }}"></script>
8484
8585
8686It's as simple as calling: ` Routing.generate('route_id', /* your params */)`.
@@ -91,13 +91,13 @@ Imagine some route definitions:
9191
9292 # app/config/routing.yml
9393 my_route_to_expose :
94- pattern : /foo/{id}/bar
95- defaults : { _controller: HelloBundle:Hello:index }
94+ pattern : /foo/{id}/bar
95+ defaults : { _controller: HelloBundle:Hello:index }
9696 options :
9797 expose : true
9898
9999 my_route_to_expose_with_defaults :
100- pattern : /blog/{page}
100+ pattern : /blog/{page}
101101 defaults : { _controller: AcmeBlogBundle:Blog:index, page: 1 }
102102 options :
103103 expose : true
@@ -106,7 +106,7 @@ Or with annotations:
106106
107107 # src/Acme/DemoBundle/Controller/DefaultController.php
108108 /**
109- * @Route ("/foo/{id}/bar", name="my_route_to_expose", options={"expose"=true})
109+ * @Route("/foo/{id}/bar", name="my_route_to_expose", options={"expose"=true})
110110 */
111111 public function exposedAction($foo)
112112
@@ -116,10 +116,10 @@ You can do:
116116 Routing.generate('my_route_to_expose', { id : 10 });
117117 // will result in /foo/10/bar
118118
119- Routing.generate('my_route_to_expose', { "id" : 10, " foo" : "bar" });
119+ Routing.generate('my_route_to_expose', { id : 10, foo: "bar" });
120120 // will result in /foo/10/bar?foo=bar
121121
122- $.get(Routing.generate('my_route_to_expose', { "id" : 10, " foo" : "bar" }));
122+ $.get(Routing.generate('my_route_to_expose', { id : 10, foo: "bar" }));
123123 // will call /foo/10/bar?foo=bar
124124
125125 Routing.generate('my_route_to_expose_with_defaults');
@@ -128,10 +128,10 @@ You can do:
128128 Routing.generate('my_route_to_expose_with_defaults', { id : 2 });
129129 // will result in /blog/2
130130
131- Routing.generate('my_route_to_expose_with_defaults', { " foo" : " bar" });
131+ Routing.generate('my_route_to_expose_with_defaults', { foo : " bar" });
132132 // will result in /blog/1?foo=bar
133133
134- Routing.generate('my_route_to_expose_with_defaults', { id : 2, " foo" : "bar" });
134+ Routing.generate('my_route_to_expose_with_defaults', { id : 2, foo: "bar" });
135135 // will result in /blog/2?foo=bar
136136
137137
@@ -168,19 +168,19 @@ to combine the routes with the other javascript files in assetic.
168168
169169Instead of the line
170170
171- <script type="text/javascript" src="{{ path('fos_js_routing_js', {"callback" : " fos.Router.setData" }) }}"></script>
171+ <script src="{{ path('fos_js_routing_js', {"callback" : " fos.Router.setData" }) }}"></script>
172172
173173you now include this as
174174
175- <script type="text/javascript" src="/js/fos_js_routes.js"></script>
175+ <script src="/js/fos_js_routes.js"></script>
176176
177177Or inside assetic, do
178178
179179 {% javascripts filter='?yui_js'
180180 ' bundles/fosjsrouting/js/router.js'
181181 ' js/fos_js_routes.js'
182182 %}
183- <script type="text/javascript" src="{{ asset_url }}"></script>
183+ <script src="{{ asset_url }}"></script>
184184 {% endjavascripts %}
185185
186186
0 commit comments