[extensions-web] auth: Show your unreviewed extensions on the profile page



commit c39442c0f1876f7851e01eec8062506e70b5d9d3
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Oct 19 13:44:18 2012 -0400

    auth: Show your unreviewed extensions on the profile page

 .../auth/templates/registration/profile.html       |   12 ++++++++++++
 sweettooth/auth/views.py                           |    8 +++++++-
 sweettooth/static/css/sweettooth.css               |    4 ++++
 3 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/sweettooth/auth/templates/registration/profile.html b/sweettooth/auth/templates/registration/profile.html
index e57e6fa..1f5da3a 100644
--- a/sweettooth/auth/templates/registration/profile.html
+++ b/sweettooth/auth/templates/registration/profile.html
@@ -28,5 +28,17 @@
     </li>
     {% endfor %}
   </ul>
+
+  {% for version in pending %}
+  {% with version.extension as extension %}
+  <li class="extension profile">
+    <h4 class="extension-name"><a href="{% url review-version pk=version.pk %}">
+        <img src="{{ extension.icon.url }}" class="icon"> {{ extension.name }} <span class="version">(v{{ version.version }})</span>
+    </a></h4>
+
+    <p class="description">{{ extension.first_line_of_description }}</p>
+  </li>
+  {% endwith %}
+  {% endfor %}
 </div>
 {% endblock %}
diff --git a/sweettooth/auth/views.py b/sweettooth/auth/views.py
index ab7a8bf..741307f 100644
--- a/sweettooth/auth/views.py
+++ b/sweettooth/auth/views.py
@@ -6,7 +6,7 @@ from django.shortcuts import get_object_or_404, redirect
 from django.views.decorators.http import require_POST
 
 from review.models import CodeReview
-from extensions.models import Extension
+from extensions.models import Extension, ExtensionVersion
 
 from decorators import ajax_view
 from utils import render
@@ -19,11 +19,17 @@ def profile(request, user):
     display_name = userobj.get_full_name() or userobj.username
     extensions = Extension.objects.visible().filter(creator=userobj).order_by('name')
 
+    if is_editable:
+        unreviewed = ExtensionVersion.objects.unreviewed().filter(creator=userobj)
+    else:
+        unreviewed = []
+
     return render(request,
                   'registration/profile.html',
                   dict(user=userobj,
                        display_name=display_name,
                        extensions=extensions,
+                       unreviewed=nureviewed,
                        is_editable=is_editable))
 
 @ajax_view
diff --git a/sweettooth/static/css/sweettooth.css b/sweettooth/static/css/sweettooth.css
index 676d715..99c8de2 100644
--- a/sweettooth/static/css/sweettooth.css
+++ b/sweettooth/static/css/sweettooth.css
@@ -957,6 +957,10 @@ li.extension:last-child {
     font-weight: bold;
 }
 
+.version {
+    color: #6a6a6a;
+    font-size: smaller;
+}
 
 /* Error Reports */
 /* ==================================================================== */



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