[snowy] Add notes list to note_detail, and theme it up



commit ead9acc2ee94d828b8bab280dfb9be7eb2cedf3e
Author: Brad Taylor <brad getcoded net>
Date:   Tue May 19 15:21:25 2009 -0400

    Add notes list to note_detail, and theme it up
---
 notes/templates/notes/note_detail.html |   23 ++++++++++
 notes/views.py                         |   13 +++++-
 settings.py                            |    3 +
 site_media/css/screen.css              |   73 +++++++++++++++++++++++++++++---
 site_media/img/note-new_16.png         |  Bin 0 -> 566 bytes
 site_media/img/note_16.png             |  Bin 0 -> 454 bytes
 site_media/img/notebook-new_16.png     |  Bin 0 -> 690 bytes
 site_media/img/notebook_16.png         |  Bin 0 -> 535 bytes
 site_media/img/pin-active_16.png       |  Bin 0 -> 386 bytes
 site_media/img/pin-down_16.png         |  Bin 0 -> 486 bytes
 site_media/img/pin-up_16.png           |  Bin 0 -> 408 bytes
 11 files changed, 105 insertions(+), 7 deletions(-)

diff --git a/notes/templates/notes/note_detail.html b/notes/templates/notes/note_detail.html
index 1991030..6aade11 100644
--- a/notes/templates/notes/note_detail.html
+++ b/notes/templates/notes/note_detail.html
@@ -1,5 +1,7 @@
 {% extends 'notes/base.html' %}
 
+{% load i18n %}
+
 {% block extra_head %}
     <script type="text/javascript" src="{{ MEDIA_URL }}js/DUI.js" charset="utf-8"></script>
     <script type="text/javascript" src="{{ MEDIA_URL }}js/funcooker.js" charset="utf-8"></script>
@@ -10,6 +12,27 @@
 
 {% block sidebar %}
 {{ block.super }}
+<div id="sidebar-note-list">
+    <ul>
+{% for n in all_notes %}
+        <li class="note-item"><a href="{{ n.get_absolute_url }}">{{ n.title }}</a></li>
+{% endfor %}
+        <li class="more-item"><a href="#">{% trans "More Notes..." %}</a></li>
+    </ul>
+    <hr />
+    <ul>
+        <li id="new-note"><a href="#">New Note...</a></li>
+    </ul>
+</div>
+<div id="sidebar-notebook-list">
+    <h3>{% trans "Notebooks" %}</h3>
+    <ul>
+{% for n in all_notebooks %}
+        <li class="notebook-item"><a href="#">{{ n.get_name_for_display }}</a></li>
+{% endfor %}
+        <li class="more-item"><a href="#">{% trans "More Notebooks..." %}</a></li>
+    </ul>
+</div>
 {% endblock %}
 
 {% block content %}
diff --git a/notes/views.py b/notes/views.py
index 2b642a5..190005a 100644
--- a/notes/views.py
+++ b/notes/views.py
@@ -22,6 +22,7 @@ from django.shortcuts import render_to_response, get_object_or_404
 
 from snowy.notes.templates import CONTENT_TEMPLATES, DEFAULT_CONTENT_TEMPLATE
 from snowy.notes.models import *
+from snowy import settings
 
 def note_index(request, username,
                template_name='note/note_index.html'):
@@ -67,6 +68,16 @@ def note_detail(request, username, note_id, slug='',
         if doc != None: doc.freeDoc()
         if result != None: result.freeDoc()
 
+    # TODO: pinned notes
+    all_notes = Note.objects.filter(author=user) \
+                            .order_by('-user_modified')
+    if request.user != user:
+        all_notes = all_notes.filter(permissions=1) # Public
+
+    all_notes = all_notes[:settings.SNOWY_LIST_MAX_NOTES]
+    all_notebooks = NoteTag.objects.filter(author=user, is_notebook=True)[:5]
     return render_to_response(template_name,
-                              {'note': note, 'body': body },
+                              {'note': note, 'body': body,
+                               'all_notes': all_notes,
+                               'all_notebooks': all_notebooks},
                               context_instance=RequestContext(request))
diff --git a/settings.py b/settings.py
index 9afbaf7..ef7ec1e 100644
--- a/settings.py
+++ b/settings.py
@@ -104,6 +104,9 @@ INSTALLED_APPS = (
     'notes',
 )
 
+# Maximum number of notes to show on the notes_detail list.
+SNOWY_LIST_MAX_NOTES = 18
+
 ACCOUNT_ACTIVATION_DAYS = 30
 
 AUTH_PROFILE_MODULE = 'notes.UserProfile'
diff --git a/site_media/css/screen.css b/site_media/css/screen.css
index 3b47682..08c7c3b 100644
--- a/site_media/css/screen.css
+++ b/site_media/css/screen.css
@@ -60,10 +60,9 @@ table#container {
     border: 0;
 }
 
