[snowy: 20/26] Show better message when you can't see another user's notes



commit 1f9ec736bd72d9253edf3febd3ff9463c30f58f9
Author: Sandy Armstrong <sanfordarmstrong gmail com>
Date:   Fri May 14 17:24:08 2010 -0700

    Show better message when you can't see another user's notes
    
    https://bugzilla.gnome.org/show_bug.cgi?id=614816

 notes/templates/notes/note_index.html |   11 +++++++++++
 notes/views.py                        |    5 ++++-
 2 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/notes/templates/notes/note_index.html b/notes/templates/notes/note_index.html
index 741121f..bbe35b6 100644
--- a/notes/templates/notes/note_index.html
+++ b/notes/templates/notes/note_index.html
@@ -42,10 +42,21 @@
 <table id="content-layout" cellspacing="0" cellpadding="0">
     <tr>
         <td id="note">
+            {% comment %}
+            Django 1.1 does not support == operator, so we can't do:
+               if author == request.user
+            {% endcomment %}
+            {% if author_is_user %}
             <h1>{% trans "Notice" %}</h1>
             <div id="funcooker">
                 {% trans "You haven't synced any notes with Snowy yet." %}
             </div>
+            {% else %}
+            <h1>{% trans "Notice" %}</h1>
+            <div id="funcooker">
+                {% trans "This user is not sharing any notes with you." %}
+            </div>
+            {% endif %}
         </td>
         <td>
         </td>
diff --git a/notes/views.py b/notes/views.py
index f2f0697..927f930 100644
--- a/notes/views.py
+++ b/notes/views.py
@@ -41,7 +41,10 @@ def note_index(request, username,
     
     # TODO: Instruction page to tell user to either sync or create a new note
     return render_to_response(template_name,
-                              {'author': author},
+                              {'author': author,
+                               # Django 1.1 does not support == operator, so
+                               # we need to do the check here and pass it along
+                               'author_is_user': username==request.user.username},
                               context_instance=RequestContext(request))
 
 def note_list(request, username,



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