Code Monkey home page Code Monkey logo

fosjsroutingbundle's People

Contributors

basster avatar benjamindulau avatar chris53897 avatar dattaya avatar dbu avatar elnur avatar emulienfou avatar extreme avatar fran6co avatar guilhemn avatar ionbazan avatar javiereguiluz avatar jrmyio avatar kocal avatar lsmith77 avatar matteosister avatar nacmartin avatar nilsminten avatar pulse00 avatar pyksid avatar schmittjoh avatar soullivaneuh avatar stof avatar tobias-93 avatar tofandel avatar tugrul avatar vincentlanglet avatar weaverryan avatar willdurand avatar wouterj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fosjsroutingbundle's Issues

Using JMSi18nRoutingBundle : conflict

Hi,

It's impossible to generate any route if you use JMSi18nRoutingBundle, routes name are prefixed depending of the user's culture.
I don't know how to fix that, maybe using culture into generate().

If I try to generate "my_route_test", I got Route doesn't exist, trying fos:js-routing:debug I have :
en__RG__my_route_test ANY /hello
fr__RG__my_route_test ANY /bonjour

Even passing the culture in parameter _culture I got the error.

Security parameter "requires_channel" ignored when generating https routes

While in a secured area of my project which requires https by setting requires_channel parameter in security.yml access_control key, every call to Routing.generate('route_name') ignores the https requirement and generates the corresponding absolute http url.
I managed to work around this problem by setting schemes: [https] while importing my routing resource, but this is obviously not a clean solution.
More, I encountered this issue only in my production environment; dev is just fine. I'm currently using Symfony 2.2.3.

security:
    access_control:
        - { path: '^/', host: secured.myproject.com, requires_channel: https }
MySecureBundle:
    resource: "@MySecureBundle/Controller/"
    type:     annotation
    host:     secured.myproject.com
    schemes:  [https]

Environment dependant generated routes

I didn't find in the doc: I was wondering if there's a way to generate routes depending on the environment.

For example, the same

Routing.generate('homepage');

when I'm in the prod environment gives:

/homepage

and when I'm in dev gives:

/app_dev.php/homepage

If this is not possible at the moment, maybe it could be a nice feature

Can't generate routes trough FOSJsRoutingBundle

I'm using a AJAX call trough $.ajax() in one of my twig templates and because I need to call a URL so I'm using this bundle. After read the docs, follow every steps and write this code in my template:

<script>
$(function() {
    $("a.step").click(function() {
        var id = $(this).attr('id');

        $.ajax({
            type: 'GET',
            url: Routing.generate('category_subcategories', {parent_id: id}),
            dataType: "json",
            success: function(ev) {
                // here I build the next
            }
        });
    });
});
</script>

I got this error in Firebug console:

ReferenceError: Routing is not defined
url: Routing.generate('category_subcategories', {parent_id: id}),

What could be wrong there?

Assets install ok, but bad route in DEV

HI,

Trying to install fosjsrouting with assetic, seems to be ok for dumping but when i call Routing.generate in --dev it call the --prod url

Here is what i'm doing:

1/ Dump routes to my public folder

php app/console fos:js-routing:dump --target=MyBundle/Resources/public/js/fos_js_routes.js

2/ Install all assets, copy in web/

php app/console assets:install

3/ Dump all assets

php app/console assetic:dump

4/ Call resources in layout

{% javascripts
'bundles/mybundle/js/jquery-1.8.3.js'
'bundles/mybundle/js/jquery-ui-1.9.2.custom.js'
'bundles/fosjsrouting/js/router.js'
'bundles/mybundle/js/fos_js_routes.js'
'bundles/mybundle/js/app.js'
filter='yui_js'
output='bundles/mybundle/min/global.js' %}

<script type="text/javascript" src="{{ asset_url }}"></script>

{% endjavascripts %}

When i check the source file:

bundles/fosjsrouting/router.js (seems ok)

