diff templates/bundle/bundle.djhtml @ 151:c7be7def8b57

Bundles! (basic functionality) Changes made in this commit: * Added new dependencies (see pip-requirements) * Added new dependency and setup information to README * Deleted the included mptt app (in apps/mptt) in favour of just adding the dependency to pip-requirements (makes it easier to update, etc) * Changed the import convention to use `from apps.bundle.models import Bundle` rather than `from agora.apps.bundle.models import Bundle` because Celery was having problems with the latter style. Everything should still work. * Moved the syntax-highlighting and related code for snippets into separate HTML files so that they can be used by the bundle app And, of course, the ability to upload bundles. But wait! There's more! Changes still to come, for only $19.95 a month: * Bundle versioning * Automatic license integration (i.e. adding headers to files) * The ability to download bundles (zip, tar, etc) * Rating bundles * And much, much more! Batteries not included.
author dellsystem <ilostwaldo@gmail.com>
date Mon, 15 Oct 2012 00:52:00 -0400
parents eb3371142f4f
children 86129d185ddb
line wrap: on
line diff
--- a/templates/bundle/bundle.djhtml	Mon Oct 15 00:27:41 2012 -0400
+++ b/templates/bundle/bundle.djhtml	Mon Oct 15 00:52:00 2012 -0400
@@ -1,33 +1,72 @@
-{% extends "base.djhtml" %}
+{% extends "bundle/base.djhtml" %}
+
+
+{% load mptt_tags %}
+{% load sizefieldtags %}
+
+
+{% block title %}
+{{ bundle.name }} by {{ bundle.uploader }}
+{% endblock title %}
+
 
 {% block content %}
-<div class="info">
-  <h3>
-    {{bundle.name}} by <a href="/{{bundle.uploader}}/">{{bundle.uploader}}</a>
-  </h3>
+<h1>
+<a href="{{ bundle.get_absolute_url }}">{{ bundle.name }}</a>
+by
+<a href="{{ bundle.uploader.get_absolute_url }}">{{ bundle.uploader }}</a>
+</h1>
 
-  {% if files %}
+{% if not bundle.done_uploading %}
+<p class="hint">This bundle is being processed.</p>
+{% else %}
+{% if files %}
+<div id="bundle-filebrowser">
+<ul>
+    {% recursetree files %}
+        <li class="{% if not node.is_leaf_node %}bundle-folder {% endif %}
+        {% if node == file %}selected{% endif %}">
+            {% if node.is_leaf_node %}
+            <a href="{{ node.get_absolute_url }}">{{ node.name }}</a>
+            {% else %}
+            {{ node.name }}
+            {% endif %}
+            {% if not node.is_leaf_node %}
+                <ul>
+                    {{ children }}
+                </ul>
+            {% endif %}
+        </li>
+    {% endrecursetree %}
+</ul>
+</div>
 
-  <div class="whitebox">
+<div id="bundle-file">
+    {% if file %}
+    <h2>{{ file.full_path }} <small>{{ file.file_size|filesize }}</small></h2>
+
+    {% if file.code %}
     <p>
-      files:
+    {% include "snippet/snippet_options.djhtml" %}
     </p>
-    <ul>
-      {% for f in files%}
-      <li><a href="/{{f.bundle_file}}">{{f}}</a></li>
-      {% endfor %}
-    </ul>
-  </div>
-
-  {% else %}
+    {% include "snippet/snippet_box.djhtml" with lines=file.get_lines %}
+    {% else %}
+    <p>This file is a binary file.</p>
+    <p><a href="#">Download file (feature not yet available)</a></p>
+    {% endif %}
+    {% else %}
+    <p><strong>Description:</strong> {{ bundle.description|default:"N/A" }}</p>
+    <p><strong>License:</strong> {{ bundle.free_license }}</p>
+    {% endif %}
+</div>
+{% else %}
+<p>
+    No files in this bundle!
+    {% if request.user == bundle.uploader %}
+    Upload something? (Not yet available)
+    {% endif %}
+</p>
+{% endif %}
+{% endif %}
 
-  <div class="whitebox">
-    <p>
-      No files in this bundle!
-    </p>
-  </div>
-
-  {% endif %}
-
-</div>
 {% endblock %}