Added comment preview functionality to user pages. It works by passing the comment...
[mediagoblin.git] / mediagoblin / templates / mediagoblin / base.html
index 5eeea997a73e54b88739fab8d3315bd0614930ea..1fc4467cf0e9aa3aeaecd7462c40932eb18201bc 100644 (file)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 -#}
 <!doctype html>
-<html>
+<html
+{% block mediagoblin_html_tag %}
+{% endblock mediagoblin_html_tag %}
+>
   <head>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
           href="{{ request.staticdirect('/css/base.css') }}"/>
     <link rel="shortcut icon"
           href="{{ request.staticdirect('/images/goblin.ico') }}" />
-    <script src="{{ request.staticdirect('/js/extlib/jquery.js') }}"></script>
-    
-    <script>
-    $(document).ready(function(){
-       $(".header_right").click(function(){
-               $(".sublist").slideToggle("fast");
-       });
-});
-    </script>
-    <!--[if lt IE 9]>
-      <script src="{{ request.staticdirect('/js/extlib/html5shiv.js') }}"></script>
-    <![endif]-->
+    <script type="text/javascript"
+            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
+     # themes and the latter should be used by plugins.
+     # The reason is that only one thing can override extra_head.html...
+     # but multiple plugins can hook into the template hook.
+     #}
+    {% include "mediagoblin/extra_head.html" %}
+    {% template_hook("head") %}
+
     {% block mediagoblin_head %}
     {% endblock mediagoblin_head %}
   </head>
   <body>
+    {% include 'mediagoblin/bits/body_start.html' %}
     {% block mediagoblin_body %}
       {% block mediagoblin_header %}
         <header>
-          {% block mediagoblin_logo %}
-            <a class="logo"
-               href="{{ request.urlgen('index') }}"
-               ><img src="{{ request.staticdirect('/images/logo.png') }}"
-                   alt="{% trans %}MediaGoblin logo{% endtrans %}" /></a>
-          {% endblock mediagoblin_logo %}
-          {% if request.user and request.user.status == 'active' %}
-            <a class="button_action"
-               href="{{ request.urlgen('mediagoblin.submit.start') }}">
-              {% trans %}Add media{% endtrans %}
-            </a>
-          {% endif %}
+          {%- include "mediagoblin/bits/logo.html" -%}
           {% block mediagoblin_header_title %}{% endblock %}
           <div class="header_right">
-            {% if request.user %}
+            {%- if request.user %}
+              {% if request.user and request.user.status == 'active' %}
+
+                {% set notification_count = request.notifications.get_notification_count(request.user.id) %}
+                {% if notification_count %}
+                <a href="#notifications" class="notification-gem button_action" title="Notifications">
+                {{ notification_count }}</a>
+                {% endif %}
+                <div class="button_action header_dropdown_down">&#9660;</div>
+                <div class="button_action header_dropdown_up">&#9650;</div>
+              {% elif request.user and request.user.status == "needs_email_verification" %}
               {# the following link should only appear when verification is needed #}
-              {% if request.user.status == "needs_email_verification" %}
                 <a href="{{ request.urlgen('mediagoblin.user_pages.user_home',
-                                            user=request.user.username) }}"
+                                 user=request.user.username) }}"
                    class="button_action_highlight">
-                  {% trans %}Verify your email!{% endtrans %}</a>
+               {% trans %}Verify your email!{% endtrans %}</a>
+               or <a href="{{ request.urlgen('mediagoblin.auth.logout') }}">{% trans %}log out{% endtrans %}</a>
               {% endif %}
-             <a href="{{ request.urlgen('mediagoblin.user_pages.user_home',
-                                          user= request.user.username) }}">
-                {{ request.user.username }}</a>
-              (<a href="{{ request.urlgen('mediagoblin.auth.logout') }}">{% trans %}log out{% endtrans %}</a>)
-            {% else %}
-              <a href="{{ request.urlgen('mediagoblin.auth.login') }}">
-                {% trans %}Log in{% endtrans %}</a>
-            {% endif %}
-            <ul class="sublist">
-                       <li><a href="#">Enviornment</a></li>
-                         <li><a href="#">General Sciences</a></li>
-                         <li><a href="#">Space</a></li>
-                 </ul>
+            {%- elif auth %}
+              <a href="{{ request.urlgen('mediagoblin.auth.login') }}?next={{
+                                                request.base_url|urlencode }}">
+                {%- trans %}Log in{% endtrans -%}
+              </a>
+            {%- endif %}
           </div>
+          <div class="clear"></div>
+          {% if request.user and request.user.status == 'active' %}
+            <div class="header_dropdown">
+              <p>
+                <span class="dropdown_title">
+                  {% trans user_url=request.urlgen('mediagoblin.user_pages.user_home',
+                                                    user=request.user.username),
+                           user_name=request.user.username -%}
+                    <a href="{{ user_url }}">{{ user_name }}</a>'s account
+                  {%- endtrans %}
+                </span>
+                &middot;
+                <a href="{{ request.urlgen('mediagoblin.edit.account') }}">{%- trans %}Change account settings{% endtrans -%}</a>
+                &middot;
+                <a href="{{ request.urlgen('mediagoblin.user_pages.processing_panel',
+                                             user=request.user.username) }}">
+                  {%- trans %}Media processing panel{% endtrans -%}
+                </a>
+                &middot;
+                <a href="{{ request.urlgen('mediagoblin.auth.logout') }}">{% trans %}Log out{% endtrans %}</a>
+              </p>
+              <a class="button_action" href="{{ request.urlgen('mediagoblin.submit.start') }}">
+                {%- trans %}Add media{% endtrans -%}
+              </a>
+              <a class="button_action" href="{{ request.urlgen('mediagoblin.submit.collection') }}">
+                {%- trans %}Create new collection{% endtrans -%}
+              </a>
+              {% if request.user.is_admin %}
+                <p>
+                  <span class="dropdown_title">Admin powers:</span>
+                  <a href="{{ request.urlgen('mediagoblin.admin.panel') }}">
+                    {%- trans %}Media processing panel{% endtrans -%}
+                  </a>
+                </p>
+              {% endif %}
+              {% include 'mediagoblin/fragments/header_notifications.html' %}
+            </div>
+          {% endif %}
         </header>
       {% endblock %}
-    <div class="container">
-      <div class="mediagoblin_content">
+      <div class="container">
+        {% include 'mediagoblin/bits/above_content.html' %}
+        <div class="mediagoblin_content">
           {% include "mediagoblin/utils/messages.html" %}
           {% block mediagoblin_content %}
           {% endblock mediagoblin_content %}
+        </div>
+        {%- include "mediagoblin/bits/base_footer.html" %}
       </div>
-      {% block mediagoblin_footer %}
-          <footer>
-            {% trans -%}
-              Powered by <a href="http://mediagoblin.org">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 %}
-    {% endblock mediagoblin_body %}
-    </div>
+    {%- endblock mediagoblin_body %}
+    {% include 'mediagoblin/bits/body_end.html' %}
   </body>
 </html>