Merge branch 'auth_docs'
[mediagoblin.git] / mediagoblin / templates / mediagoblin / base.html
index 9c42a7567d0956d9450e586e087c2de50eb7b3b8..483b6dfa85e31aecd5d5fab6fde66ada95134fab 100644 (file)
@@ -23,6 +23,7 @@
   <head>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
     <title>{% block title %}{{ app_config['html_title'] }}{% endblock %}</title>
     <link rel="stylesheet" type="text/css"
           href="{{ request.staticdirect('/css/extlib/reset.css') }}"/>
@@ -34,6 +35,8 @@
             src="{{ request.staticdirect('/js/extlib/jquery.js') }}"></script>
     <script type="text/javascript"
             src="{{ request.staticdirect('/js/header_dropdown.js') }}"></script>
+    <script type="text/javascript"
+            src="{{ request.staticdirect('/js/notifications.js') }}"></script>
 
     {# For clarification, the difference between the extra_head.html template
      # and the head template hook is that the former should be used by
     {% include "mediagoblin/extra_head.html" %}
     {% template_hook("head") %}
 
+    {% template_hook("persona_head") %}
+
     {% block mediagoblin_head %}
     {% endblock mediagoblin_head %}
   </head>
   <body>
-    {% include 'mediagoblin/bits/body-start.html' %}
+    {% include 'mediagoblin/bits/body_start.html' %}
     {% block mediagoblin_body %}
       {% block mediagoblin_header %}
         <header>
           <div class="header_right">
             {%- if request.user %}
               {% if request.user and request.user.status == 'active' %}
-                <div class="button_action header_dropdown_down">&#9660;</div>
-                <div class="button_action header_dropdown_up">&#9650;</div>
+
+                {% set notification_count = get_notification_count(request.user.id) %}
+                {% if notification_count %}
+                  <a href="#notifications" class="notification-gem button_action" title="Notifications">
+                  {{ notification_count }}</a>
+                {% endif %}
+                <a href="#header" class="button_action header_dropdown_down">&#9660;</a>
+                <a href="#no_header" class="button_action header_dropdown_up">&#9650;</a>
               {% elif request.user and request.user.status == "needs_email_verification" %}
               {# the following link should only appear when verification is needed #}
                 <a href="{{ request.urlgen('mediagoblin.user_pages.user_home',
                                  user=request.user.username) }}"
                    class="button_action_highlight">
                {% trans %}Verify your email!{% endtrans %}</a>
-               or <a href="{{ request.urlgen('mediagoblin.auth.logout') }}">{% trans %}log out{% endtrans %}</a>
+               or <a id="logout" href=
+               {% if persona is not defined %}
+                 "{{ request.urlgen('mediagoblin.auth.logout') }}"
+               {% else %}
+                 "javascript:;"
+               {% endif %}
+               >{% trans %}log out{% endtrans %}</a>
               {% endif %}
-            {%- else %}
-              <a href="{{ request.urlgen('mediagoblin.auth.login') }}?next={{
-                                                request.base_url|urlencode }}">
+            {%- elif auth %}
+            <a href=
+              {% if persona_auth is defined %}
+                "javascript:;" id="persona_login"
+              {% else %}
+                "{{ request.urlgen('mediagoblin.auth.login') }}"
+              {% endif %}
+              >
                 {%- trans %}Log in{% endtrans -%}
               </a>
             {%- endif %}
                   {%- trans %}Media processing panel{% endtrans -%}
                 </a>
                 &middot;
-                <a href="{{ request.urlgen('mediagoblin.auth.logout') }}">{% trans %}Log out{% endtrans %}</a>
+                <a id="logout" href=
+                  {% if persona is not defined %}
+                    "{{ request.urlgen('mediagoblin.auth.logout') }}"
+                  {% else %}
+                    "javascript:;"
+                  {% endif %}
+                  >{% trans %}Log out{% endtrans %}</a>
               </p>
               <a class="button_action" href="{{ request.urlgen('mediagoblin.submit.start') }}">
                 {%- trans %}Add media{% endtrans -%}
                   </a>
                 </p>
               {% endif %}
+              {% include 'mediagoblin/fragments/header_notifications.html' %}
             </div>
           {% endif %}
         </header>
       {% endblock %}
       <div class="container">
-        {% include 'mediagoblin/bits/above-content.html' %}
+        {% include 'mediagoblin/bits/above_content.html' %}
         <div class="mediagoblin_content">
           {% include "mediagoblin/utils/messages.html" %}
           {% block mediagoblin_content %}
           {% endblock mediagoblin_content %}
+          {% if csrf_token is defined %}
+            {% template_hook("persona_form") %}
+          {% endif %}
         </div>
-        {%- block mediagoblin_footer %}
-          <footer>
-            {% trans -%}
-              Powered by <a href="http://mediagoblin.org/" title='Version {{ version }}'>MediaGoblin</a>, a <a href="http://gnu.org/">GNU</a> project.
-            {%- endtrans %}
-            {% trans source_link=app_config['source_link'] -%}
-              Released under the <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html">AGPL</a>. <a href="{{ source_link }}">Source code</a> available.
-            {%- endtrans %}
-          </footer>
-        {%- endblock mediagoblin_footer %}
+        {%- include "mediagoblin/bits/base_footer.html" %}
       </div>
     {%- endblock mediagoblin_body %}
-    {% include 'mediagoblin/bits/body-end.html' %}
+    {% include 'mediagoblin/bits/body_end.html' %}
   </body>
 </html>