(function(){var R=!1,Q=this;function P(i,l){var f=i.split("."),k=Q;!(f[0] in k)&&k.execScript&&k.execScript("var "+f[0]);for(var j;f.length&&(j=f.shift());){!f.length&&void 0!==l?k[j]=l:k=k[j]?k[j]:k[j]={}}}var O=Array.prototype,N=O.forEach?function(i,j,f){O.forEach.call(i,j,f)}:function(i,n,f){for(var l=i.length,k="string"==typeof i?i.split(""):i,j=0;j<l;j++){j in k&&n.call(f,k[j],j,i)}};function M(i,n){this.c={};this.a=[];var f=arguments.length;if(1<f){if(f%2){throw Error("Uneven number of arguments")}for(var l=0;l<f;l+=2){this.set(arguments[l],arguments[l+1])}}else{if(i){var k;if(i instanceof M){L(i);l=i.a.concat();L(i);k=[];for(f=0;f<i.a.length;f++){k.push(i.c[i.a[f]])}}else{var f=[],j=0;for(l in i){f[j++]=l}l=f;f=[];j=0;for(k in i){f[j++]=i[k]}k=f}for(f=0;f<l.length;f++){this.set(l[f],k[f])}}}}M.prototype.e=0;M.prototype.o=0;function L(i){if(i.e!=i.a.length){for(var l=0,f=0;l<i.a.length;){var k=i.a[l];y(i.c,k)&&(i.a[f++]=k);l++}i.a.length=f}if(i.e!=i.a.length){for(var j={},f=l=0;l<i.a.length;){k=i.a[l],y(j,k)||(i.a[f++]=k,j[k]=1),l++}i.a.length=f}}M.prototype.get=function(f,i){return y(this.c,f)?this.c[f]:i};M.prototype.set=function(f,i){y(this.c,f)||(this.e++,this.a.push(f),this.o++);this.c[f]=i};function y(f,i){return Object.prototype.hasOwnProperty.call(f,i)}var q,o,h,g;function a(){return Q.navigator?Q.navigator.userAgent:null}g=h=o=q=R;var K;if(K=a()){var F=Q.navigator;q=0==K.indexOf("Opera");o=!q&&-1!=K.indexOf("MSIE");h=!q&&-1!=K.indexOf("WebKit");g=!q&&!h&&"Gecko"==F.product}var x=o,w=g,m=h;var e;if(q&&Q.opera){var d=Q.opera.version;"function"==typeof d&&d()}else{w?e=/rv:([^);]+)()|;)/:x?e=/MSIE\s+([^);]+)()|;)/:m&&(e=/WebKit/(\S+)/),e&&e.exec(a())}function c(f,i){this.b=f||{d:"",prefix:"",host:"",scheme:""};this.h(i||{})}c.f=function(){return c.j?c.j:c.j=new c};c.prototype.h=function(f){this.g=new M(f)};c.prototype.k=function(f){this.b.d=f};c.prototype.n=function(){return this.b.d};c.prototype.l=function(f){this.b.prefix=f};function b(i,n,f,l){var k,j=RegExp(/[]$/);if(f instanceof Array){N(f,function(p,r){j.test(n)?l(n,p):b(i,n+"["+("object"===typeof p?r:"")+"]",p,l)})}else{if("object"===typeof f){for(k in f){b(i,n+"["+k+"]",f[k],l)}}else{l(n,f)}}}c.prototype.i=function(f){var i=this.b.prefix+f;if(y(this.g.c,i)){f=i}else{if(!y(this.g.c,f)){throw Error('The route "'+f+'" does not exist.')}}return this.g.get(f)};c.prototype.m=function(t,n,r){var l=this.i(t),k=n||{},j={},u;for(u in k){j[u]=k[u]}var i="",f=!0;N(l.tokens,function(A){if("text"===A[0]){i=A[1]+i,f=R}else{if("variable"===A[0]){var B=A[3] in l.defaults;if(R===f||!B||A[3] in k&&k[A[3]]!=l.defaults[A[3]]){if(A[3] in k){var B=k[A[3]],z=A[3];z in j&&delete j[z]}else{if(B){B=l.defaults[A[3]]}else{if(f){return}throw Error('The route "'+t+'" requires the parameter "'+A[3]+'".')}}if(!(!0===B||R===B||""===B)||!f){z=encodeURIComponent(B).replace(/%2F/g,"/"),"null"===z&&null===B&&(z=""),i=A[1]+z+i}f=R}else{B&&(A=A[3],A in j&&delete j[A])}}else{throw Error('The token type "'+A[0]+'" is not supported.')}}});""===i&&(i="/");i=this.b.d+i;"_scheme" in l.requirements?this.b.scheme!=l.requirements._scheme&&(i=l.requirements._scheme+"://"+this.b.host+i):!0===r&&(i=this.b.scheme+"://"+this.b.host+i);var n=0,s;for(s in j){n++}if(0<n){var p,v=[];s=function(A,z){z="function"===typeof z?z():z;v.push(encodeURIComponent(A)+"="+encodeURIComponent(null===z?"":z))};for(p in j){b(this,p,j[p],s)}i=i+"?"+v.join("&").replace(/%20/g,"+")}return i};P("fos.Router",c);P("fos.Router.setData",function(f){var i=c.f();i.k(f.base_url);i.h(f.routes);"prefix" in f&&i.l(f.prefix);i.b.host=f.host;i.b.scheme=f.scheme});c.getInstance=c.f;c.prototype.setRoutes=c.prototype.h;c.prototype.setBaseUrl=c.prototype.k;c.prototype.getBaseUrl=c.prototype.n;c.prototype.generate=c.prototype.m;c.prototype.setPrefix=c.prototype.l;c.prototype.getRoute=c.prototype.i;window.Routing=c.f()})();

