changeset 106:17bc502c65a4

Update "code" page Changed layout and added real data for the snippets list.
author dellsystem <ilostwaldo@gmail.com>
date Tue, 11 Sep 2012 18:06:01 -0400
parents 2602f54c018d
children 2bca07be6e51
files static/css/mixins.less templates/code.djhtml urls.py
diffstat 3 files changed, 67 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/static/css/mixins.less	Tue Sep 11 17:59:27 2012 -0400
+++ b/static/css/mixins.less	Tue Sep 11 18:06:01 2012 -0400
@@ -71,7 +71,7 @@
 }
 
 .pill {
-    .inline-block;
+    display: block;
     background: @lighterGrey;
     border: 1px solid lighten(@mediumGrey, 10%);
     .border-radius(3px);
@@ -81,6 +81,8 @@
     line-height: 1;
     text-shadow: 0 1px 0 @white;
     .box-shadow(inset 0 0 3px 0px @white);
+    margin-bottom: 10px;
+    .center-align;
 
     &:hover {
         color: @white;
--- a/templates/code.djhtml	Tue Sep 11 17:59:27 2012 -0400
+++ b/templates/code.djhtml	Tue Sep 11 18:06:01 2012 -0400
@@ -4,42 +4,82 @@
 
 <h1>Browse code submissions</h1>
 
-<a class="pill" href="{% url snippet_new %}">Post a snippet</a>
-{% if user.is_authenticated %}
-<a class="pill" href="">Upload a single</a>
-<a class="pill" href="">Upload a bundle</a>
-{% else %}
-<a class="pill" href="{% url auth_login %}">Login to upload singles/bundles</a>
+{% if not user.is_authenticated %}
+<p class="hint">
+    Welcome to Agora.
+</p>
 {% endif %}
 
-<br />
-<br />
-
 <div class="row">
     <div class="span3">
-        <h2 class="center-align"><a href="{% url snippet_explore %}">Snippets</a></h2>
+        <h2 class="center-align">Snippets</h2>
+        <a class="pill" href="{% url snippet_new %}">
+            Post a snippet
+        </a>
+        {% if snippets %}
         <ul>
-            <li>test</li>
-            <li>test</li>
-            <li>test</li>
-            <li>test</li>
+            {% for snippet in snippets %}
+            <li>
+                <a href="{{ snippet.get_absolute_url }}">
+                    <strong>{{ snippet.get_title }}</strong>
+                </a>
+                by
+                {% if snippet.author %}
+                <a href="{{ snippet.author.get_absolute_url }}">
+                    {{ snippet.author }}
+                </a>
+                {% else %}
+                anonymous
+                {% endif %}
+                <br />
+                {{ snippet.published }}
+            </li>
+            {% endfor %}
         </ul>
+        <p class="right-float">
+            <a href="{% url snippet_explore %}">View more &raquo;</a>
+        </p>
+        {% else %}
+        <p>No one has yet created a snippet.
+            <a href="{% url new_snippet %}">Be the first!</a>
+        </p>
+        {% endif %}
     </div><div class="span3">
         <h2 class="center-align">Modules</h2>
+        {% if user.is_authenticated %}
+        <a class="pill" href="">Upload a modules</a>
+        {% else %}
+        <a class="pill" href="{% url auth_login %}">
+            Login to upload modules
+        </a>
+        {% endif %}
+        {% if modules %}
         <ul>
-            <li>test</li>
-            <li>test</li>
-            <li>test</li>
-            <li>test</li>
+            {% for module in modules %}
+            <li>{{ module }}</li>
+            {% endfor %}
         </ul>
+        {% else %}
+        <p>This feature is not yet available.</p>
+        {% endif %}
     </div><div class="span3">
         <h2 class="center-align">Forge</h2>
+        {% if user.is_authenticated %}
+        <a class="pill" href="">Add a module to the forge</a>
+        {% else %}
+        <a class="pill" href="{% url auth_login %}">
+            Login to add a module to the forge
+        </a>
+        {% endif %}
+        {% if forge %}
         <ul>
-            <li>test</li>
-            <li>test</li>
-            <li>test</li>
-            <li>test</li>
+            {% for forge_module in forge %}
+            <li>{{ forge_module }}</li>
+            {% endfor %}
         </ul>
+        {% else %}
+        <p>This feature is not yet available.</p>
+        {% endif %}
     </div>
 </div>
 
--- a/urls.py	Tue Sep 11 17:59:27 2012 -0400
+++ b/urls.py	Tue Sep 11 18:06:01 2012 -0400
@@ -1,4 +1,5 @@
 from django.conf.urls.defaults import *
+from django.views.generic import ListView
 
 # Uncomment the next two lines to enable the admin:
 from django.contrib import admin
@@ -22,8 +23,7 @@
         {'template': 'discuss.djhtml'},
         name='discuss'),
     url(r'^code$',
-        'django.views.generic.simple.direct_to_template',
-        {'template': 'code.djhtml'},
+        'views.code',
         name='code'),
     url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
     url(r'^admin/', include(admin.site.urls)),