Commit 194875d8 authored by Rejo Zenger's avatar Rejo Zenger

Language selector now is first argument in URL. Simplification and...

Language selector now is first argument in URL. Simplification and deduplicatoin of language determination.
parent 6187dada
Pipeline #595 failed with stage
......@@ -17,6 +17,9 @@ class Controller {
);
$f3->set('languages', $languages);
$f3->set('LOCALES','app/dict/');
$f3->set('LANGUAGE', $args['lang']);
// Init campaign informations
$f3->set('campaign', Api::get_campaign());
......
......@@ -12,18 +12,6 @@ class Main extends Controller {
* Presents campaign information and a random Contact
*/
function home($f3,$args) {
$f3->set('LOCALES','app/dict/');
switch($args['lang']){
case "en":
$f3->set('LANGUAGE', 'en');
break;
case "nl":
$f3->set('LANGUAGE', 'nl');
break;
case "de":
$f3->set('LANGUAGE', 'de');
break;
}
// Select a random contact
//TODO: use weight for random
$contacts = $f3->get('contacts');
......@@ -41,18 +29,6 @@ class Main extends Controller {
* POST: send the form to the campaign API and show thank you
*/
function feedbackform($f3, $args) {
$f3->set('LOCALES','app/dict/');
switch($args['lang']){
case "en":
$f3->set('LANGUAGE', 'en');
break;
case "nl":
$f3->set('LANGUAGE', 'nl');
break;
case "de":
$f3->set('LANGUAGE', 'de');
break;
}
//GET
if ($f3->get('VERB') == 'GET'){
$categories = Api::get_feedback_categories();
......@@ -132,18 +108,6 @@ class Main extends Controller {
}
function campaign($f3, $args) {
$f3->set('LOCALES','app/dict/');
switch($args['lang']){
case "en":
$f3->set('LANGUAGE', 'en');
break;
case "nl":
$f3->set('LANGUAGE', 'nl');
break;
case "de":
$f3->set('LANGUAGE', 'de');
break;
}
$arguments = Api::get_arguments();
$f3->set('arguments', $arguments);
......@@ -151,34 +115,10 @@ class Main extends Controller {
}
function piphone($f3, $args) {
$f3->set('LOCALES','app/dict/');
switch($args['lang']){
case "en":
$f3->set('LANGUAGE', 'en');
break;
case "nl":
$f3->set('LANGUAGE', 'nl');
break;
case "de":
$f3->set('LANGUAGE', 'de');
break;
}
$f3->set('block_content', 'piphone.html');
}
function about($f3, $args) {
$f3->set('LOCALES','app/dict/');
switch($args['lang']){
case "en":
$f3->set('LANGUAGE', 'en');
break;
case "nl":
$f3->set('LANGUAGE', 'nl');
break;
case "de":
$f3->set('LANGUAGE', 'de');
break;
}
$f3->set('block_content', 'about.html');
}
......
......@@ -15,5 +15,3 @@ DEBUG=3
;LANGUAGE='en'
; Global variables of website
LOCALES='app/dict/'
[routes]
; Main site
GET @home:/=Main->home
GET @home:/@lang=Main->home
GET|POST @feedback:/feedback=Main->feedbackform
GET|POST @feedback:/feedback/@lang=Main->feedbackform
GET|POST @call:/call/@id=Main->call
GET|POST @call:/call/@id/@lang=Main->call
GET|POST @feedback:/@lang/feedback=Main->feedbackform
GET|POST @call:/@lang/call/@id=Main->call
GET @contactslist:/contactslist=Main->contactslist
GET @feedbacksip:/calls/@callid=SIP->feedbacksip
GET @campaign:/campaign=Main->campaign
GET @campaign:/campaign/@lang=Main->campaign
GET @piphone:/piphone=Main->piphone
GET @piphone:/piphone/@lang=Main->piphone
GET @about:/about=Main->about
GET @about:/about/@lang=Main->about
GET @campaign:/@lang/campaign=Main->campaign
GET @piphone:/@lang/piphone=Main->piphone
GET @about:/@lang/about=Main->about
; Fake REST API
GET /restapi/campaigns/@id=RestApi->campaign
......
......@@ -3,8 +3,8 @@
<div class="container">
<div class="footer_item">
<ul>
<li><a href="/">{{ @footer.root }}</a></li>
<li><a href="/about">{{ @footer.contactcredits }}</a></li>
<li><a href="{{ 'home' | alias }}">{{ @footer.root }}</a></li>
<li><a href="{{ 'about' | alias }}">{{ @footer.contactcredits }}</a></li>
</ul>
</div>
<div class="footer_item mailinglist">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment