changeset 32:3c56be2f61fc

Move login/logout buttons to navigation bar, remove cargo-cult CSS
author Jordi Gutiérrez Hermoso <jordigh@gmail.com>
date Thu, 01 Jul 2010 15:00:23 -0500
parents b2fd20d03fb4
children 28a512881850
files static/djangodocs.css templates/base.djhtml templates/user.djhtml templates/whitebox.djhtml
diffstat 4 files changed, 25 insertions(+), 127 deletions(-) [+]
line wrap: on
line diff
--- a/static/djangodocs.css
+++ b/static/djangodocs.css
@@ -102,6 +102,9 @@
 #nav-top {height: 0.85em; background:#F8BF69; width: 100%; position: absolute;}
 #nav-bot {height: 0.85em; background:#FCAF3E; width: 100%; position: absolute;}
 #nav-main{position: relative; z-index: 1; height: 0.85em;}
+#nav-right{position: relative; z-index: 1; height: 0.85em;
+           float :right;
+           color: #6A6354; padding-right: 2em; margin:0;}
 #nav{
     margin: 0; font-size: 12px; text-align: right;
     font-weight: normal; width: 100%;
@@ -129,8 +132,8 @@
 
 #header div.nav { margin-top: -27px; }
 #footer div.nav { margin-bottom: -18px; }
-
-
+#logout-button {
+}
 
 /*** basic styles ***/
 
@@ -156,95 +159,5 @@
 em { font-style: italic; }
 ins { font-weight: bold; text-decoration: none; }
 
-
-/*** lists ***/
-/*
-ul { padding-left:30px; }
-ol { padding-left:30px; }
-ol.arabic li { list-style-type: decimal; }
-ul li { list-style-type:square; margin-bottom:.4em; }
-ol li { margin-bottom: .4em; }
-ul ul { padding-left:1.2em; }
-ul ul ul { padding-left:1em; }
-ul.linklist, ul.toc { padding-left:0; }
-ul.toc ul { margin-left:.6em; }
-ul.toc ul li { list-style-type:square; }
-ul.toc ul ul li { list-style-type:disc; }
-ul.linklist li, ul.toc li { list-style-type:none; }
-dt { font-weight:bold; margin-top:.5em; font-size:1.1em; }
-dd { margin-bottom:.8em; }
-ol.toc { margin-bottom: 2em; }
-ol.toc li { font-size:125%; padding: .5em; line-height:1.2em; clear: right; }
-ol.toc li.b { background-color: #E0FFB8; }
-ol.toc li a:hover { background-color: transparent !important; text-decoration: underline !important; }
-ol.toc span.release-date { color:#487858; float: right; font-size: 85%; padding-right: .5em; }
-ol.toc span.comment-count { font-size: 75%; color: #999; }
-*/
-
-/*** tables ***/
-/*
-table { color:#000; margin-bottom: 1em; width: 100%; }
-table.docutils td p { margin-top:0; margin-bottom:.5em; }
-table.docutils td, table.docutils th { border-bottom:1px solid #dfdfdf; padding:4px 2px;}
-table.docutils thead th { border-bottom:2px solid #dfdfdf; text-align:left; font-weight: bold; white-space: nowrap; }
-table.docutils thead th p { margin: 0; padding: 0; }
-table.docutils { border-collapse:collapse; }
-*/
-
-/*** code blocks ***/
-/*
-.literal { white-space:nowrap; }
-.literal { color:#234f32; }
-#sidebar .literal { color:white; background:transparent; font-size:11px; }
-h4 .literal { color: #234f32; font-size: 13px; }
-pre { font-size:small; background:#E0FFB8; border:1px solid #94da3a; border-width:1px 0; margin: 1em 0; padding: .3em .4em; overflow: hidden; line-height: 1.3em;}
-dt .literal, table .literal { background:none; }
-#bd a.reference { text-decoration: none; }
-#bd a.reference tt.literal { border-bottom: 1px #234f32 dotted; }
-*/
-
-/* Restore colors of pygments hyperlinked code */
-/*
-#bd .highlight .k a:link, #bd .highlight .k a:visited { color: #000000; text-decoration: none; border-bottom: 1px dotted #000000; }
-#bd .highlight .nf a:link, #bd .highlight .nf a:visited { color: #990000; text-decoration: none; border-bottom: 1px dotted #990000; }
-*/
-
-/*** notes & admonitions ***/
-/*
-.note, .admonition { padding:.8em 1em .8em; margin: 1em 0; border:1px solid #94da3a; }
-.admonition-title { font-weight:bold; margin-top:0 !important; margin-bottom:0 !important;}
-.admonition .last { margin-bottom:0 !important; }
-.note, .admonition { padding-left:65px; background:url(docicons-note.png) .8em .8em no-repeat;}
-div.admonition-philosophy { padding-left:65px; background:url(docicons-philosophy.png) .8em .8em no-repeat;}
-div.admonition-behind-the-scenes { padding-left:65px; background:url(docicons-behindscenes.png) .8em .8em no-repeat;}
-*/
-
-/*** versoinadded/changes ***/
-/*
-div.versionadded, div.versionchanged {  }
-div.versionadded span.title, div.versionchanged span.title { font-weight: bold; }
-*/
-
-/*** p-links ***/
-/*
-a.headerlink { color: #c60f0f; font-size: 0.8em; padding: 0 4px 0 4px; text-decoration: none; visibility: hidden; }
-h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, h4:hover > a.headerlink, h5:hover > a.headerlink, h6:hover > a.headerlink, dt:hover > a.headerlink { visibility: visible; }
-*/
-
-/*** index ***/
-/*
-table.indextable td { text-align: left; vertical-align: top;}
-table.indextable dl, table.indextable dd { margin-top: 0; margin-bottom: 0; }
-table.indextable tr.pcap { height: 10px; }
-table.indextable tr.cap { margin-top: 10px; background-color: #f2f2f2;}
-*/
-
-/*e** page-specific overrides ***/
-/*
-div#contents ul { margin-bottom: 0;}
-div#contents ul li { margin-bottom: 0;}
-div#contents ul ul li { margin-top: 0.3em;}
-*/
-
 /*** IE hacks ***/
 * pre { width: 100%; }