bundles/mybundle/fos_js_routes.js (seems ok)

fos.Router.setData({base_url:"",routes:{referentiel_typedepense_get:{tokens:[["variable",".","[^\.]+","_format"],["variable","/","\d+","id"],["text","/referentiel/typedepense"]],defaults:{_format:"json"},requirements:{id:"\d+",_method:"GET"}},typepuissancefiscale_list:{tokens:[["variable",".","[^\.]+","_format"],["variable","/","\d+","id"],["text","/typepuissancefiscale/list"]],defaults:{_format:"json"},requirements:{id:"\d+",_method:"GET"}}},prefix:"",host:"localhost",scheme:"http"});

In env dev, the routing make a production call, without the app_dev.php.
I tried to add the base_url property for test in fos_js_routes.js like

"base_url":"app_dev.php"

it generate an url like app_dev.php/app_dev.php/[url]

Any idea?

Thanks in advance

Dump command doesn't work

Hey, with the latest version (updated today)

app/console fos:js-routing:debug

returns

 [InvalidArgumentException]
  Command "fos:js-routing:dump" is not defined.

  Did you mean this?
      fos:js-routing:debug

I guess there's something broken with the dump command

the js script doesn't generate the same url as symfony (null)

hello,
sorry for my english

here it is my route :

MyBundle_indic:
    pattern: /indicateur/{affichage}/{indicateur}/{axey}/{annee}/{period}/{nbperiod}/{type}/{soustype}
    defaults: { _controller: ERDFTourBundle:Indicateur:index, affichage: 'calcul', axey: 'famille', annee : null, period : 'mois', nbperiod : 12, type : null, soustype : null }
    requirements:
        affichage: calcul|liste|image
        axey: "(famille|secteur)?"
        annee: "(\d{4})?"
        period: "(mois|trim)?"
        nbperiod: "(\d{1,2})?"
        type: "(tout|level1|level2)?"
        soustype: ".*"
    options:
        expose: true

Twig code :

{{ path('MyBundle_indic', {
      'soustype': 'tout',
      'affichage': "calcul", 
      'indicateur': 'test',
      'axey': "famille",
      'period': "mois" }) }}

generate :
/app_dev.php/indicateur/calcul/test/famille//mois/12//tout

JS code :

Routing.generate('MyBundle_indic', {
      'soustype': 'tout',
      'affichage': "calcul", 
      'indicateur': 'test',
      'axey': "famille",
      'period': "mois" })

generate:
/app_dev.php/indicateur/calcul/test/famille/null/mois/12/null/tout

Thanks in advance

NB: default value 'null' should be considered as a empty string

Create a git tag/branch alias for composer versioning

It would be great to have a git tag or branch alias for use with composer.

This would make it possible to reference the bundle in a better manner when installing/depending on it using composer.

Thanks in advance!

app_test.php in the URL

Hello,

I created a separate front controller for testing my app, and so I could see what Behat sees. So it's http://mysite.com/app_test.php