-#sidebar-container {
+td#sidebar-container {
     width: 20%;
     min-width: 250px;
-    max-width: 500px;
     
     margin: 0;
     vertical-align: top;
@@ -71,8 +70,11 @@ table#container {
 
 #sidebar {
     margin-top: 20px;
+    padding-bottom: 20px;
+
     background-color: #403b33;
     font-family: Trebuchet MS, Calibri, Verdana, Arial, sans-serif;
+    font-size: 1.05em;
 }
 
 #sidebar h3 {
@@ -105,17 +107,76 @@ table#container {
     color: #000000;
 }
 
-#sidebar #notebooks {
+#sidebar hr {
+    height: 1px;
+    margin: 0.6em 0;
+    background-color: #aba49e;
+    border: 0;
+}
+
+#sidebar ul {
+    margin: 0;
+    padding: 0;
+}
+
+#sidebar li {
+    margin: 0 0 0.5em 0;
+    padding: 0;
+    position: relative;
+    left: 24px;
+}
+
+#sidebar li a {
+    position: relative;
+    top: -0.2em;
+
+    color: #ffffff;
+    text-decoration: none;
+}
+
+#sidebar .more-item {
+    list-style-type: none; 
+}
+
+#sidebar .more-item a {
+    text-decoration: underline;
+}
+
+#sidebar-note-list, #sidebar-notebook-list {
+    margin: 7px 0 0 0;
+    padding: 3px 14px;
+}
+
+#sidebar-note-list .note-item {
+    list-style-image: url('/site_media/img/note_16.png'); 
+}
+
+#sidebar-note-list #new-note {
+    list-style-image: url('/site_media/img/note-new_16.png'); 
+}
+
+#sidebar-note-list .more-item a {
+    color: #8c8985;
+}
+
+#sidebar-notebook-list {
+    margin: 0;
     background-color: #8ecbd2;
     color: #ffffff;
 }
 
-#sidebar #notebooks h3 {
+#sidebar-notebook-list h3 {
+    margin: 0.3em 0;
+    font-size: 1.0em;
     color: #578186;
 }
 
-#sidebar #notebooks .more {
-    color: #b8dee3;
+#sidebar-notebook-list .notebook-item {
+    list-style-image: url('/site_media/img/notebook_16.png'); 
+}
+
+#sidebar-notebook-list .more-item a {
+    color: #bbe0e4;
 }
 
 #content {
diff --git a/site_media/img/note-new_16.png b/site_media/img/note-new_16.png
new file mode 100644
index 0000000..17cb028
Binary files /dev/null and b/site_media/img/note-new_16.png differ
diff --git a/site_media/img/note_16.png b/site_media/img/note_16.png
new file mode 100644
index 0000000..2dbb154
Binary files /dev/null and b/site_media/img/note_16.png differ
diff --git a/site_media/img/notebook-new_16.png b/site_media/img/notebook-new_16.png
new file mode 100644
index 0000000..a3bd014
Binary files /dev/null and b/site_media/img/notebook-new_16.png differ
diff --git a/site_media/img/notebook_16.png b/site_media/img/notebook_16.png
new file mode 100644
index 0000000..6782685
Binary files /dev/null and b/site_media/img/notebook_16.png differ
diff --git a/site_media/img/pin-active_16.png b/site_media/img/pin-active_16.png
new file mode 100644
index 0000000..bf56fa3
Binary files /dev/null and b/site_media/img/pin-active_16.png differ
diff --git a/site_media/img/pin-down_16.png b/site_media/img/pin-down_16.png
new file mode 100644
index 0000000..133391f
Binary files /dev/null and b/site_media/img/pin-down_16.png differ
diff --git a/site_media/img/pin-up_16.png b/site_media/img/pin-up_16.png
new file mode 100644
index 0000000..9d78dc9
Binary files /dev/null and b/site_media/img/pin-up_16.png differ



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]