--- a/templates/base.djhtml
+++ b/templates/base.djhtml
@@ -38,14 +38,16 @@
       </h1>
       <div id="nav">
         <div id="nav-top"></div>
+        <div id="nav-right">
+          {% block session %}{% endblock %}
+        </div>
         <ul  id="nav-main">
-          <li id="nav-homepage"><a href="/bundles" class="first">Latest</a></li>
-          <li id="nav-snippets"><a href="/about">Snippets</a></li>
+          <li id="nav-bundles"><a href="/bundles" class="first">Latest</a></li>
+          <li id="nav-snippets"><a href="/snippets">Snippets</a></li>
           <li id="nav-discuss"><a href="/discuss">Discussions</a></li>
-          <li id="nav-about"><a href="/news">About</a></li>
-
+          <li id="nav-about"><a href="/about">About</a></li>
         </ul>
-        <div id="nav-bot"></div>
+      <div id="nav-bot"></div>
       </div>
     </div>
     <!-- END Header -->
--- a/templates/user.djhtml
+++ b/templates/user.djhtml
@@ -32,7 +32,7 @@
 {% endif %}
 {% endblock %} {# boxcontents #}
 
-{% block extra-content-related %}
+{% block content-related %}
 {% if bundles or snippets %}
 <div id="info">
   <h3>
@@ -62,4 +62,4 @@
   </div>
 </div>
 {% endif %}
-{% endblock %} {# extra-content-related #}
+{% endblock %} {# content-related #}
--- a/templates/whitebox.djhtml
+++ b/templates/whitebox.djhtml
@@ -11,32 +11,15 @@
 </div>
 {% endblock %}
 
-{% block content-related %}
-<div id="info">
-  <h3>
-    Controls
-  </h3>
-  <div class="whitebox">
-    {% if user.is_authenticated %}
-    <p>
-      You are logged in
-      as <a href="/{{user.username}}">{{user.username}}</a>.
-    </p>
-    <p>
-      (<a href="{% url auth_logout %}">logout</a>)
-    </p>
-    {% else %}
-    <p>
-      <a href="{% url auth_login %}?next={{ request.path }}">Log in</a>
-    </p>
-    {% endif %}
-    <form method="get" action="." >
-      <br/>
-      <input id="search" type="text" name="search" maxlength="200" size="10"/>
-      <input type="submit" value="Search" />
-    </form>
-    
-  </div>
-</div>
-{% block extra-content-related %}{% endblock %}
+{% block session %}
+{% if user.is_authenticated %}
+<form action="{% url auth_logout %}" method="post" id="nav-right">
+  You are logged in
+  as <a href="/{{user.username}}">{{user.username}}</a>.
+  {% csrf_token %}
+  <input type="submit" value="logout" id="logout-button"/>
+</form>
+{% else %}
+<a href="{% url auth_login %}?next={{ request.path }}">Log in</a>
+{% endif %}
 {% endblock %}