This works fine when I am on my site, the Symfony router seems to include the app_test.php in all the links on my site, etc.

However, when I go to make an AJAX request, and the URL is generated by FOSJSRoutingBundle, it drops the /app_test.php/ from the generated URL.

How can I get this bundle to keep app_test.php in the relatively generated URL when the current page has app_test.php in the URL?

Also, when I try passing true to the third parameter, the returned URL is always "localhost" and it doesn't include app_test.php either.

Thank you!

Routing assets

Hello,

Is it still possible to use a Routing.asset('bundleimagepath') in a jQuery script in order to get the image url. (Taking into account a potential CDN if configured ?)

I tryed but didn't manage to get it work.

Ty.

the js script doesn't generate the same url as symfony (false extra variables)

hello,
sorry for my english

here it is my route :

MyBundle_indic:
    pattern: /indicateur/{affichage}/{indicateur}/{axey}/{annee}/{period}/{nbperiod}/{type}/{soustype}
    defaults: { _controller: ERDFTourBundle:Indicateur:index, affichage: 'calcul', axey: 'famille', annee : null, period : 'mois', nbperiod : 12, type : null, soustype : null }
    requirements:
        affichage: calcul|liste|image
        axey: "(famille|secteur)?"
        annee: "(\d{4})?"
        period: "(mois|trim)?"
        nbperiod: "(\d{1,2})?"
        type: "(tout|level1|level2)?"
        soustype: ".*"
    options:
        expose: true

Twig code :

{{ path('MyBundle_indic', {
      'affichage': "calcul", 
      'indicateur': 'test',
      'axey': "famille",
      'nbperiod': "12" }) }}

generate :
/app_dev.php/indicateur/calcul/test

JS code :

Routing.generate('MyBundle_indic', {
      'affichage': "calcul", 
      'indicateur': 'test',
      'axey': "famille",
      'nbperiod': "12" })

generate:
/app_dev.php/indicateur/calcul/test?axey=famille&nbperiod=12

Thanks in advance

NB : it seems that if the script starts with variables with user value equal to the default one, those variables become extra variables (they go after the ?)

Consider a getBaseUrl method in router.js

In my ExtJS JavaScript code, I have a need for retrieving the base URL, but there is only a setter method.

fos.Router.prototype.getBaseUrl = function() {
    return this.context_.base_url;
};

No?

Routing Generate

I have this route:

_cartcountry:
pattern: /{_locale}/cart/country/{id}/{shipping}
defaults: { _controller: CartBundle:Cart:country, _locale: pt, id: 0, shipping: 0}
requirements:
_locale: ^pt|en|fr|es$
id: \d+
shipping: \d+
options:
expose: true

With fos: js-routing:debug:

[router] Current routes

...

_cartcountry ANY /{_locale}/cart/country/{id}/{shipping}

In javascript:

...

