From 0b1fcaebf5954bc1cc672145b1411b499ebb1bf7 Mon Sep 17 00:00:00 2001 From: tilly-Q Date: Tue, 8 Oct 2013 18:42:59 -0400 Subject: [PATCH] This was a quick update to clean up some of my templates and fix the formatting in some of my other bits of code. In migrations.py, I clarified the comments & fixed the code to stay within 80 columns. In each of the templates, I fixed the spacing as well to stay within 80 columns and I also corrected my improper uses of the trans tag to ensure that these pages can be translated correctly. --- mediagoblin/db/migrations.py | 14 +++++---- mediagoblin/templates/mediagoblin/banned.html | 2 +- mediagoblin/templates/mediagoblin/base.html | 4 ++- .../mediagoblin/moderation/report.html | 21 ++++++++----- .../mediagoblin/moderation/report_panel.html | 6 ++-- .../mediagoblin/moderation/user.html | 30 +++++++++++++------ 6 files changed, 52 insertions(+), 25 deletions(-) diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py index 7011d842..6616b657 100644 --- a/mediagoblin/db/migrations.py +++ b/mediagoblin/db/migrations.py @@ -607,24 +607,28 @@ def create_moderation_tables(db): ] # Give each user the appopriate privileges depending whether they are an - # admin, an active user or an inactivated user ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # admin, an active user or an inactive user ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ for admin_user in admin_users_ids: admin_user_id = admin_user['id'] - for privilege_id in [admin_privilege_id, uploader_privilege_id, reporter_privilege_id, commenter_privilege_id, active_privilege_id]: + for privilege_id in [admin_privilege_id, uploader_privilege_id, + reporter_privilege_id, commenter_privilege_id, + active_privilege_id]: db.execute(user_privilege_assoc.insert().values( core__privilege_id=admin_user_id, core__user_id=privilege_id)) for active_user in active_users_ids: active_user_id = active_user['id'] - for privilege_id in [uploader_privilege_id, reporter_privilege_id, commenter_privilege_id, active_privilege_id]: + for privilege_id in [uploader_privilege_id, reporter_privilege_id, + commenter_privilege_id, active_privilege_id]: db.execute(user_privilege_assoc.insert().values( core__privilege_id=active_user_id, core__user_id=privilege_id)) for inactive_user in inactive_users_ids: inactive_user_id = inactive_user['id'] - for privilege_id in [uploader_privilege_id, reporter_privilege_id, commenter_privilege_id]: + for privilege_id in [uploader_privilege_id, reporter_privilege_id, + commenter_privilege_id]: db.execute(user_privilege_assoc.insert().values( core__privilege_id=inactive_user_id, core__user_id=privilege_id)) @@ -660,7 +664,7 @@ def create_moderation_tables(db): db.commit() new_user_table.rename("core__users") else: - # If the db is not SQLite, this process is much simpler ~~~~~~~~~~~~~~~ + # If the db is not run using SQLite, this process is much simpler ~~~~~ status = user_table.columns['status'] email_verified = user_table.columns['email_verified'] diff --git a/mediagoblin/templates/mediagoblin/banned.html b/mediagoblin/templates/mediagoblin/banned.html index cd54158a..0b5a6884 100644 --- a/mediagoblin/templates/mediagoblin/banned.html +++ b/mediagoblin/templates/mediagoblin/banned.html @@ -25,7 +25,7 @@

{% trans %}You have been banned{% endtrans %} {% if expiration_date %} - {% trans %}until{% endtrans %} {{ expiration_date }} + {% trans until_when=expiration_date %}until {{ until_when }}{% endtrans %} {% else %} {% trans %}indefinitely{% endtrans %} {% endif %} diff --git a/mediagoblin/templates/mediagoblin/base.html b/mediagoblin/templates/mediagoblin/base.html index 94ca7aa5..6394fa4f 100644 --- a/mediagoblin/templates/mediagoblin/base.html +++ b/mediagoblin/templates/mediagoblin/base.html @@ -62,7 +62,9 @@ {% block mediagoblin_header_title %}{% endblock %}
{%- if request.user %} - {% if request.user and request.user.has_privilege('active') and not request.user.is_banned() %} + {% if request.user and + request.user.has_privilege('active') and + not request.user.is_banned() %} {% set notification_count = get_notification_count(request.user.id) %} {% if notification_count %} diff --git a/mediagoblin/templates/mediagoblin/moderation/report.html b/mediagoblin/templates/mediagoblin/moderation/report.html index cb717cde..b05992b7 100644 --- a/mediagoblin/templates/mediagoblin/moderation/report.html +++ b/mediagoblin/templates/mediagoblin/moderation/report.html @@ -18,12 +18,13 @@ {%- extends "mediagoblin/base.html" %} {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %} {%- block mediagoblin_head %} - + {% endblock %} {%- block mediagoblin_content %} {% if not report %} - Sorry, no such report found. + {% trans %}Sorry, no such report found.{% endtrans %} {% else %}
- {% if not report.is_archived_report() and not (report.reported_user.has_privilege('admin') and not request.user.has_privilege('admin')) %} - + {% if not report.is_archived_report() and + not (report.reported_user.has_privilege('admin') and + not request.user.has_privilege('admin')) %} +
{{ wtforms_util.render_divs(form) }} {{ csrf_token }} - +
+ {% endblock %} {% block mediagoblin_content -%} @@ -58,9 +59,11 @@

{%- trans username=user.username %}{{ username }}'s profile{% endtrans -%} {% if user_banned and user_banned.expiration_date %} - — BANNED until {{ user_banned.expiration_date }} + — {% trans expiration_date=user_banned.expiration_date %} + BANNED until {{ expiration_date }} + {% endtrans %} {% elif user_banned %} - — Banned Indefinitely + — {% trans %}Banned Indefinitely{% endtrans %} {% endif %}

{% if not user.url and not user.bio %} @@ -90,7 +93,11 @@ {% endif %} {% if user %} -

{%- trans %}Active Reports on {% endtrans -%}{{ user.username }}

+

+ {%- trans username=user.username %} + Active Reports on {{ username }} + {% endtrans -%} +

{% if reports.count() %} @@ -104,7 +111,9 @@ - {%- trans %}Report #{% endtrans -%}{{ report.id }} + {%- trans report_number=report.id %} + Report #{{ report_number }} + {% endtrans -%}
@@ -122,7 +131,9 @@
{% else %} - {%- trans %}No active reports filed on {% endtrans -%} {{ user.username }} + {%- trans + username=user.username %}No active reports filed on {{ username }} + {% endtrans -%} {% endif %} {%- trans - username=user.username %}All reports that {{ username }} has filed{% endtrans %} + username=user.username %}All reports that {{ username }} has filed + {% endtrans %}

{{ user.username }}'s Privileges

@@ -166,9 +178,9 @@ {{ privilege.privilege_name }} {% if privilege in user.all_privileges %} - Yes{% else %} + {% trans %}Yes{% endtrans %}{% else %} - No{% endif %} + {% trans %}No{% endtrans %}{% endif %} {% if request.user.has_privilege('admin') %} -- 2.25.1