changeset 319:93a8358aca79

Job stats on the homepage
author Sylvain Beucler <beuc@beuc.net>
date Wed, 18 Aug 2010 23:54:19 +0200
parents 8d7c891dec61
children 5891fb49de1f
files savane/svmain/views.py templates/svmain/homepage.html
diffstat 2 files changed, 29 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/savane/svmain/views.py
+++ b/savane/svmain/views.py
@@ -83,13 +83,18 @@
                                 .filter(svgroupinfo__type=conf,svgroupinfo__status='A') \
                                 .count(),
                             'conf' : conf})
+
+    import savane.svpeople.models as svpeople_models
+    category_list = svpeople_models.Category.objects.all()
+
     # nb_users and nb_groups as string, because the |add: template
     # filter only accepts strings.
     context = {
         'nb_users' : str(auth_models.User.objects.count()),
         'nb_groups' : str(auth_models.Group.objects.count()),
-        'nb_pending' : str(999), # TODO
+        'nb_pending' : str(666), # TODO
         'group_confs' : group_confs,
+        'category_list' : category_list,
         }
     return context
 
--- a/templates/svmain/homepage.html
+++ b/templates/svmain/homepage.html
@@ -10,24 +10,34 @@
   <div class="box">
     <div class="boxtitle"><a class="sortbutton" href="TODO">
 	{% blocktrans %}{{site_name}} statistics{% endblocktrans %}</a></div>
-    <div class="{% cycle 'boxitemalt' 'boxitem' as rowcolor %}">
-      {% blocktrans count nb_users as count and '<strong>'|add:nb_users|add:'</strong>'|safe as html %}{{html}} registered user{% plural %}{{html}} registered users{% endblocktrans %}
-    </div>
-    <div class="{% cycle rowcolor %}">
-      {% blocktrans count nb_groups as count and '<strong>'|add:nb_groups|add:'</strong>'|safe as html %}{{html}} hosted project{% plural %}{{html}} hosted projects{% endblocktrans %}
-    </div>
-    {% for conf in group_confs %}
-    <div class="{% cycle rowcolor %}">
-      - <a href="{% url savane:svmain:group_list %}?group_configuration=TODO">{{conf.count}} {{conf.conf.name}}</a>
-    </div>
-    {% endfor %}
-    <div class="{% cycle rowcolor %}">+
-      {% blocktrans count nb_pending as count %}{{count}} registration pending{% plural %}{{count}} registrations pending{% endblocktrans %}
+    <div class="smaller">
+      <div class="{% cycle 'boxitemalt' 'boxitem' as rowcolor %}">
+        {% blocktrans count nb_users as count and '<strong>'|add:nb_users|add:'</strong>'|safe as html %}{{html}} registered user{% plural %}{{html}} registered users{% endblocktrans %}
+      </div>
+      <div class="{% cycle rowcolor %}">
+        {% blocktrans count nb_groups as count and '<strong>'|add:nb_groups|add:'</strong>'|safe as html %}{{html}} hosted project{% plural %}{{html}} hosted projects{% endblocktrans %}
+      </div>
+      {% for conf in group_confs %}
+      <div class="{% cycle rowcolor %}">
+        - <a href="{% url savane:svmain:group_list %}#group_configuration=TODO">{{conf.count}} {{conf.conf.name}}</a>
+      </div>
+      {% endfor %}
+      <div class="{% cycle rowcolor %}">+
+        {% blocktrans count nb_pending as count %}{{count}} registration pending{% plural %}{{count}} registrations pending{% endblocktrans %}
+      </div>
     </div>
   </div>
 
   <div class="box">
     <div class="boxtitle">{% trans "Help wanted" %}</div>
+    {% for object in category_list %}
+    <div class="smaller">
+      <div class="{% cycle 'boxitemalt' 'boxitem' %}">
+        - <a href="{% url savane:svpeople:job_list_by_category object.pk %}"
+        >{{object.open_job_set.count}} {% trans object.label %}</a>
+      </div>
+    </div>
+    {% endfor %}
   </div>
 
   <div class="box">