Ionic 2 page module segment optional params? - ionic-framework

I am using ionic page module like this...
#IonicPage({
name: 'forgotten-password',
segment: 'forgotten-password/:email/:code',
defaultHistory: [ 'home' ]
})
The problem is without providing params, the url looks like this:
http://localhost:8100/#/forgotten-password/:email/:code
How can I omit the :email and :code from the route when they are not provided?

Related

Nuxt i18n redirect to locale specific from page name

I'd like to redirect from /my-account to /hr/moj-racun using nuxt i18n (because Croatian is the default language, and the mapping between my-account and moj-racun exists).
Instead it redirects to /hr/my-account.
The page folder inside my nuxt app folder is named 'my-account', and this is my current setup:
(I've set the alwaysRedirect, but it takes the entered url and prepends the language prefix, but it does not translate it by the given mapping)
[
'nuxt-i18n',
{
locales: [
{
name: 'Hrvatski',
code: 'hr',
iso: 'hr-HR',
file: 'hr.js'
},
{
name: 'English',
code: 'en',
iso: 'en-US',
file: 'en.js'
}
],
langDir: 'locales/',
strategy: 'prefix',
defaultLocale: 'hr',
lazy: true,
detectBrowserLanguage: false
}
]
Edit, this is my-account page specific nuxt-i18n setup:
export default {
nuxtI18n: {
paths: {
en: '/my-account',
hr: '/moj-racun'
}
}
}
If I go to the page like http://example.com/my-account it gets redirected to http://example.com/**hr**/my-account, without translation.
That is because your default locale is set to hr, If you want to redirect and switch language and translate data use this tag:
<nuxt-link
v-for="locale in availableLocales"
:key="locale.code"
:to="switchLocalePath(locale.code)">{{ locale.name }}</nuxt-link>
you can visit this page:
https://i18n.nuxtjs.org/lang-switcher

sr_freecap: viewhelper calls eIDSR instead of eID - no image shown

i want to imeplement the extension sr_freecap in an own extension in a TYPO3 9 LTS. The viewhelper shows the text and the correct html but the link to the image looks like this:
mydomain.com/index.php?eIDSR=sr_freecap_EidDispatcher&id=9781&vendorName=SJBR&extensionName=SrFreecap&pluginName=ImageGenerator&controllerName=ImageGenerator&actionName=show&formatName=png&L=0&set=571e0
When i call this url manually i get the whole page and not the image. Is eIDSR correct? I was in the opinion that the correct call should be eID= ... I can't find information about it.
Any help appreciated!
I missed the existing bug report: https://forge.typo3.org/issues/89735
I tried the above solution and it works:
Put in your extension in which you implements sr_freecap this file:
/your-extension/Configuration/RequestMiddlewares.php
with the following content:
<?php
return [
'frontend' => [
'srfreecap-eidhandler' => [
'target' => \SJBR\SrFreecap\Middleware\EidHandler::class,
'before' => [
'typo3/cms-frontend/content-length-headers',
],
]
]
];
this will work. Seems like a necaissary feature which is not mentioned in the manual.

ionic nav push params not shown in url

app.module.ts:
imports: [
IonicModule.forRoot(MyApp, {}, {
links: [
{ component: CategoryPage, name: 'Category', segment: 'category:id'}
]
}
],
providers: [
{
provide: LocationStrategy,
useClass: PathLocationStrategy
}
]
Configuration of the page I am navigating too
#IonicPage({
name: 'Category',
segment: 'category/:id'
})
Code which triggers navigation:
this.nav.push(CategoryPage, {id: 3});
The component does load as expected and I can call this.navParams.get('id') which yields 3 from within the components class.
Expected result: The url changes to /category:3
Observed result: The url changes to /category:id
so if you are trying to implement deep links for Ionic 3 (since Ionic 4 is using Angular's router by default now) you need to ensure you also configure each page accordingly.
The page you are navigating to needs to have configs added via #IonicPage:
#IonicPage({
segment: 'second/:id'
})
See more in ionic docs or this guide

Sonata page URL

What is concept creating url / path for sonata page - I want create not hardcoded path in template. In doc https://sonata-project.org/bundles/page/master/doc/reference/twig_helpers.html have
8.1. URL
Render a page url
{{ path(page) }} => /absolute/path/to/url
{{ path(page, {}, true) }} => ../relative/path/to/url
{{ url(page) }} => https://sonata-project.org/absolute/url/to/url
{{ url(page, {}, true) }} => //sonata-project.org/network/path/to/url
what is page ?
i try page id , slug get error.
I have try it.
Variable page was not defined - so i think its just an example in sonata doc.
If you type in shell (symfony-root-folder)
php bin/console debug:router
You will get a list of all defined routes in your app.
You can use any name from this list as parameter. Eg: {{ url('sonata_admin_dashboard')}}
... and will get the Path from this list as path or url: Eg. http://localhost:8000/admin/dashboard
More Info:
https://symfony.com/doc/current/routing/debug.html
https://symfony.com/doc/current/routing.html

Nette - {link!} macro can't handle already existing GET params in URL

I Use Nette 2 in my project and I also use .latte template system with AJAX.
Now I have jquery function (in template) that should generate GET request on the same destination but it should add some GET parameters after it.
This destination is initially rendered using one GET parameter, then some actions are made and during some of them AJAX loads some information from the same destination (just adds a couple of GET parameters).
Now I generate AJAX URL using .latte {link!} macro (exclamation mark stands for signal). This is now able to generate new URL with GET params appended to original one. But append is badly parsed, because there is &amp%3B in the URL instead of just &.
I have this code in my template:
{block content}
<h1 n:block=title>New Rule</h1>
{snippet rulesForm}
{form newRuleForm}
{$form}
<script type="text/javascript">
{foreach $form['rule']->containers as $i => $rule}
{include #jsCallback, id => $i, input => $rule['table']->name, link => tableChange}
{include #jsCallback, id => $i, input => $rule['column']->name, link => tableChange}
{/foreach}
</script>
{/form}
{/snippet}
{/block}
{define #jsCallback}
$('#{$control["newRuleForm"]['rule'][$id][$input]->htmlId}').on('change', function(){
alert('{$link}');
$.nette.ajax({
type: 'GET',
url: '{link {$link}!}',
data: {
'value': $(this).val(),
}
});
});
{/define}
How can I fix this problem so I can generate link which appends GET parameters correctly?
Thanks.
Best approach is to avoid generating inline Javascript. You can mark all those form controls by CSS class (eg. special-input), then you don't have to generate Javascript code in Latte iteration.
{snippet rulesForm}
<div data-link-table="{link tableChange!}"></div>
...
{/snippet}
$('.special-input').on('change', function () {
$.nette.ajax({
type: 'GET',
url: $('[data-link-table]').data('linkTable'),
data: {
value: $(this).val()
}
});
});
Maybe noescape modifier?
$.nette.ajax({
type: 'GET',
url: '{link {$link|noescape}!}',
data: {
'value': $(this).val(),
}
});