Author: jacob
Date: 2008-08-22 15:08:26 -0500 (Fri, 22 Aug 2008)
New Revision: 8470

Added:
   djangoproject.com/djangodocs/templates/docs/index.html
Modified:
   djangoproject.com/djangodocs/templates/docs/doc.html
   djangoproject.com/djangodocs/views.py
Log:
[djangoproject.com] Added new docs index views.

Modified: djangoproject.com/djangodocs/templates/docs/doc.html
===================================================================
--- djangoproject.com/djangodocs/templates/docs/doc.html        2008-08-22 
19:27:26 UTC (rev 8469)
+++ djangoproject.com/djangodocs/templates/docs/doc.html        2008-08-22 
20:08:26 UTC (rev 8470)
@@ -49,6 +49,7 @@
         {% if doc.next %}
           <li>Next: <a href="{{ doc.next.link }}">{{ doc.next.title }}</a></li>
         {% endif %}
+        <li><a href="{{ home }}contents/">Table of contents</a></li>
         {% for doc, title, accesskey, shorttitle in env.rellinks %}
           <li><a href="{{ home }}{{ doc }}/">{{ title }}</a></li>
         {% endfor %}

Added: djangoproject.com/djangodocs/templates/docs/index.html
===================================================================
--- djangoproject.com/djangodocs/templates/docs/index.html                      
        (rev 0)
+++ djangoproject.com/djangodocs/templates/docs/index.html      2008-08-22 
20:08:26 UTC (rev 8470)
@@ -0,0 +1,31 @@
+{% extends "docs/doc.html" %}
+
+{% block extrahead %}
+  {{ block.super }}
+  <style type="text/css" media="screen">
+    
+    p.rubric { font-size:150%; font-weight:normal; margin-bottom:.2em; 
color:#487858; }
+    div.section dt { font-weight: normal; }
+    
+    #s-getting-help { float: right; width: 40%; background: #E1ECE2; padding: 
1em; margin: 2em 0 2em 2em; }
+    #s-getting-help h2 { margin: 0; }
+    
+    #s-django-documentation div.section div.section h3 { margin: 0; }
+    #s-django-documentation div.section div.section { background: #E1ECE2; 
padding: 1em; margin: 2em 0 2em 57%; }
+    #s-django-documentation div.section div.section a.reference { white-space: 
nowrap; }
+    
+    #s-using-django dl,
+    #s-add-on-contrib-applications dl,
+    #s-solving-specific-problems dl,
+    #s-reference dl
+        { float: left; width: 57%; }
+
+    #s-add-on-contrib-applications,
+    #s-solving-specific-problems,
+    #s-reference,
+    #s-and-all-the-rest
+        { clear: left; }
+  </style>
+{% endblock %}
+
+{% block toc-wrapper %}{% endblock %}
\ No newline at end of file

Modified: djangoproject.com/djangodocs/views.py
===================================================================
--- djangoproject.com/djangodocs/views.py       2008-08-22 19:27:26 UTC (rev 
8469)
+++ djangoproject.com/djangodocs/views.py       2008-08-22 20:08:26 UTC (rev 
8470)
@@ -31,18 +31,20 @@
     docroot = Path(settings.DOCS_PICKLE_ROOT)
 
     # First look for <bits>/index.fpickle, then for <bits>.fpickle
-    bits = url.strip('/').split('/')
-    doc = docroot.child(*(bits+['index.fpickle']))
+    bits = url.strip('/').split('/') + ['index.fpickle']
+    doc = docroot.child(*bits)
     if not doc.exists():
-        doc = docroot.child(*bits[:-1] + ["%s.fpickle" % bits[-1]])
+        bits = bits[:-2] + ['%s.fpickle' % bits[-2]]
+        doc = docroot.child(*bits)
         if not doc.exists():
             raise Http404("'%s' does not exist" % doc)
-    
-    # Build up a list of templates to search for so that if the page is
-    # "ref/models", the list will be ["docs/ref/models.html", "docs/ref.html"]
+
     bits[-1] = bits[-1].replace('.fpickle', '')
-    templates = ["docs/%s.html" % "/".join(bits[:-i+1]) for i in 
range(len(bits))]    
-    return render_to_response(templates + ['docs/doc.html'], {
+    template_names = [
+        'docs/%s.html' % '-'.join([b for b in bits if b]), 
+        'docs/doc.html'
+    ]
+    return render_to_response(template_names, {
         'doc': pickle.load(open(doc)),
         'env': pickle.load(open(docroot.child('globalcontext.pickle'))),
         'update_date': 
datetime.datetime.fromtimestamp(docroot.child('last_build').mtime()),


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to