diff templates/code.djhtml @ 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 64f69c85df71
children 2bca07be6e51
line wrap: on
line diff
--- 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>