New notifications, fixed

- Remove notification-gem if notifications are null
- Move comment-susbscription next to add-comment button
- Add copyright header to notifications.js
This commit is contained in:
Joar Wandborg 2013-06-09 22:23:20 +02:00
parent 2d7b6bdef9
commit 0c7fa7556c
4 changed files with 25 additions and 5 deletions

View File

@ -1,4 +1,22 @@
'use strict'; '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 <http://www.gnu.org/licenses/>.
*/
var notifications = {}; var notifications = {};
(function (n) { (function (n) {

View File

@ -60,8 +60,11 @@
{%- if request.user %} {%- if request.user %}
{% if request.user and request.user.status == 'active' %} {% 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"> <a href="#notifications" class="notification-gem button_action" title="Notifications">
{{ request.notifications.get_notification_count(request.user.id) }}</a> {{ notification_count }}</a>
{% endif %}
<div class="button_action header_dropdown_down">&#9660;</div> <div class="button_action header_dropdown_down">&#9660;</div>
<div class="button_action header_dropdown_up">&#9650;</div> <div class="button_action header_dropdown_up">&#9650;</div>
{% elif request.user and request.user.status == "needs_email_verification" %} {% elif request.user and request.user.status == "needs_email_verification" %}

View File

@ -81,6 +81,7 @@
user= media.get_uploader.username, user= media.get_uploader.username,
media_id=media.id) %} media_id=media.id) %}
<a class="button_action" href="{{ delete_url }}">{% trans %}Delete{% endtrans %}</a> <a class="button_action" href="{{ delete_url }}">{% trans %}Delete{% endtrans %}</a>
{% endif %} {% endif %}
{% autoescape False %} {% autoescape False %}
<p>{{ media.description_html }}</p> <p>{{ media.description_html }}</p>
@ -94,6 +95,8 @@
class="button_action" id="button_addcomment" title="Add a comment"> class="button_action" id="button_addcomment" title="Add a comment">
{% trans %}Add a comment{% endtrans %} {% trans %}Add a comment{% endtrans %}
</a> </a>
{% include "mediagoblin/utils/comment-subscription.html" %}
{% endif %} {% endif %}
{% if request.user %} {% if request.user %}
<form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment', <form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment',
@ -167,8 +170,6 @@
{% include "mediagoblin/utils/exif.html" %} {% include "mediagoblin/utils/exif.html" %}
{% include "mediagoblin/utils/comment-subscription.html" %}
{%- if media.attachment_files|count %} {%- if media.attachment_files|count %}
<h3>{% trans %}Attachments{% endtrans %}</h3> <h3>{% trans %}Attachments{% endtrans %}</h3>
<ul> <ul>

View File

@ -16,7 +16,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
#} #}
{%- if request.user %} {%- if request.user %}
<p>
{% set subscription = request.notifications.get_comment_subscription( {% set subscription = request.notifications.get_comment_subscription(
request.user.id, media.id) %} request.user.id, media.id) %}
{% if not subscription or not subscription.notify %} {% if not subscription or not subscription.notify %}
@ -32,5 +31,4 @@
class="button_action">Silence comments class="button_action">Silence comments
</a> </a>
{% endif %} {% endif %}
</p>
{%- endif %} {%- endif %}