aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/templates
diff options
context:
space:
mode:
authortilly-Q <nattilypigeonfowl@gmail.com>2013-08-29 13:47:50 -0400
committertilly-Q <nattilypigeonfowl@gmail.com>2013-08-29 13:47:50 -0400
commitdfd66b789cd6cc9470c2a98bcbda9ee5e0f3ad0f (patch)
tree799396874b47b86da32a8deb613164c034adcd6c /mediagoblin/templates
parente46fb71c1d7067253f30cb7212c676b066a61432 (diff)
downloadmediagoblin-dfd66b789cd6cc9470c2a98bcbda9ee5e0f3ad0f.tar.lz
mediagoblin-dfd66b789cd6cc9470c2a98bcbda9ee5e0f3ad0f.tar.xz
mediagoblin-dfd66b789cd6cc9470c2a98bcbda9ee5e0f3ad0f.zip
This was a big commit! I included lots of documentation below, but generally I
did a few things. I wrote many many many new tests, either in old test files or in the three new test files I made. I also did some code-keeping work, deleting trailing whitespace and deleting vestigial code. Lastly, I fixed the parts of the code which I realized were broken thru the process of running tests. =============================================================================== Deleted trailing whitespace: =============================================================================== --\ mediagoblin/decorators.py --\ mediagoblin/auth/tools.py --\ mediagoblin/db/migrations.py --\ mediagoblin/db/models.py --\ mediagoblin/gmg_commands/users.py --\ mediagoblin/moderation/forms.py --\ mediagoblin/moderation/tools.py --\ mediagoblin/moderation/views.py --\ mediagoblin/templates/mediagoblin/moderation/media_panel.html --\ mediagoblin/templates/mediagoblin/moderation/report.html --\ mediagoblin/templates/mediagoblin/moderation/report_panel.html --\ mediagoblin/templates/mediagoblin/moderation/user.html --\ mediagoblin/templates/mediagoblin/moderation/user_panel.html --\ mediagoblin/templates/mediagoblin/user_pages/report.html --\ mediagoblin/templates/mediagoblin/utils/report.html --\ mediagoblin/user_pages/lib.py --\ mediagoblin/user_pages/views.py =============================================================================== Deleted Vestigial Code =============================================================================== --\ mediagoblin/db/util.py --\ mediagoblin/tests/test_notifications.py =============================================================================== Modified the Code: =============================================================================== --\ mediagoblin/moderation/tools.py --| Encapsulated the code around giving/taking away privileges into two | funtions. --\ mediagoblin/moderation/views.py --| Imported and used the give/take away privilege functions --| Replaced 'require_admin_or_moderator_login' with |'user_has_privilege(u"admin")' for adding/taking away privileges, only | admins are allowed to do this. --\ mediagoblin/templates/mediagoblin/banned.html --| Added relevant translation tags --| Added ability to display indefinite banning --\ mediagoblin/templates/mediagoblin/user_pages/media.html --| Made sure the add comments button was only visible for users with the | `commenter` privilege --\ mediagoblin/tests/test_submission.py --| Paroneayea fixed a DetachedInstanceError I was having with the our_user | function --\ mediagoblin/tests/tools.py --| Added a fixture_add_comment_report function for testing. --\ mediagoblin/tools/response.py --| Fixed a minor error where a necessary return statement was missing --| Fit the code within 80 columns --\ mediagoblin/user_pages/views.py --| Added a necessary decorator to ensure that only users with the 'commenter' | privilege can post comments =============================================================================== Wrote new tests for an old test file: =============================================================================== --\ mediagoblin/tests/test_auth.py --| Added a new test to make sure privilege granting on registration happens | correctly --\ mediagoblin/tests/test_modelmethods.py* --| Added a test to ensure the User method has_privilege works properly =============================================================================== Wrote entirely new files full of tests: =============================================================================== --\ mediagoblin/tests/test_moderation.py --\ mediagoblin/tests/test_privileges.py --\ mediagoblin/tests/test_reporting.py =============================================================================== =============================================================================== NOTE: Any files I've marked with a * in this commit report, were actually subm- itted in my last commit. I made that committ to fix an error I was having, so they weren't properly documented in that report. =============================================================================== ===============================================================================
Diffstat (limited to 'mediagoblin/templates')
-rw-r--r--mediagoblin/templates/mediagoblin/banned.html11
-rw-r--r--mediagoblin/templates/mediagoblin/moderation/media_panel.html4
-rw-r--r--mediagoblin/templates/mediagoblin/moderation/report.html18
-rw-r--r--mediagoblin/templates/mediagoblin/moderation/report_panel.html18
-rw-r--r--mediagoblin/templates/mediagoblin/moderation/user.html4
-rw-r--r--mediagoblin/templates/mediagoblin/moderation/user_panel.html4
-rw-r--r--mediagoblin/templates/mediagoblin/user_pages/media.html2
-rw-r--r--mediagoblin/templates/mediagoblin/user_pages/report.html24
-rw-r--r--mediagoblin/templates/mediagoblin/utils/report.html2
9 files changed, 47 insertions, 40 deletions
diff --git a/mediagoblin/templates/mediagoblin/banned.html b/mediagoblin/templates/mediagoblin/banned.html
index 4eda0540..cd54158a 100644
--- a/mediagoblin/templates/mediagoblin/banned.html
+++ b/mediagoblin/templates/mediagoblin/banned.html
@@ -17,12 +17,19 @@
#}
{% extends "mediagoblin/base.html" %}
-{% block title %}You are Banned.{% endblock %}
+{% block title %}{% trans %}You are Banned.{% endtrans %}{% endblock %}
{% block mediagoblin_content %}
<img class="right_align" src="{{ request.staticdirect('/images/404.png') }}"
alt="{% trans %}Image of goblin stressing out{% endtrans %}" />
- <h1>You have been banned until {{ expiration_date }}</h1>
+
+ <h1>{% trans %}You have been banned{% endtrans %}
+ {% if expiration_date %}
+ {% trans %}until{% endtrans %} {{ expiration_date }}
+ {% else %}
+ {% trans %}indefinitely{% endtrans %}
+ {% endif %}
+ </h2>
<p>{{ reason|safe }}</p>
<div class="clear"></div>
{% endblock %}
diff --git a/mediagoblin/templates/mediagoblin/moderation/media_panel.html b/mediagoblin/templates/mediagoblin/moderation/media_panel.html
index 1c3c866e..d6e02db8 100644
--- a/mediagoblin/templates/mediagoblin/moderation/media_panel.html
+++ b/mediagoblin/templates/mediagoblin/moderation/media_panel.html
@@ -28,7 +28,7 @@
<p>
{% trans %}Here you can track the state of media being processed on this instance.{% endtrans %}
</p>
-
+
<h2>{% trans %}Media in-processing{% endtrans %}</h2>
{% if processing_entries.count() %}
@@ -56,7 +56,7 @@
</table>
{% else %}
<p><em>{% trans %}No media in-processing{% endtrans %}</em></p>
-{% endif %}
+{% endif %}
<h2>{% trans %}These uploads failed to process:{% endtrans %}</h2>
{% if failed_entries.count() %}
diff --git a/mediagoblin/templates/mediagoblin/moderation/report.html b/mediagoblin/templates/mediagoblin/moderation/report.html
index 04788f05..fafa8b8a 100644
--- a/mediagoblin/templates/mediagoblin/moderation/report.html
+++ b/mediagoblin/templates/mediagoblin/moderation/report.html
@@ -27,7 +27,7 @@
title="Return to Reports Panel">
{% trans %}Return to Reports Panel{% endtrans %}</a>
<h2>{% trans %}Report{% endtrans %} #{{ report.id }}</h2>
- {% if report.is_comment_report() or
+ {% if report.is_comment_report() or
(report.is_archived_report() and report.comment) %}
{% trans %}Reported comment{% endtrans %}:
@@ -60,7 +60,7 @@
{% endautoescape %}
</div>
</div>
- {% elif report.is_media_entry_report() or
+ {% elif report.is_media_entry_report() or
(report.is_archived_report() and report.media_entry) %}
{% set media_entry = report.media_entry %}
@@ -89,7 +89,7 @@
'mediagoblin.moderation.users_detail',
user=report.reporter.username),
user_name=report.reported_user.username %}
- CONTENT BY
+ CONTENT BY
<a href="{{ user_url }}"> {{ user_name }}</a>
HAS BEEN DELETED
{% endtrans %}
@@ -100,8 +100,8 @@
class="report_wrapper">
<div class="report_author">
<img src="{{ request.staticdirect(
- '/images/icon_clipboard_alert.png') }}"
- alt="Under a GNU LGPL v.3 or Creative Commons BY-SA 3.0 license.
+ '/images/icon_clipboard_alert.png') }}"
+ alt="Under a GNU LGPL v.3 or Creative Commons BY-SA 3.0 license.
Distributed by the GNOME project http://www.gnome.org" />
<a href="{{ request.urlgen('mediagoblin.moderation.users_detail',
user=report.reporter.username) }}"
@@ -160,7 +160,7 @@ $(document).ready(function() {
$('ul#action_to_resolve li input:not(:checked)').each(function() {
$.each(hidden_input_names[$(this).val()], function(index, name){
$('label[for='+name+']').hide();
- $('#'+name).hide();
+ $('#'+name).hide();
});
});
});
@@ -176,12 +176,12 @@ $(document).ready(function() {
});
</script>
{% elif not (report.reported_user.has_privilege('admin')) %}
- <h2><img src="{{ request.staticdirect('/images/icon_clipboard.png') }}"
+ <h2><img src="{{ request.staticdirect('/images/icon_clipboard.png') }}"
alt="Under a GNU LGPL v.3 or Creative Commons BY-SA 3.0 license.
- Distributed by the GNOME project http://www.gnome.org" />
+ Distributed by the GNOME project http://www.gnome.org" />
{% trans %}Status{% endtrans %}:
</h2>
- <b>{% trans %}RESOLVED{% endtrans %}</b>
+ <b>{% trans %}RESOLVED{% endtrans %}</b>
{{ report.resolved.strftime("%I:%M%p %Y-%m-%d") }}
{% autoescape False %}
<p>{{ report.result }}</p>
diff --git a/mediagoblin/templates/mediagoblin/moderation/report_panel.html b/mediagoblin/templates/mediagoblin/moderation/report_panel.html
index 2818eb80..fb9d8cd9 100644
--- a/mediagoblin/templates/mediagoblin/moderation/report_panel.html
+++ b/mediagoblin/templates/mediagoblin/moderation/report_panel.html
@@ -30,7 +30,7 @@
Here you can look up open reports that have been filed by users.
{% endtrans %}
</p>
-
+
<h2>{% trans %}Active Reports Filed{% endtrans %}</h2>
{% if report_list.count() %}
@@ -46,22 +46,22 @@
<tr>
{% if report.discriminator == "comment_report" %}
<td>
- <img
- src="{{ request.staticdirect('/images/icon_clipboard_alert.png') }}"
+ <img
+ src="{{ request.staticdirect('/images/icon_clipboard_alert.png') }}"
alt="Under a GNU LGPL v.3 or Creative Commons BY-SA 3.0 license.
Distributed by the GNOME project http://www.gnome.org" />
<a href="{{ request.urlgen(
'mediagoblin.moderation.reports_detail',
report_id=report.id) }}">
{% trans report_id=report.id %}
- Comment Report #{{ report_id }}
+ Comment Report #{{ report_id }}
{% endtrans %}
</a>
</td>
{% elif report.discriminator == "media_report" %}
<td>
- <img
- src="{{ request.staticdirect('/images/icon_clipboard_alert.png') }}"
+ <img
+ src="{{ request.staticdirect('/images/icon_clipboard_alert.png') }}"
alt="Under a GNU LGPL v.3 or Creative Commons BY-SA 3.0 license.
Distributed by the GNOME project http://www.gnome.org" />
<a href="{{ request.urlgen(
@@ -97,8 +97,8 @@
{% for report in closed_report_list %}
<tr>
<td>
- <img
- src="{{ request.staticdirect('/images/icon_clipboard.png') }}"
+ <img
+ src="{{ request.staticdirect('/images/icon_clipboard.png') }}"
alt="Under a GNU LGPL v.3 or Creative Commons BY-SA 3.0 license.
Distributed by the GNOME project http://www.gnome.org" />
<a href="{{ request.urlgen('mediagoblin.moderation.reports_detail',
@@ -118,5 +118,5 @@
</table>
{% else %}
<p><em>{% trans %}No closed reports found.{% endtrans %}</em></p>
-{% endif %}
+{% endif %}
{% endblock %}
diff --git a/mediagoblin/templates/mediagoblin/moderation/user.html b/mediagoblin/templates/mediagoblin/moderation/user.html
index ef48fe54..662d48b1 100644
--- a/mediagoblin/templates/mediagoblin/moderation/user.html
+++ b/mediagoblin/templates/mediagoblin/moderation/user.html
@@ -130,9 +130,9 @@
<a class="right_align">{{ user.username }}'s report history</a>
<span class=clear></span>
<h2>{{ user.username }}'s Privileges</h2>
- {% if request.user.has_privilege('admin') and not user_banned and
+ {% if request.user.has_privilege('admin') and not user_banned and
not user.id == request.user.id %}
- <input type=button class="button_action right_align"
+ <input type=button class="button_action right_align"
value="Ban User" />
{% elif request.user.has_privilege('admin') and
not user.id == request.user.id %}
diff --git a/mediagoblin/templates/mediagoblin/moderation/user_panel.html b/mediagoblin/templates/mediagoblin/moderation/user_panel.html
index 6762a844..54ef7c11 100644
--- a/mediagoblin/templates/mediagoblin/moderation/user_panel.html
+++ b/mediagoblin/templates/mediagoblin/moderation/user_panel.html
@@ -30,7 +30,7 @@
Here you can look up users in order to take punitive actions on them.
{% endtrans %}
</p>
-
+
<h2>{% trans %}Active Users{% endtrans %}</h2>
{% if user_list.count() %}
@@ -57,5 +57,5 @@
</table>
{% else %}
<p><em>{% trans %}No users found.{% endtrans %}</em></p>
-{% endif %}
+{% endif %}
{% endblock %}
diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html
index e161afc9..b92cf39c 100644
--- a/mediagoblin/templates/mediagoblin/user_pages/media.html
+++ b/mediagoblin/templates/mediagoblin/user_pages/media.html
@@ -86,7 +86,7 @@
{% autoescape False %}
<p>{{ media.description_html }}</p>
{% endautoescape %}
- {% if comments %}
+ {% if comments and request.user.has_privilege('commenter') %}
{% if app_config['allow_comments'] %}
<a
{% if not request.user %}
diff --git a/mediagoblin/templates/mediagoblin/user_pages/report.html b/mediagoblin/templates/mediagoblin/user_pages/report.html
index cd5e6f59..ce0fb1bc 100644
--- a/mediagoblin/templates/mediagoblin/user_pages/report.html
+++ b/mediagoblin/templates/mediagoblin/user_pages/report.html
@@ -26,15 +26,15 @@
{%- set comment_author_url = request.urlgen(
'mediagoblin.user_pages.user_home',
user=comment_author.username) %}
- {%- set comment_url = request.urlgen(
- 'mediagoblin.user_pages.media_home.view_comment',
- comment=comment.id,
- user=media.get_uploader.username,
+ {%- set comment_url = request.urlgen(
+ 'mediagoblin.user_pages.media_home.view_comment',
+ comment=comment.id,
+ user=media.get_uploader.username,
media=media.slug_or_id) %}
<div id="comment-{{ comment.id }}"
class="comment_wrapper">
<div class="comment_author">
- <img
+ <img
src="{{ request.staticdirect('/images/icon_comment.png') }}" />
<a href="{{ comment_author_url }}"
class="comment_authorlink">
@@ -42,7 +42,7 @@
</a>
<a href="{{ comment_url }}"
class="comment_whenlink">
- <span
+ <span
title='{{- comment.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
{%- trans formatted_time=timesince(comment.created) -%}
@@ -59,19 +59,19 @@
{% elif media is defined %}
<h3>{% trans %}Reporting this Media Entry{% endtrans %}</h3>
<div class="media_thumbnail">
- <a href="{{ request.urlgen('mediagoblin.user_pages.media_home',
- user=media.get_uploader.username,
+ <a href="{{ request.urlgen('mediagoblin.user_pages.media_home',
+ user=media.get_uploader.username,
media=media.slug_or_id) }}">
<img src="{{ media.thumb_url }}"/></a>
- <a href="{{ request.urlgen('mediagoblin.user_pages.media_home',
- user=media.get_uploader.username,
- media=media.slug_or_id) }}"
+ <a href="{{ request.urlgen('mediagoblin.user_pages.media_home',
+ user=media.get_uploader.username,
+ media=media.slug_or_id) }}"
class=thumb_entry_title>{{ media.title }}</a>
</div>
<div class=clear></div>
{%- trans user_url = request.urlgen('mediagoblin.user_pages.user_home', user=media.get_uploader.username),
username = media.get_uploader.username %}
- ❖ Published by <a href="{{ user_url }}"
+ ❖ Published by <a href="{{ user_url }}"
class="comment_authorlink">{{ username }}</a>
{% endtrans %}
{%- endif %}
diff --git a/mediagoblin/templates/mediagoblin/utils/report.html b/mediagoblin/templates/mediagoblin/utils/report.html
index 4108cd82..2fa4f959 100644
--- a/mediagoblin/templates/mediagoblin/utils/report.html
+++ b/mediagoblin/templates/mediagoblin/utils/report.html
@@ -18,7 +18,7 @@
{% block report_content -%}
<p>
- <a
+ <a
{% if not request.user -%}
href="{{ request.urlgen('mediagoblin.auth.login') }}"
{% else %}