[extensions-web: 14/75] Introduce a global "Unreviewed Extensions" box for reviewers.



commit 8c063060a9f608b621417b1806de061b9bad5667
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Sep 13 15:22:24 2011 -0400

    Introduce a global "Unreviewed Extensions" box for reviewers.
    
    In the future, this may be extended to an inbox for users as well.

 sweettooth/review/context_processors.py |    9 +++++++++
 sweettooth/settings.py                  |    4 +++-
 sweettooth/static/css/sweettooth.css    |   13 +++++++++++++
 sweettooth/static/css/template.css      |    4 +---
 sweettooth/templates/base.html          |    7 +++++++
 5 files changed, 33 insertions(+), 4 deletions(-)
---
diff --git a/sweettooth/review/context_processors.py b/sweettooth/review/context_processors.py
new file mode 100644
index 0000000..7b3343c
--- /dev/null
+++ b/sweettooth/review/context_processors.py
@@ -0,0 +1,9 @@
+
+from extensions.models import ExtensionVersion, STATUS_LOCKED
+
+def n_unreviewed_extensions(request):
+    if not request.user.has_perm("review.can-review-extensions"):
+        return dict()
+
+    unreviewed = ExtensionVersion.objects.filter(status=STATUS_LOCKED)
+    return dict(n_unreviewed_extensions=unreviewed.count())
diff --git a/sweettooth/settings.py b/sweettooth/settings.py
index 76d2973..68e5f55 100644
--- a/sweettooth/settings.py
+++ b/sweettooth/settings.py
@@ -121,7 +121,9 @@ TEMPLATE_CONTEXT_PROCESSORS = (
     "django.core.context_processors.media",
     "django.core.context_processors.request",
     "django.core.context_processors.static",
-    "django.contrib.messages.context_processors.messages")
+    "django.contrib.messages.context_processors.messages",
+    "sweettooth.review.context_processors.n_unreviewed_extensions",
+)
 
 LOGIN_URL = '/accounts/login/'
 
diff --git a/sweettooth/static/css/sweettooth.css b/sweettooth/static/css/sweettooth.css
index 25b8533..c616df1 100644
--- a/sweettooth/static/css/sweettooth.css
+++ b/sweettooth/static/css/sweettooth.css
@@ -4,6 +4,19 @@
 @import url("tipsy.css");
 @import url("jquery.rating.css");
 
+/* Unreviewed Extension Counter */
+
+#unreviewed_counter {
+    border-right: 1px solid #ccc;
+    color: #555753;
+    text-decoration: none;
+    padding: 0 4px;
+}
+
+#unreviewed_counter:hover {
+    background-color: #ececec;
+}
+
 /* Login Area */
 /* ==================================================================== */
 
diff --git a/sweettooth/static/css/template.css b/sweettooth/static/css/template.css
index a7736c8..cb72483 100644
--- a/sweettooth/static/css/template.css
+++ b/sweettooth/static/css/template.css
@@ -79,19 +79,17 @@ a:visited {
     padding-left: 18px;
     border-right: 1px solid #ccc;
     padding-right: 6px;
-    margin-right: 3px;
 }
 #global_domain_bar .tab a.root:last-child {
     border-right: 0;
     padding-right: 0;
-    margin-right: 0;
 }
 #global_domain_bar .tab a.root:hover {
     text-decoration: underline;
 }
 #global_domain_bar .tab a.user {
     padding: 2px 14px 2px 4px;
-    margin: -2px -4px -2px -2px;
+    margin: -2px -4px -2px 2px;
     color: inherit !important;
     text-decoration: none;
     -moz-border-radius: 4px;
diff --git a/sweettooth/templates/base.html b/sweettooth/templates/base.html
index 10253ee..c62cbe4 100644
--- a/sweettooth/templates/base.html
+++ b/sweettooth/templates/base.html
@@ -17,12 +17,19 @@ window._SW = function() {
     <div id="global_domain_bar">
       <div class="maxwidth">
         <div class="tab">
+          {% spaceless %}
+
           <a class="root" href="http://www.gnome.org/";>GNOME.org</a>
+          {% if n_unreviewed_extensions %}
+          <a id="unreviewed_counter" href="{% url review-list %}">{{ n_unreviewed_extensions }}</a>
+          {% endif %}
           {% if request.user.is_authenticated %}
           <a class="user" href="#">{{ request.user.username }}</a>
           {% else %}
           <a href="{% url auth-login %}">Login</a>
           {% endif %}
+
+          {% endspaceless %}
         </div>
         <div class="user_settings">
           <ul>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]