Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS routes in multilingual setup not working properly. #2672

Closed
craigh opened this issue Dec 13, 2015 · 7 comments
Closed

JS routes in multilingual setup not working properly. #2672

craigh opened this issue Dec 13, 2015 · 7 comments
Assignees
Labels
Milestone

Comments

@craigh
Copy link
Member

craigh commented Dec 13, 2015

Page not found. 馃槮

[1] Symfony\Component\HttpKernel\Exception\NotFoundHttpException: Page not found.
at n/a
in /Applications/MAMP/htdocs/core.git/src/lib/Zikula/Bundle/CoreBundle/EventListener/LegacyRouteListener.php line 95

at Zikula\Bundle\CoreBundle\EventListener\LegacyRouteListener->onKernelRequest(object(GetResponseEvent), 'kernel.request', object(TraceableEventDispatcher))
in line

at call_user_func(array(object(LegacyRouteListener), 'onKernelRequest'), object(GetResponseEvent), 'kernel.request', object(TraceableEventDispatcher))
in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php line 61

at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke(object(GetResponseEvent), 'kernel.request', object(Zikula_EventManager))
in line

at call_user_func(object(WrappedListener), object(GetResponseEvent), 'kernel.request', object(Zikula_EventManager))
in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php line 181

at Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.request', object(GetResponseEvent))
in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php line 46

at Symfony\Component\EventDispatcher\EventDispatcher->dispatch('kernel.request', object(GetResponseEvent), null)
in /Applications/MAMP/htdocs/core.git/src/lib/legacy/Zikula/EventManager.php line 99

at Zikula_EventManager->dispatch('kernel.request', object(GetResponseEvent))
in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php line 132

at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch('kernel.request', object(GetResponseEvent))
in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 120

at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Zikula_Request_Http), '1')
in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 62

at Symfony\Component\HttpKernel\HttpKernel->handle(object(Zikula_Request_Http), '1', true)
in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php line 69

at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Zikula_Request_Http), '1', true)
in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php line 185

at Symfony\Component\HttpKernel\Kernel->handle(object(Zikula_Request_Http))
in /Applications/MAMP/htdocs/core.git/src/index.php line 25

The relevant routes from routing script that is generated by controller

        "de__RG__zikulablocksmodule_block_view": {
            "tokens": [["variable", "\/", "[1-9]\\d*", "bid"], ["text", "\/de\/blocks\/admin\/block\/view"]],
            "defaults": [],
            "requirements": {
                "bid": "[1-9]\\d*",
                "_method": "GET"
            },
            "hosttokens": []
        },
        "en__RG__zikulablocksmodule_block_view": {
            "tokens": [["variable", "\/", "[1-9]\\d*", "bid"], ["text", "\/blocks\/admin\/block\/view"]],
            "defaults": [],
            "requirements": {
                "bid": "[1-9]\\d*",
                "_method": "GET"
            },
            "hosttokens": []
        },
        "pl__RG__zikulablocksmodule_block_view": {
            "tokens": [["variable", "\/", "[1-9]\\d*", "bid"], ["text", "\/pl\/blocks\/admin\/block\/view"]],
            "defaults": [],
            "requirements": {
                "bid": "[1-9]\\d*",
                "_method": "GET"
            },
            "hosttokens": []
        },
@craigh craigh added this to the 1.4.2 milestone Dec 13, 2015
@craigh
Copy link
Member Author

craigh commented Dec 15, 2015

@cmfcmf I'm really hoping you can handle this asap after your exams are complete.

In order to reproduce, you must have more than one locale installed
screen shot 2015-12-15 at 12 17 56 pm
and have multi-lingual features enabled
screen shot 2015-12-15 at 12 18 57 pm

The result is any ajax route will not work unless they have been specified to have the i18n flag set to false. While this workaround is ok in some situations (and used in the core several times already), it doesn't work if you actually want localized content from the ajax method. plus it is cumbersome.

I had bumped into this issue several times as I was working on Blocks and other core items but didn't realize the real problem until now.

@craigh
Copy link
Member Author

craigh commented Feb 29, 2016

refs #1985

@craigh
Copy link
Member Author

craigh commented Mar 16, 2016

@cmfcmf It would be great if you could look into this today or tomorrow.

@craigh craigh modified the milestones: 1.4.3, 1.4.2 Mar 16, 2016
@craigh
Copy link
Member Author

craigh commented Aug 19, 2016

@cmfcmf can you please look into this...

@Guite Guite added ZCS and removed ZCS labels Aug 20, 2016
@craigh
Copy link
Member Author

craigh commented Aug 21, 2016

I've just been testing this and can no longer reproduce this behavior. I'm guessing it was fixed by either upgrades to the vendor (friendsofsymfony/jsrouting-bundle) or by other core changes since the original ticket.

@craigh
Copy link
Member Author

craigh commented Aug 21, 2016

After writing the last comment I went back and actually tested the method I was originally posting about (block preview from the block list) and found that it didn't work! I discovered that despite the jQuery documentation:

Request Method
The POST method is used if data is provided as an object; otherwise, GET is assumed.

That the request method was actually POST (but no data provided) and that is why my route wasn't working. by eliminating the Method("GET") requirement in my route definition, the request works.

@cmfcmf
Copy link
Contributor

cmfcmf commented Aug 21, 2016

That the request method was actually POST (but no data provided) and that is why my route wasn't working. by eliminating the Method("GET") requirement in my route definition, the request works.

This is a Zikula "feature": https://github.com/zikula/core/blob/1.4/src/javascript/jquery_config.js#L26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants