From 0c7fa7556ced34444db82d2d2d3b51b4f5327586 Mon Sep 17 00:00:00 2001 From: Joar Wandborg Date: Sun, 9 Jun 2013 22:23:20 +0200 Subject: [PATCH] New notifications, fixed - Remove notification-gem if notifications are null - Move comment-susbscription next to add-comment button - Add copyright header to notifications.js --- mediagoblin/static/js/notifications.js | 18 ++++++++++++++++++ mediagoblin/templates/mediagoblin/base.html | 5 ++++- .../mediagoblin/user_pages/media.html | 5 +++-- .../utils/comment-subscription.html | 2 -- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/mediagoblin/static/js/notifications.js b/mediagoblin/static/js/notifications.js index 77793b34..0153463a 100644 --- a/mediagoblin/static/js/notifications.js +++ b/mediagoblin/static/js/notifications.js @@ -1,4 +1,22 @@ 'use strict'; +/** + * GNU MediaGoblin -- federated, autonomous media hosting + * Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + var notifications = {}; (function (n) { diff --git a/mediagoblin/templates/mediagoblin/base.html b/mediagoblin/templates/mediagoblin/base.html index f2723edb..25186b18 100644 --- a/mediagoblin/templates/mediagoblin/base.html +++ b/mediagoblin/templates/mediagoblin/base.html @@ -60,8 +60,11 @@ {%- 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 %} - {{ request.notifications.get_notification_count(request.user.id) }} + {{ notification_count }} + {% endif %}
{% elif request.user and request.user.status == "needs_email_verification" %} diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html index a2a8f3b6..c16e4c78 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/media.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media.html @@ -81,6 +81,7 @@ user= media.get_uploader.username, media_id=media.id) %} {% trans %}Delete{% endtrans %} + {% endif %} {% autoescape False %}

{{ media.description_html }}

@@ -94,6 +95,8 @@ class="button_action" id="button_addcomment" title="Add a comment"> {% trans %}Add a comment{% endtrans %} + {% include "mediagoblin/utils/comment-subscription.html" %} + {% endif %} {% if request.user %}
{% trans %}Attachments{% endtrans %}
    diff --git a/mediagoblin/templates/mediagoblin/utils/comment-subscription.html b/mediagoblin/templates/mediagoblin/utils/comment-subscription.html index 6598c733..8ee8c883 100644 --- a/mediagoblin/templates/mediagoblin/utils/comment-subscription.html +++ b/mediagoblin/templates/mediagoblin/utils/comment-subscription.html @@ -16,7 +16,6 @@ # along with this program. If not, see . #} {%- if request.user %} -

    {% set subscription = request.notifications.get_comment_subscription( request.user.id, media.id) %} {% if not subscription or not subscription.notify %} @@ -32,5 +31,4 @@ class="button_action">Silence comments {% endif %} -

    {%- endif %} -- 2.25.1