This was a quick update to clean up some of my templates and fix the formatting
authortilly-Q <nattilypigeonfowl@gmail.com>
Tue, 8 Oct 2013 22:42:59 +0000 (18:42 -0400)
committertilly-Q <nattilypigeonfowl@gmail.com>
Tue, 8 Oct 2013 22:42:59 +0000 (18:42 -0400)
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
mediagoblin/templates/mediagoblin/banned.html
mediagoblin/templates/mediagoblin/base.html
mediagoblin/templates/mediagoblin/moderation/report.html
mediagoblin/templates/mediagoblin/moderation/report_panel.html
mediagoblin/templates/mediagoblin/moderation/user.html

index 7011d842b28f961b05796b10e3d1f15d12fef1c8..6616b65724d8dc96774bd57f2ccb35856df0bcec 100644 (file)
@@ -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']
index cd54158ada531f4d06cff9dd88969dff5b8a2021..0b5a6884f6aeb3ecdfe6c3322a2f55295bc3bc2d 100644 (file)
@@ -25,7 +25,7 @@
 
   <h1>{% 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 %}
index 94ca7aa54f6d53afd46267208e90f8ba264f3284..6394fa4f384221a3f120edf395c791c34c44ebff 100644 (file)
@@ -62,7 +62,9 @@
           {% block mediagoblin_header_title %}{% endblock %}
           <div class="header_right">
             {%- 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 %}
index cb717cde94c8b1bfde0823aae70851dda8cbfe22..b05992b73783e2d18c7fdda6e75882347ac8ab5e 100644 (file)
 {%- extends "mediagoblin/base.html" %}
 {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
 {%- block mediagoblin_head %}
- <script src="{{ request.staticdirect('/js/setup_report_forms.js') }}"></script>
+ <script src="{{ request.staticdirect('/js/setup_report_forms.js') }}">
+ </script>
 {% endblock %}
 
 {%- block mediagoblin_content %}
 {% if not report %}
-  Sorry, no such report found.
+  {% trans %}Sorry, no such report found.{% endtrans %}
 {% else %}
     <a href="{{ request.urlgen('mediagoblin.moderation.reports') }}"
        class="return_to_panel button_action"
       {{ report.report_content }}
     </div>
   </div>
-  {% if not report.is_archived_report() and not (report.reported_user.has_privilege('admin') and not request.user.has_privilege('admin')) %}
-    <input type=button value=Resolve id=open_resolution_form />
+  {% if not report.is_archived_report() and 
+        not (report.reported_user.has_privilege('admin') and 
+        not request.user.has_privilege('admin')) %}
+    <input type=button value="{% trans %}Resolve{% endtrans %}" id=open_resolution_form />
     <form action="" method="POST" id=resolution_form>
       {{ wtforms_util.render_divs(form) }}
       {{ csrf_token }}
-      <input type=submit id="submit_this_report" value="Resolve This Report"/>
+      <input type=submit id="submit_this_report" value="{% trans %}Resolve This Report{% endtrans %}"/>
     </form>
   <script>
   $(document).ready(function() {
       <p>{{ report.result }}</p>
     </pre>
   {% else %}
-    <input type=button disabled=disabled value="Resolve This Report"/>
-    <p>You cannot take action against an administrator</p>
+    <input type=button disabled=disabled value="{% trans %}Resolve This Report{% endtrans %}"/>
+    <p>
+      {% trans %}
+        You cannot take action against an administrator
+      {% endtrans %}
+    </p>
   {% endif %}
 {% endif %}
 {% endblock %}
index 4eb16b2ba90d55f6e3a913382ed1a9ce4ad8da0a..95b6be80f7b08739464228f22def5e450efde4e4 100644 (file)
@@ -84,7 +84,8 @@ curr_page !=p %}
         {% if report.discriminator == "comment_report" %}
           <td>
             <img
-              src="{{ request.staticdirect('/images/icon_clipboard_alert.png') }}"
+              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(
@@ -98,7 +99,8 @@ curr_page !=p %}
         {% elif report.discriminator == "media_report" %}
           <td>
             <img
-              src="{{ request.staticdirect('/images/icon_clipboard_alert.png') }}"
+              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(
index 36ba42acf9e174e506b90d4587211fa47f91b2a1..103324b227cf94f721c8d5d47e5108dabe7a5a8b 100644 (file)
@@ -29,7 +29,8 @@
 {% endblock %}
 
 {%- block mediagoblin_head %}
- <script src="{{ request.staticdirect('/js/setup_report_forms.js') }}"></script>
+ <script src="{{ request.staticdirect('/js/setup_report_forms.js') }}">
+ </script>
 {% endblock %}
 
 {% block mediagoblin_content -%}
     <h1>
       {%- trans username=user.username %}{{ username }}'s profile{% endtrans -%}
     {% if user_banned and user_banned.expiration_date %}
-      &mdash; BANNED until {{ user_banned.expiration_date }}
+      &mdash; {% trans expiration_date=user_banned.expiration_date %}
+        BANNED until {{ expiration_date }}
+      {% endtrans %}
     {% elif user_banned %}
-      &mdash; Banned Indefinitely
+      &mdash; {% trans %}Banned Indefinitely{% endtrans %}
     {% endif %}
     </h1>
     {% if not user.url and not user.bio %}
     </div>
   {% endif %}
   {% if user %}
-    <h2>{%- trans %}Active Reports on {% endtrans -%}{{ user.username }}</h2>
+    <h2>
+      {%- trans username=user.username %}
+        Active Reports on {{ username }}
+      {% endtrans -%}
+    </h2>
     {% if reports.count() %}
     <table class="admin_side_panel">
       <tr>
             <img src="{{ request.staticdirect('/images/icon_clipboard.png') }}" />
             <a href="{{ request.urlgen('mediagoblin.moderation.reports_detail',
                                                report_id=report.id) }}">
-              {%- trans %}Report #{% endtrans -%}{{ report.id }}
+              {%- trans report_number=report.id %}
+                Report #{{ report_number }}
+              {% endtrans -%}
             </a>
           </td>
           <td>
         <tr><td></td><td></td>
     </table>
     {% else %}
-      {%- trans %}No active reports filed on {% endtrans -%} {{ user.username }}
+      {%- trans 
+        username=user.username %}No active reports filed on {{ username }}
+      {% endtrans -%}
     {% endif %}
     <span class="right_align">
         <a href="{{ request.urlgen(
         <a href="{{ request.urlgen(
                 'mediagoblin.moderation.reports') }}?reporter={{user.id}}">
         {%- trans
-            username=user.username %}All reports that {{ username }} has filed{% endtrans %}</a>
+            username=user.username %}All reports that {{ username }} has filed
+        {% endtrans %}</a>
     </span>
     <span class=clear></span>
     <h2>{{ user.username }}'s Privileges</h2>
             <td>{{ privilege.privilege_name }}</td>
             {% if privilege in user.all_privileges  %}
               <td class="user_with_privilege">
-                Yes{% else %}
+                {% trans %}Yes{% endtrans %}{% else %}
               <td class="user_without_privilege">
-                No{% endif %}
+                {% trans %}No{% endtrans %}{% endif %}
             </td>
             {% if request.user.has_privilege('admin') %}
               <td>