var path = Routing.generate('_cartcountry,{_locale:_locale, id: product.id, shipping: shipping.id});

...

The var path is always:

/en/cart/country/2?shipping=1

And in this case I think it was supposed to be:

/en/cart/country/2/1

What am I doing wrong? Can you help me?

Thanks,

Paulo

Different sets of routes

Would it be possible to have different sets of routes that are exposed?
For example with another parameter next to expose, like "set".

{"expose": true, "set": "backend"}
{"expose": true, "set": "editor"}

Right now all routes are exposed through one request, although they might be completely seperated.

No routes routing JS

Hi,

I installed the bundle in a Symfony 2.2 project using the instructions:

  • Added the require line to composer.json
  • Ran composer update, installed assets
  • Include the JS files to my page

The JS seems to work, but it doesn't contain any routes. The output of /js/routing?callback=fos.Router.setData is:

fos.Router.setData({"base_url":"\/app_dev.php","routes":[],"prefix":"","host":"localhost","scheme":"http"});

My routing file (/app/config/routing.yml) looks like this:

fos_js_routing:
    resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"

webberig_nessi:
    resource: "@WebberigNessiBundle/Resources/config/routing.yml"
    prefix:   /

webberig_backend:
    resource: "@WebberigBackendBundle/Resources/config/routing.yml"
    prefix:   /

Am I doing something wrong ?

Consider dropping the jQuery dependency

Unlike the original sf1 plugin, this bundle does not provide functions to do ajax calls by passing a route name directly (which IMO is better as it is about routing, not requesting). But this means that jQuery is mainly used to for jQuery.extend. Removing this dependency could be very useful for people than don't use jQuery in their app.

Consider an addDefaults/addDefaultParams method in router.js

Imagine you have some sort of URI setup that looks like this: /{companySlug}/{projectSlug} and you might have a route in the project that is my_bundle_users that looks like /{companySlug}/{projectSlug}/users.

Now, when generating a route using Routing.generate('my_bundle_users'), you must specify the companySlug and the projectSlug each time. However, (and in my case), you might have a twig layout for the company bundle (that extends a core layout) and a twig layout for the project bundle (that extends the company layout). If you could set default route params onto the router somehow, you'd avoid having to pass repetitive params to the router.

Your company bundle layout might look like this:

{% extends 'JbiCoreBundle::layout.html.twig' %}

{% set company = app.request.get('company') %}

{# in some block do this: #}
Routing.addDefaultParam({'companySlug': {{ company.slug }}});

Your project bundle layout might look like this:

{% extends 'JbiCompanyBundle::layout.html.twig' %}

{% set project = app.request.get('project') %}

{# in some block do this: #}
Routing.addDefaultParam({'projectSlug': {{ project.slug }}});

Then you can do this:

Routing.generate('my_bundle_users')

And the company and project slug are picked up automatically.

Empty routes, because my routes haven't expose option

I have delete check for expose option in router in ExposedRoutesExtractor->getExposedRoutes() and dump all my routes. But before I have empty routes in fos_js_routing_js (/js/fos_js_routes.js).
What that option implement and why we check it? And the most important question why I have empty routes?

Request format

Is it possible to select a request format (ex json/yml/whatever) when generating an url ?

Strange bug

I have a strange bug with symfony 2.3
the routes are corrects and works, but if i go to my subdomain and come back to my site, the routes omit all path between domain and action.
Just test in dev not in prod.

thanks

Allow by pattern

Just reading the README i would prefer to configure the allowed routes by a whitelist that allows patterns, so i can do stuff like allowing all routes starting with "mybundle_". So i would specify the allowed_routes as patterns and the bundle would use preg_match to look if a route is in or not.

Also a command to look which routes actually get exposed, "router:debug-exposed" or somtehing would be helpful to verify the routes exported to javascript.

routing.json generates "base_Url" instead of "base_url"

I believe this is to do with the version of the serializer that I am using (coming off Symfony master).

In RoutesResponse we have:

<?php

public function getBase_Url()
{
    return $this->baseUrl;
}

Which I assume is named as such to cater for the serializer? And since getBase_Url has a capital U, the serializer generates base_Url.

Just confirmed that indeed this fix works (and I believe would be BC):

<?php

public function getBase_url()
{
    return $this->baseUrl;
}

Is there a better solution than using this messy method anyway?

url -> parameter conversion

hi there!

damn cool you did this bundle! was thinking about this missing piece quite some time now, until ozmerk gave me a hint in the dev IRC.

however, what IMO is still missing is a way to get parameters out of the url. so exactly the other way round.

var params = Routing.getParams(document.location.href);
var myID = params['id'];

what do you think about that?

Add a way to dump the JS routes in prod

The controller currently loads all routes for each request to build the JSON representation of routes. The route loading is a very heavy task and should always produce the same result in prod (the cache need to be cleared anyway for the PHP routes); We should add a way to dump the JSON in the cache to avoid doing the heavy work each time.

Inject _locale parameter automatically

When exposing a route with {_locale} inside, it would be interesting to not have to pass the locale parameter.

For example, if I write:

/**
 * @Route("/{_locale}/foo/{id}/bar", name="my_route_to_expose", options={"expose"=true})
 */
public function exposedAction($foo)

It would be interesting to be able to do:

Routing.generate('my_route_to_expose', { id: '1' });

Rather than:

Routing.generate('my_route_to_expose', { id: '1', _locale: 'en' });

Where 'en' comes from app.request.locale

Is it possible to preload the Router Js with the request locale?

Composer installation fail

Hey,

We can't install the bundle using composer. Composer tries to find the commit 63c990abc320828376671a0bd0ed861db6b9ad69 that does not exist on master.

javascript error...

TypeError: can't convert undefined to object at router.js line 7...

I can not know the reason for this error ...

I use:

 <script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>
    <script type="text/javascript" src="{{ path('fos_js_routing_js', {"callback": "fos.Router.setData"}) }}"></script>

but if i use

<script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>
     <script src="/js/fos_js_routes.js"></script>

no errors...

Thanks,

Paulo

logout url / firewall

Any chance to include something like the logout_url() / logout_path() twig functions?

Getting JavaScript error from routing script

The bundle generates the following JS for me:

{"base_url":"","routes":{"department_day_budget":{"tokens":[["variable","\/","\\d{4}-\\d{2}-\\d{2}","date"],["text","\/budgeting"],["variable","\/","[^\/]+","id"],["text","\/department"],["variable","\/","[^\/]+","location_id"],["text","\/location"]],"defaults":[]}}}

for some reason both FF and Chrome complaint to me about this script:
FF: invalid label (with an arrow pointing at the very first ")
Chrome: Uncaught SyntaxError: Unexpected token :

any ideas?

Seems to be break after removing jQuery dep

I follow the new documentation & the FOS\JsRoutingBundle\Controller\Controller::indexAction returns an HTTP 500 error.

All works fine before the refactoring. I just update the included javascripts:

<script type="text/javascript" src="{{ asset('/bundles/fosjsrouting/js/router.js') }}"></script>
<script type="text/javascript" src="{{ path('fos_js_routing_js', { "callback": "fos.Router.setData" }) }}"></script>

Error description :

[exception] 500 | Internal Server Error | Symfony\Component\Serializer\Exception\UnexpectedValueException
[message] Serialization for the format js is not supported
[1] Symfony\Component\Serializer\Exception\UnexpectedValueException: Serialization for the format js is not supported
                at n/a
                    in /var/www/erc-62.local/vendor/symfony/src/Symfony/Component/Serializer/Serializer.php line 66

                at Symfony\Component\Serializer\Serializer-&gt;serialize(object(FOS\JsRoutingBundle\Response\RoutesResponse), &#039;js&#039;)
                    in /var/www/erc-62.local/vendor/bundles/FOS/JsRoutingBundle/Controller/Controller.php line 58

                at FOS\JsRoutingBundle\Controller\Controller-&gt;indexAction(object(Symfony\Component\HttpFoundation\Request), &#039;js&#039;)
                    in  line 

                at call_user_func_array(array(object(FOS\JsRoutingBundle\Controller\Controller), &#039;indexAction&#039;), array(object(Symfony\Component\HttpFoundation\Request), &#039;js&#039;))
                    in /var/www/erc-62.local/app/cache/dev/classes.php line 3874

                at Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw(object(Symfony\Component\HttpFoundation\Request), &#039;1&#039;)
                    in /var/www/erc-62.local/app/cache/dev/classes.php line 3844

                at Symfony\Component\HttpKernel\HttpKernel-&gt;handle(object(Symfony\Component\HttpFoundation\Request), &#039;1&#039;, true)
                    in /var/www/erc-62.local/app/cache/dev/classes.php line 4823

                at Symfony\Bundle\FrameworkBundle\HttpKernel-&gt;handle(object(Symfony\Component\HttpFoundation\Request), &#039;1&#039;, true)
                    in /var/www/erc-62.local/app/bootstrap.php.cache line 547

                at Symfony\Component\HttpKernel\Kernel-&gt;handle(object(Symfony\Component\HttpFoundation\Request))
                    in /var/www/erc-62.local/web/app_dev.php line 20

Provide Namespace Route Collections

FEATURE REQUEST:

Currently it is only possible to either expose a route, or not. But in different contexts within the same site, I might want different routes exposed.

For example an admin (restricted) area, and the generally available parts of the site, and I don't want the public facing javascript to contain my admin routes.

I guess the alternative is to have a different kernel and routing for your administration area (a different 'app', and separate the routes that way.

What have you found to be the best approach to this problem?

IE9 - master branch

In IE9 masetr branch version dons't work. I always got "route does not found"

Possible security bug in routing callback

Value passed as the callback parameter isn't validated.
This makes possible attacks such as XSS, html & cookies injections.

Route example:

http://example.com/js/routing?callback=<IMG%20SRC="javascript:alert('works');">

Path security when using with protected routes

Hi! I'd like to use this bundle for generating paths withing my admin bundle. The problem is publicity of routes. Is there any way to conrol output "/js/routing?callback=fos.Router.setData" considering user role or firewall cofiguration?
Whole "/admin" path is blocked for non-authorized, so there is not great problem, but in case of script injection someone could make queries for certain paths (as he would know them from JsRoutingBundle output).

Symfony 2.2 host routing problem

Hi,

I've updated to symfony 2.2 and I'm using the new host routing feature so I have a route like:

{subdomain}.domain.com

It works with twig generated routes but FOSJsRoutingBundle generated ones are like:

subdomain.domain.com/projects?subdomain=exampleSubDomain

FOSJsRoutingBundle is adding that url parameter. How can I fix this?

Request

Hello guys,

when I analyze my Requests using i.e. Firebug, It can be seen, that there is the actuall application request (i.e. /playground/web/desktop), and also GET routing?callback=fos.Router.setData.

I am wondering, why there is an additional request returning status 200 all the time, eventhough the routes arent changed. Wouldn't it be better to write the routes to a file once, check for changes and if there are none, just set it as a JS file, returning 304 Not Modified? It would reduce page load time massively, since it is 1 whole loading request less.

Cheers
Stoffel

Wrong query generated for array

If I pass an array as additional parameter, it is converted in a wrong way.
I get the output: ?item=1&item=2&item=3

Symfony will only recognize the first item.

Output should be: ?item[0]=1&item[1]=2&item[2]=3

IE8

hi,

i get a javascript error on internet explorer 8:
'/' expected (router.js, line 8, char 1276)
the problem is "var e,g=//[]$//"
i dont know what this code does, but adding quotes around helps:
var e,g="//[]$//"

cheers

Expose generated routes by FOSRestBundle

I'm using the FOSRestBundle in my application which autogenerates my routes.
I'd like to link to one of the generated routes, but I can't figure out how I should do that, if it's even possible. I tried this in my bundle's routing.yml:

api:
    type:     rest
    resource: Path\To\MyController
    name_prefix: api_
    options:
        expose: true

Am I doing something wrong, or is this a missing feature?

Edit: I just found out that if I move 'expose: true' to my app/config/routing.yml, it works. Although, I'd like to be able to limit this in my bundle's routing.yml

jsrouting depending on PHP extension?

Does this bundle depend on specific PHP functions / extensions?

Using FOSJSroutingbundle in SF2.0.12
Locally no problem but there pretty much all extensions are loaded, but when I deploy to Pagodabox: the router.js never comes in to the browser.

The guys there @ pagodabox found this error in their logs:
Fatal error: Exception thrown without a stack frame in Unknown on line 0

The stack there is pretty minimal, so they suggested I may be calling php functions not available in the php core/extensions.
Locally, I wasn't able to turn off enough stuff in php to break it.

This is the current PHP setup:
php_version: 5.3.10
php_extensions:
- intl
- mbstring
- xsl
- apc
- mysql
- iconv
- pdo_mysql
- zip
- mhash
- bcmath
- gettext
php_session_autostart: Off
php_short_open_tag: Off
magic_quotes_gpc: Off

Conflict with the JMSi18nRoutingBundle

i saw the issue: #32

The js generated by the bundle don't have the route. It happend only on the env prod on dev it works. I think that generated js on assetic:dump don't generate the translated routes.

How to resolve it? Because right not I just can turn off the translation for the particular route ( don't need the translations in that ajax call)

Release 1.1.0?

As we added new features to the public API, I'm thinking about releasing 1.1.0? Thoughts?

[Assetic] Compile js/routing.js into one assetic javascript file?

Is it possible to compile

<script type="text/javascript" src="{{ path('fos_js_routing_js', {"callback": "fos.Router.setData"}) }}"></script>

into the .js file I am compiling with Assetic?

{% javascripts output='js/main.js'
    '@FOSJsRoutingBundle/Resources/public/js/router.js'
    '@MyBundle/Resources/public/js/application.js'
    // routing setdata file here??
    filter='?yui_js'
%}
    <script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.