[snowy] Add support for breadcrumbs in the note_detail view/template
- From: Jeff Schroeder <jschroeder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [snowy] Add support for breadcrumbs in the note_detail view/template
- Date: Mon, 20 Dec 2010 00:01:40 +0000 (UTC)
commit e9c41542683c5b25d4d4f7c072a805a2e7ee5769
Author: Jeff Schroeder <jeffschroeder computer org>
Date: Sat Dec 18 10:33:13 2010 -0800
Add support for breadcrumbs in the note_detail view/template
notes/templates/notes/note_detail.html | 3 +++
notes/views.py | 13 +++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/notes/templates/notes/note_detail.html b/notes/templates/notes/note_detail.html
index b3cadd1..78fb671 100644
--- a/notes/templates/notes/note_detail.html
+++ b/notes/templates/notes/note_detail.html
@@ -49,6 +49,9 @@
{% endblock %}
{% block content %}
+<div id="note_topbar">
+ <span id="breadcrumb">{% if notebook %} {{ notebook|safe }} » {{ title|safe }}{% endif %}</span>
+</div>
<table id="content-layout" cellspacing="0" cellpadding="0">
<tr>
<td id="note">
diff --git a/notes/views.py b/notes/views.py
index e2d7951..57bc572 100644
--- a/notes/views.py
+++ b/notes/views.py
@@ -17,6 +17,7 @@
from django.http import HttpResponseRedirect, HttpResponseForbidden, Http404
from django.shortcuts import render_to_response, get_object_or_404
+from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.core.paginator import Paginator
from django.contrib.auth.models import User
@@ -67,8 +68,16 @@ def note_detail(request, username, note_id, slug='',
body = note_to_html(note, author)
+ try:
+ # Get the notebook name, if any
+ notebook = note.tags.get(is_notebook=True)
+ if notebook:
+ notebook = notebook.get_name_for_display()
+ except ObjectDoesNotExist:
+ notebook = []
+
return render_to_response(template_name,
- {'title': note.title,
- 'note': note, 'body': body,
+ {'title': note.title, 'note': note,
+ 'notebook': notebook, 'body': body,
'request': request, 'author': author},
context_instance=RequestContext(request))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]