From 10a0337b340e0fe833d601e2252c3e4cd12df45b Mon Sep 17 00:00:00 2001 From: vanekm Date: Fri, 23 Aug 2024 14:01:29 +0200 Subject: [PATCH 1/4] fix routing of actions, break routing of events --- app/RouterFactory.php | 17 ++++++++++++++++- app/config/fykos-router-mapping.neon | 21 ++++++++++++--------- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/app/RouterFactory.php b/app/RouterFactory.php index 8a2567d0..4ed0b891 100755 --- a/app/RouterFactory.php +++ b/app/RouterFactory.php @@ -82,6 +82,14 @@ private static function useTranslateFilter(?array $domainList, array $routerMapp $params['presenter'] = $routerMapping[$params['lang']][$params['presenter']]; } + // Translate action + if ( + isset($routerMapping['actions'][$params['lang']]) && + isset($routerMapping['actions'][$params['lang']][$params['action']]) + ) { + $params['action'] = $routerMapping['actions'][$params['lang']][$params['action']]; + } + return $params; }, @@ -97,6 +105,14 @@ private static function useTranslateFilter(?array $domainList, array $routerMapp } } + // Translate action + if (isset($routerMapping['actions'][$params['lang']])) { + $key = array_search($params['action'], $routerMapping['actions'][$params['lang']]); + if ($key !== false) { + $params['action'] = $key; + } + } + // Either set the language in the domain, or in lang parameter if (isset($domainList) && count($domainList)) { $params['domain'] = array_search($params['lang'], $domainList); @@ -187,7 +203,6 @@ public static function createFykosRouter(?array $domainList, array $routerMappin { $router = new RouteList(); - $router->addRoute('///[/]', [ 'module' => 'Default', 'presenter' => 'Results', diff --git a/app/config/fykos-router-mapping.neon b/app/config/fykos-router-mapping.neon index 7ae4e7c0..51e773e2 100644 --- a/app/config/fykos-router-mapping.neon +++ b/app/config/fykos-router-mapping.neon @@ -9,16 +9,19 @@ parameters: Default: Default ONas: About Pravidla: Rules - Organizatori: Organizers - Historie: History - Kontakt: Contact Zadani: Problems ArchivUloh: ProblemsArchive + actions: + cs: + historie: history + organizatori: organizers + kontakt: contact events: cs: - Default: Default - Akce: Events - Experimenty: Experiments - Pravidla: Rules - jakPsat: TexTutorial - \ No newline at end of file + Soustredeni: Camps + actions: + cs: + pravidla: rules + jakPsat: texTutorial + experimenty: experiments + cena: price \ No newline at end of file From 159a4b9e6b0b27bed9759741e7a9e85aee65eeb2 Mon Sep 17 00:00:00 2001 From: vanekm Date: Fri, 23 Aug 2024 14:51:14 +0200 Subject: [PATCH 2/4] literally all routing except /o-nas/organizatori works --- app/Modules/Fykos/Core/BasePresenter.php | 8 ++++---- app/RouterFactory.php | 22 +++++++++++++++++----- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/app/Modules/Fykos/Core/BasePresenter.php b/app/Modules/Fykos/Core/BasePresenter.php index 282ea86a..aa58acb7 100644 --- a/app/Modules/Fykos/Core/BasePresenter.php +++ b/app/Modules/Fykos/Core/BasePresenter.php @@ -24,9 +24,9 @@ protected function getNavItems(): array [], [ new NavItem(new PageTitle($this->csen('Co je FYKOS?', 'What Is FYKOS?')), ':Default:About:default'), - new NavItem(new PageTitle($this->csen('Organizátoři', 'Organizers')), ':Default:About:Organizers'), - new NavItem(new PageTitle($this->csen('Historie', 'History')), ':Default:About:History'), - new NavItem(new PageTitle($this->csen('Kontakt', 'Contact')), ':Default:About:Contact'), + new NavItem(new PageTitle($this->csen('Organizátoři', 'Organizers')), ':Default:About:organizers'), + new NavItem(new PageTitle($this->csen('Historie', 'History')), ':Default:About:history'), + new NavItem(new PageTitle($this->csen('Kontakt', 'Contact')), ':Default:About:contact'), ], ); @@ -44,7 +44,7 @@ protected function getNavItems(): array [], [ new NavItem(new PageTitle($this->csen('Základní informace', 'Basic Information')), ':Events:Fykos:'), - new NavItem(new PageTitle($this->csen('Pravidla', 'Rules')), ':Events:Fykos:Rules'), + new NavItem(new PageTitle($this->csen('Pravidla', 'Rules')), ':Events:Fykos:rules'), new NavItem( new PageTitle($this->csen('Jak psát řešení', 'How to Write Solutions')), ':Events:Fykos:TexTutorial' diff --git a/app/RouterFactory.php b/app/RouterFactory.php index 4ed0b891..1a16dd93 100755 --- a/app/RouterFactory.php +++ b/app/RouterFactory.php @@ -203,6 +203,17 @@ public static function createFykosRouter(?array $domainList, array $routerMappin { $router = new RouteList(); + $router->addRoute('////[[/]]', [ + 'module' => 'Events', + 'presenter' => 'Default', + 'action' => 'default', + 'lang' => ['filterTable' => [ + 'akce' => "cs", + 'events' => "en", + ]], + null => self::useTranslateFilter($domainList, $routerMapping['events']), + ]); + $router->addRoute('///[/]', [ 'module' => 'Default', 'presenter' => 'Results', @@ -222,11 +233,12 @@ public static function createFykosRouter(?array $domainList, array $routerMappin null => self::useTranslateFilter($domainList, $routerMapping['default']), ]); - $router->addRoute('////[[/]]', [ - 'presenter' => 'Default', - 'action' => 'default', - null => self::useTranslateFilter($domainList, $routerMapping['events']), - ]); + + // $router->addRoute('////[[/]]', [ + // 'presenter' => 'Default', + // 'action' => 'default', + // null => self::useTranslateFilter($domainList, $routerMapping['events']), + // ]); $router->withModule('Default') ->addRoute('///[/]', [ From eeae5c5821cdc9c025da0890353ba58ec3bbdaa1 Mon Sep 17 00:00:00 2001 From: vanekm Date: Fri, 23 Aug 2024 15:52:13 +0200 Subject: [PATCH 3/4] fix actions routing in cz --- .../templates/Default/otherEvents.cs.latte | 43 ------------------- .../templates/Default/otherEvents.en.latte | 31 ------------- ...tte => organizationalRegulations.cs.latte} | 0 ...tte => organizationalRegulations.en.latte} | 0 app/config/fof-router-mapping.neon | 7 +++ app/config/fol-router-mapping.neon | 9 ++++ app/config/fykos-router-mapping.neon | 2 +- 7 files changed, 17 insertions(+), 75 deletions(-) delete mode 100644 app/Modules/Fol/DefaultModule/templates/Default/otherEvents.cs.latte delete mode 100644 app/Modules/Fol/DefaultModule/templates/Default/otherEvents.en.latte rename app/Modules/Fol/DefaultModule/templates/Rules/{organisationalRegulations.cs.latte => organizationalRegulations.cs.latte} (100%) rename app/Modules/Fol/DefaultModule/templates/Rules/{organisationalRegulations.en.latte => organizationalRegulations.en.latte} (100%) diff --git a/app/Modules/Fol/DefaultModule/templates/Default/otherEvents.cs.latte b/app/Modules/Fol/DefaultModule/templates/Default/otherEvents.cs.latte deleted file mode 100644 index 67f2507f..00000000 --- a/app/Modules/Fol/DefaultModule/templates/Default/otherEvents.cs.latte +++ /dev/null @@ -1,43 +0,0 @@ -{block head} - -{/block} -{block content} -
-
-
-

FYKOS

- -
-
-

Fyziklání 2020

- -
-
-
-
-

Fyzikální Náboj

- -
-
-

Výfuk

- -
-
-
-
-

Týden vědy na Jaderce

- -
-
-
-{/block} diff --git a/app/Modules/Fol/DefaultModule/templates/Default/otherEvents.en.latte b/app/Modules/Fol/DefaultModule/templates/Default/otherEvents.en.latte deleted file mode 100644 index 4413db38..00000000 --- a/app/Modules/Fol/DefaultModule/templates/Default/otherEvents.en.latte +++ /dev/null @@ -1,31 +0,0 @@ -{block head} - -{/block} -{block content} -
-
-
-

FYKOS

- -
-
-

Fyziklani 2020

- -
-
-
-
-

Physics Náboj

- -
-
-
-{/block} diff --git a/app/Modules/Fol/DefaultModule/templates/Rules/organisationalRegulations.cs.latte b/app/Modules/Fol/DefaultModule/templates/Rules/organizationalRegulations.cs.latte similarity index 100% rename from app/Modules/Fol/DefaultModule/templates/Rules/organisationalRegulations.cs.latte rename to app/Modules/Fol/DefaultModule/templates/Rules/organizationalRegulations.cs.latte diff --git a/app/Modules/Fol/DefaultModule/templates/Rules/organisationalRegulations.en.latte b/app/Modules/Fol/DefaultModule/templates/Rules/organizationalRegulations.en.latte similarity index 100% rename from app/Modules/Fol/DefaultModule/templates/Rules/organisationalRegulations.en.latte rename to app/Modules/Fol/DefaultModule/templates/Rules/organizationalRegulations.en.latte diff --git a/app/config/fof-router-mapping.neon b/app/config/fof-router-mapping.neon index bad3d1d7..13eadba1 100644 --- a/app/config/fof-router-mapping.neon +++ b/app/config/fof-router-mapping.neon @@ -21,6 +21,13 @@ parameters: Spoluprace: Cooperation en: About: AboutTheCompetition + actions: + cs: + organizatori: organizers + uplna: complete + organizacniRad: organizationalRegulations + rozhodnutiKomise: resolutions + archive: cs: Default: Default diff --git a/app/config/fol-router-mapping.neon b/app/config/fol-router-mapping.neon index bcdfb7f8..a49225e4 100644 --- a/app/config/fol-router-mapping.neon +++ b/app/config/fol-router-mapping.neon @@ -21,6 +21,15 @@ parameters: Spoluprace: Cooperation en: About: AboutTheCompetition + actions: + cs: + uplna: complete + organizacniRad: organizationalRegulations + organisationalRegulations: organizationalRegulations # historical + rozhodnutiKomise: resolutions + en: + organisationalRegulations: organizationalRegulations # historical + archive: cs: Default: Default diff --git a/app/config/fykos-router-mapping.neon b/app/config/fykos-router-mapping.neon index 51e773e2..aa24ab2f 100644 --- a/app/config/fykos-router-mapping.neon +++ b/app/config/fykos-router-mapping.neon @@ -14,7 +14,7 @@ parameters: actions: cs: historie: history - organizatori: organizers + lidi: organizers kontakt: contact events: cs: From 760bcb094f2284d9a12e085da83184e5e5c95048 Mon Sep 17 00:00:00 2001 From: vanekm Date: Fri, 23 Aug 2024 17:19:11 +0200 Subject: [PATCH 4/4] organizers routing --- app/config/fykos-router-mapping.neon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/fykos-router-mapping.neon b/app/config/fykos-router-mapping.neon index aa24ab2f..51e773e2 100644 --- a/app/config/fykos-router-mapping.neon +++ b/app/config/fykos-router-mapping.neon @@ -14,7 +14,7 @@ parameters: actions: cs: historie: history - lidi: organizers + organizatori: organizers kontakt: contact events: cs: