Browse Source

Add layout override to merge FOSUserBundle into the real layout

Jordi Boggiano 13 years ago
parent
commit
802cce31d8
1 changed files with 31 additions and 0 deletions
  1. 31 0
      app/Resources/FOSUserBundle/views/layout.html.twig

+ 31 - 0
app/Resources/FOSUserBundle/views/layout.html.twig

@@ -0,0 +1,31 @@
+{% extends 'PackagistWebBundle::layout.html.twig' %}
+
+{% block content %}
+    <div style="margin-bottom: 10px;">
+        {% if is_granted("IS_AUTHENTICATED_REMEMBERED") %}
+            {{ 'layout.logged_in_as'|trans({'%username%': app.user.username}, 'FOSUserBundle') }} |
+            <a href="{{ path('fos_user_security_logout') }}">
+                {{ 'layout.logout'|trans({}, 'FOSUserBundle') }}
+            </a>
+        {% else %}
+            <a href="{{ path('fos_user_security_login') }}">{{ 'layout.login'|trans({}, 
+'FOSUserBundle') }}</a>
+        {% endif %}
+    </div>
+
+    {% for key, flash in app.session.getFlashes() %}
+    <div class="{{ flash }}" style="margin-bottom: 5px;">
+        {{ key|trans({}, 'FOSUserBundle') }}
+    </div>
+    {% endfor %}
+
+    <div>
+        {% block fos_user_content %}{% endblock %}
+    </div>
+
+    <ul>
+        <li><a href="{{ path('fos_user_registration_register') }}">Create a new account</a></li>
+        <li><a href="{{ path('fos_user_profile_show') }}">See your profile</a></li>
+        <li><a href="{{ path('fos_user_security_logout') }}">Log out</a></li>
+    </ul>
+{% endblock %}