From: Raphaël Gertz Date: Tue, 1 Aug 2017 17:32:55 +0000 (+0200) Subject: Add blog bundle files X-Git-Tag: 0.1~69 X-Git-Url: https://git.rapsys.eu/blogbundle/commitdiff_plain/06d85d868aa5a36bb83575d3cd9df95d3011320d Add blog bundle files --- 06d85d868aa5a36bb83575d3cd9df95d3011320d diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1c17649 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.*.un~ +*~ diff --git a/Controller/DefaultController.php b/Controller/DefaultController.php new file mode 100644 index 0000000..b9316f2 --- /dev/null +++ b/Controller/DefaultController.php @@ -0,0 +1,46 @@ +getParameter('blog.locales')); + + //Language list + if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { + //Init array + $httpAcceptLanguage = []; + + //Extract languages + foreach(explode(',',str_replace('-','_',$_SERVER['HTTP_ACCEPT_LANGUAGE'])) as $candidate) { + //Extract candidate and optional weight + @list($candidate, $weight) = explode(';', $candidate); + if (!empty($candidate)) { + $httpAcceptLanguage[!empty($weight)?$weight:1][] = $candidate; + } + } + + //Find first match + if (!empty($httpAcceptLanguage)) { + foreach($httpAcceptLanguage as $weight => $candidates) { + if (($candidate = array_intersect($candidates, $supportedLanguage)) && ($candidate = reset($candidate))) { + $locale = $candidate; + break; + } + } + } + } + + //Redirect to localised homepage + return $this->redirectToRoute('homepage', array('_locale' => $locale), 302); + } +} diff --git a/Controller/PageController.php b/Controller/PageController.php new file mode 100644 index 0000000..32eddfd --- /dev/null +++ b/Controller/PageController.php @@ -0,0 +1,28 @@ +render('RapsysBlogBundle::index.html.twig'); + } + + /** + * Legal informations + */ + public function aboutAction() { + return $this->render('RapsysBlogBundle::about.html.twig'); + } + + /** + * Contact form + */ + public function contactAction() { + return $this->render('RapsysBlogBundle::contact.html.twig'); + } +} diff --git a/RapsysBlogBundle.php b/RapsysBlogBundle.php new file mode 100644 index 0000000..529e6ea --- /dev/null +++ b/RapsysBlogBundle.php @@ -0,0 +1,9 @@ +Dev log{% endblock %} +{% block content %}TODO: page de about{% endblock %} diff --git a/Resources/views/base.html.twig b/Resources/views/base.html.twig new file mode 100644 index 0000000..0a40530 --- /dev/null +++ b/Resources/views/base.html.twig @@ -0,0 +1,20 @@ + + + + + {% block title %}Welcome!{% endblock %} - Devlog + + {% block stylesheets %} + {% stylesheets '//fonts.googleapis.com/css?family=Irish+Grover' '//fonts.googleapis.com/css?family=La+Belle+Aurore' '@RapsysBlogBundle/Resources/public/css/{reset,screen}.css' filter='toto' %} + + {% endstylesheets %} + {% endblock %} + {% block javascripts %} + {% javascripts '@RapsysBlogBundle/Resources/js/*.js' output='js/compiled/main.js' %} + + {% endjavascripts %} + {% endblock %} + + + {% block body %}{% endblock %} + diff --git a/Resources/views/body.html.twig b/Resources/views/body.html.twig new file mode 100644 index 0000000..0fd4304 --- /dev/null +++ b/Resources/views/body.html.twig @@ -0,0 +1,42 @@ +{% extends 'RapsysBlogBundle::base.html.twig' %} +{% block body %} + +
+ {% block header %} + + {% endblock %} + + {% block sidebar %}{% endblock %} + + {% block content %}
{% endblock %} + + {% block footer %} +
+ Copyright 2016 - Raphaël Gertz all rights reserved. +
+ {% endblock %} +
+ +{% endblock %} diff --git a/Resources/views/contact.html.twig b/Resources/views/contact.html.twig new file mode 100644 index 0000000..f1b3677 --- /dev/null +++ b/Resources/views/contact.html.twig @@ -0,0 +1,3 @@ +{% extends 'RapsysBlogBundle::body.html.twig' %} +{% block title %}

Dev log

{% endblock %} +{% block content %}TODO: page de contact{% endblock %} diff --git a/Resources/views/index.html.twig b/Resources/views/index.html.twig new file mode 100644 index 0000000..a32a0ca --- /dev/null +++ b/Resources/views/index.html.twig @@ -0,0 +1,3 @@ +{% extends 'RapsysBlogBundle::body.html.twig' %} +{% block title %}Welcome!{% endblock %} +{% block content %}Hello world !{% endblock %}