]> Raphaël G. Git Repositories - blogbundle/commitdiff
Review layout for easier styling
authorRaphaël Gertz <git@rapsys.eu>
Sun, 25 Feb 2018 05:25:41 +0000 (06:25 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Sun, 25 Feb 2018 05:26:54 +0000 (06:26 +0100)
Add link to alternative page
Add specific templates

Resources/views/article/index.html.twig [new file with mode: 0644]
Resources/views/article/read.html.twig [new file with mode: 0644]
Resources/views/body.html.twig
Resources/views/keyword/index.html.twig [new file with mode: 0644]
Resources/views/keyword/read.html.twig [new file with mode: 0644]
Resources/views/mail/contact.html.twig [new file with mode: 0644]
Resources/views/page/about.html.twig [new file with mode: 0644]
Resources/views/page/contact.html.twig [new file with mode: 0644]

diff --git a/Resources/views/article/index.html.twig b/Resources/views/article/index.html.twig
new file mode 100644 (file)
index 0000000..817a4e0
--- /dev/null
@@ -0,0 +1,29 @@
+{% extends 'RapsysBlogBundle::body.html.twig' %}
+{% block blog_title %}<h1><a href="{{ path('homepage') }}">{% trans %}Dev log{% endtrans %}</a></h1>{% endblock %}
+{% block content %}
+<section id="content">
+       <h2><a href="{{ path('articles') }}">{% trans %}Articles list{% endtrans %}</a></h2>
+       {% for article in articles %}
+       <article>
+               <header>
+                       <h3><a href="{{ path('articles_article', {'_article': article.slug}) }}">{{article.title}}</a></h3>
+                       <p>
+                               <span>{% trans with {'%date%': article.created|localizeddate('full', 'short')} %}Published the %date%{% endtrans %}{% if article.created != article.updated %}{% trans with {'%date%': article.updated|localizeddate('short', 'short')} %}, edited the %date%{% endtrans %}{% endif %}</span>
+                               {% if article.keywords %}
+                                       <span>
+                                               {% transchoice article.keywords|length %}{1} Keyword:|]1,Inf[ Keywords:{% endtranschoice %}
+                                               {% for slug, keyword in article.keywords %}
+                                                       <a href="{{ path('keywords_keyword', {'_keyword': slug}) }}">{{ keyword }}</a>
+                                               {% endfor %}
+                                       </span>
+                               {% endif %}
+                       </p>
+               </header>
+               <p>{{article.description}}</p>
+               <nav>
+                       <a href="{{ path('articles_article', {'_article': article.slug}) }}">{% trans %}Read more{% endtrans %}...</a>
+               </nav>
+       </article>
+       {% endfor %}
+</section>
+{% endblock %}
diff --git a/Resources/views/article/read.html.twig b/Resources/views/article/read.html.twig
new file mode 100644 (file)
index 0000000..329ae40
--- /dev/null
@@ -0,0 +1,37 @@
+{% extends 'RapsysBlogBundle::body.html.twig' %}
+{% block blog_title %}<h1><a href="{{ path('homepage') }}">{% trans %}Dev log{% endtrans %}</a></h1>{% endblock %}
+{% block blog_subtitle %}<h2><a href="{{ path('articles') }}">{% trans %}Articles list{% endtrans %}</a></h2>{% endblock %}
+{% block content %}
+       {% if article is defined and article %}
+       <article id="article">
+               <header>
+                       <h3><a href="{{ path('articles_article', {'_article': article.slug}) }}">{{article.title}}</a></h3>
+                       <p>
+                               <span>{% trans with {'%date%': article.created|localizeddate('full', 'short')} %}Published the %date%{% endtrans %}{% if article.created != article.updated %}{% trans with {'%date%': article.updated|localizeddate('short', 'short')} %}, edited the %date%{% endtrans %}{% endif %}</span>
+                               {% if article.keywords %}
+                                       <span>
+                                               {% transchoice article.keywords|length %}{1} Keyword:|]1,Inf[ Keywords:{% endtranschoice %}
+                                               {% for keyword_id, keyword in article.keywords %}
+                                                       <a href="{{ path('keywords_keyword', {'_keyword': keyword_id}) }}">{{ keyword }}</a>
+                                               {% endfor %}
+                                       </span>
+                               {% endif %}
+                       </p>
+               </header>
+               <p>{{article.body|bb2html}}</p>
+       </article>
+       {% endif %}
+{% endblock %}
+{% block alternate %}
+       <link rel="alternate" href="{{ path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) }}" hreflang="{{ app.request.locale }}"/>
+       {% for locale, slug in article.slugs %}
+               <link rel="alternate" href="{{ path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')|merge(app.request.query.all|merge({'_locale': locale, '_article': slug}))) }}" hreflang="{{ locale }}"/>
+       {% endfor %}
+{% endblock %}
+{% block footer_nav %}
+       <nav>
+               {% for locale, slug in article.slugs %}
+                       <a href="{{ path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')|merge(app.request.query.all|merge({'_locale': locale, '_article': slug}))) }}">{{ ('Display in ' ~ locale)|trans }}</a>
+               {% endfor %}
+       </nav>
+{% endblock %}
index 0fd43042fb29949810bc64b8ea46f56f55f5b6c1..6535e78978937b9fe436dad0cd7e8eedc612d7dd 100644 (file)
@@ -1,42 +1,47 @@
 {% extends 'RapsysBlogBundle::base.html.twig' %}
 {% block body %}
        <body>
 {% extends 'RapsysBlogBundle::base.html.twig' %}
 {% block body %}
        <body>
-               <section id="wrapper">
-                       {% block header %}
-                               <header id="header">
-                                       {% block nav %}
-                                               <nav>
-                                                       <a href="{{ url('about') }}">About</a>
-                                                       <a href="{{ url('contact') }}">Contact</a>
-                                               </nav>
+               {% block header %}
+                       <header id="header">
+                               {% block header_title %}
+                                       {% block blog_title %}<h1><a href="{{ path('homepage') }}">{% trans %}Dev log{% endtrans %}</a></h1>{% endblock %}
+                                               {% block header_nav %}
+                                                       <nav>
+                                                               <h2>{% trans %}Navigation{% endtrans %}</h2>
+                                                               <a href="{{ path('about') }}">{% trans %}About{% endtrans %}</a>
+                                                               <a href="{{ path('contact') }}">{% trans %}Contact{% endtrans %}</a>
+                                                       </nav>
+                                               {% endblock %}
+                                               {% block blog_subtitle %}{% endblock %}
+                                       {% block blog_tagline %}
+                                               {% if tags is defined and tags %}
+                                                       <ul>
+                                                               {% for id, tag in tags %}
+                                                                       <li><h2><a href="#">Tag</a></h2></li>
+                                                               {% endfor %}
+                                                       </ul>
+                                               {% endif %}
                                        {% endblock %}
                                        {% endblock %}
+                               {% endblock %}
+                       </header>
+               {% endblock %}
 
 
-                                       {% block hgroup %}
-                                               <hgroup>
-                                                       {% block blog_title %}<h1><a href="{{ url('homepage') }}">Dev log</a></h1>{% endblock %}
-                                                       {% block blog_tagline %}
-                                                               {% if tags is defined and tags %}
-                                                                       <ul>
-                                                                               {% for id, tag in tags %}
-                                                                                       <li><h2><a href="#">Tag</a></h2></li>
-                                                                               {% endfor %}
-                                                                       </ul>
-                                                               {% endif %}
-                                                       {% endblock %}
-                                               </hgroup>
-                                       {% endblock %}
-                               </header>
-                       {% endblock %}
-
-                       {% block sidebar %}<aside id="sidebar"></aside>{% endblock %}
+               {% block sidebar %}<aside id="sidebar"></aside>{% endblock %}
 
 
-                       {% block content %}<section id="content"></section>{% endblock %}
+               {% block content %}<section id="content"></section>{% endblock %}
 
 
-                       {% block footer %}
-                               <footer id="footer">
-                                       <summary>Copyright 2016</summary> - Raphaël Gertz all rights reserved.
-                               </footer>
-                       {% endblock %}
-               </section>
+               {% block footer %}
+                       <footer id="footer">
+                               <span>&nbsp;</span>
+                               <details><summary>{% trans %}Raphaël Gertz all rights reserved{% endtrans %}</summary><span>{% trans %}Copyright 2016-2018{% endtrans %}.</span></details>
+                               {% block footer_nav %}
+                                       <nav>
+                                               {% for locale in blog_locales if locale != app.request.locale %}
+                                                       <a href="{{ path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')|merge(app.request.query.all|merge({'_locale': locale}))) }}">{{ ('Display in ' ~ locale)|trans }}</a>
+                                               {% endfor %}
+                                       </nav>
+                               {% endblock %}
+                       </footer>
+               {% endblock %}
        </body>
 {% endblock %}
        </body>
 {% endblock %}
diff --git a/Resources/views/keyword/index.html.twig b/Resources/views/keyword/index.html.twig
new file mode 100644 (file)
index 0000000..9860b9c
--- /dev/null
@@ -0,0 +1,28 @@
+{% extends 'RapsysBlogBundle::body.html.twig' %}
+{% block blog_title %}<h1><a href="{{ path('homepage') }}">{% trans %}Dev log{% endtrans %}</a></h1>{% endblock %}
+{% block content %}
+<section id="content">
+       <h2><a href="{{ path('keywords') }}">{% trans %}Keywords list{% endtrans %}</a></h2>
+       {% for keyword in keywords %}
+       <article>
+               <header>
+                       <h3><a href="{{ path('keywords_keyword', {'_keyword': keyword.slug}) }}">{{keyword.title}}</a></h3>
+                       <p>
+                               <span>{% trans with {'%date%': keyword.created|localizeddate('full', 'short')} %}Published the %date%{% endtrans %}{% if keyword.created != keyword.updated %}{% trans with {'%date%': keyword.updated|localizeddate('short', 'short')} %}, edited the %date%{% endtrans %}{% endif %}</span>
+                       </p>
+               </header>
+               {% if keyword.articles %}
+                       <p style="margin-bottom: 0">{% transchoice keyword.articles|length %}{1} Article:|]1,Inf[ Articles:{% endtranschoice %}</p>
+                       <ul>
+                               {% for slug, article in keyword.articles %}
+                                       <li><a href="{{ path('articles_article', {'_article': slug}) }}">{{ article }}</a></li>
+                               {% endfor %}
+                       </ul>
+               {% endif %}
+               <nav>
+                       <a href="{{ path('keywords_keyword', {'_keyword': keyword.slug}) }}">{% trans %}Read more{% endtrans %}...</a>
+               </nav>
+       </article>
+       {% endfor %}
+</section>
+{% endblock %}
diff --git a/Resources/views/keyword/read.html.twig b/Resources/views/keyword/read.html.twig
new file mode 100644 (file)
index 0000000..24d3601
--- /dev/null
@@ -0,0 +1,39 @@
+{% extends 'RapsysBlogBundle::body.html.twig' %}
+{% block blog_title %}<h1><a href="{{ path('homepage') }}">{% trans %}Dev log{% endtrans %}</a></h1>{% endblock %}
+{% block blog_subtitle %}<h2><a href="{{ path('keywords') }}">{% trans %}Keywords list{% endtrans %}</a></h2>{% endblock %}
+{% block content %}
+       {% if keyword is defined and keyword %}
+       <article id="keyword">
+               <header>
+                       <h3><a href="{{ path('keywords_keyword', {'_keyword': keyword.slug}) }}">{{keyword.title}}</a></h3>
+                       <p>
+                               <span>{% trans with {'%date%': keyword.created|localizeddate('full', 'short')} %}Published the %date%{% endtrans %}{% if keyword.created != keyword.updated %}{% trans with {'%date%': keyword.updated|localizeddate('short', 'short')} %}, edited the %date%{% endtrans %}{% endif %}</span>
+                       </p>
+               </header>
+               <p>{{ keyword.description }}</p>
+               {% if keyword.articles %}
+                       <p style="margin-bottom: 0">{% transchoice keyword.articles|length %}{1} Article:|]1,Inf[ Articles:{% endtranschoice %}</p>
+                       <nav>
+                               <ul>
+                                       {% for slug, article in keyword.articles %}
+                                               <li><a href="{{ path('articles_article', {'_article': slug}) }}">{{ article }}</a></li>
+                                       {% endfor %}
+                               </ul>
+                       </nav>
+               {% endif %}
+       </article>
+       {% endif %}
+{% endblock %}
+{% block alternate %}
+       <link rel="alternate" href="{{ path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) }}" hreflang="{{ app.request.locale }}"/>
+       {% for locale, slug in keyword.slugs %}
+               <link rel="alternate" href="{{ path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')|merge(app.request.query.all|merge({'_locale': locale, '_keyword': slug}))) }}" hreflang="{{ locale }}"/>
+       {% endfor %}
+{% endblock %}
+{% block footer_nav %}
+       <nav>
+               {% for locale, slug in keyword.slugs %}
+                       <a href="{{ path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')|merge(app.request.query.all|merge({'_locale': locale, '_keyword': slug}))) }}">{{ ('Display in ' ~ locale)|trans }}</a>
+               {% endfor %}
+       </nav>
+{% endblock %}
diff --git a/Resources/views/mail/contact.html.twig b/Resources/views/mail/contact.html.twig
new file mode 100644 (file)
index 0000000..dbbf5fe
--- /dev/null
@@ -0,0 +1,46 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+       <meta name="viewport" content="width=device-width" />
+       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+       <title>{{ subject }}</title>
+       <style>
+               body {background:white}
+               a {text-decoration:none;color:#0063c9}
+               a:hover {text-decoration:underline}
+               table {width: 100%;border-radius: .5rem}
+               table.head {background:#00c3f9;text-align:center}
+               table.body {background:white;border:1px solid #00c3f9;margin:.5rem 0;color:#066}
+               table.footer {background:#00c3f9}
+               table.footer details {text-align:center;color:#0063c9;font-weight:bold}
+               table.footer summary:after {display:none}
+               table.footer summary::-webkit-details-marker {display:none}
+       </style>
+</head>
+<body>
+       <table class="head">
+               <tr>
+                       <td><a href="{{ blog_url }}"><img src="data:image/png;base64, {{ blog_logo|base64_encode }}" alt="{{ blog_title }}" /></a></td>
+                       <td><h1><a href="{{ blog_url }}">{{ blog_title }}</a></h1></td>
+               </tr>
+       </table>
+       <table class="body">
+               <tr>
+                       <td>&nbsp;</td>
+                       <td>
+                               <h2>{% trans %}Hi,{% endtrans %} {{ contact_name }}</h2>
+                               <h3>{% trans %}Subject:{% endtrans %} {{ subject }}</h3>
+                               <p>{{ message|nl2br }}</p>
+                       </td>
+                       <td>&nbsp;</td>
+               </tr>
+       </table>
+       <table class="footer">
+               <tr>
+                       <td>&nbsp;</td>
+                       <td><details><summary>{% trans %}Raphaël Gertz all rights reserved{% endtrans %}</summary><span>{% trans %}Copyright 2016-2018{% endtrans %}.</span></details></td>
+                       <td>&nbsp;</td>
+               </tr>
+       </table>
+</body>
+</html>
diff --git a/Resources/views/page/about.html.twig b/Resources/views/page/about.html.twig
new file mode 100644 (file)
index 0000000..fde1616
--- /dev/null
@@ -0,0 +1,4 @@
+{% extends 'RapsysBlogBundle::body.html.twig' %}
+{% block blog_title %}<h1><a href="{{ path('homepage') }}">{% trans %}Dev log{% endtrans %}</a></h1>{% endblock %}
+{% block blog_subtitle %}<h2><a href="{{ path('about') }}">{% trans %}About{% endtrans %}</a></h2>{% endblock %}
+{% block content %}TODO: dernière page à faire avant la page cv et peut-être un peu de sémantique pour google &amp; facebook :){% endblock %}
diff --git a/Resources/views/page/contact.html.twig b/Resources/views/page/contact.html.twig
new file mode 100644 (file)
index 0000000..e98ef66
--- /dev/null
@@ -0,0 +1,41 @@
+{% extends 'RapsysBlogBundle::body.html.twig' %}
+{% block blog_title %}<h1><a href="{{ path('homepage') }}">{% trans %}Dev log{% endtrans %}</a></h1>{% endblock %}
+{% block blog_subtitle %}<h2><a href="{{ path('contact') }}">{% trans %}Contact{% endtrans %}</a></h2>{% endblock %}
+{% block content %}
+       <section id="contact">
+               <header>
+                       <h3><a href="{{ path('contact') }}">{% trans %}Contact{% endtrans %}</a></h3>
+               </header>
+               {% if sent %}
+                       <p>{% trans %}Your message has been sent{% endtrans %}</p>
+               {% else %}
+                       <div>
+                               {{ form_start(form) }}
+                                       {# Render CSRF token etc .#}
+                                       <div>
+                                               {{ form_widget(form.subject) }}
+                                               {{ form_errors(form.subject) }}
+                                       </div>
+                                       <div>
+                                               {{ form_widget(form.name) }}
+                                               {{ form_errors(form.name) }}
+                                       </div>
+                                       <div>
+                                               {{ form_widget(form.email) }}
+                                               {{ form_errors(form.email) }}
+                                       </div>
+                                       <div>
+                                               {{ form_widget(form.message) }}
+                                               {{ form_errors(form.message) }}
+                                       </div>
+
+                                       {{ form_row(form.submit) }}
+
+                                       <div style="display:none">
+                                               {{ form_rest(form) }}
+                                       </div>
+                               {{ form_end(form) }}
+                       </div>
+               {% endif %}
+       </section>
+{% endblock %}