changeset 428:77b3b01843b5

Gave the beta private messages a 'compose to' view. Tweaked the color of the tables to match the jquery ui theme.
author Brian Neal <bgneal@gmail.com>
date Sun, 01 May 2011 02:11:48 +0000
parents 85d7b62d5c17
children d0f0800eef0c
files gpp/messages/static/css/messages.css gpp/messages/static/js/tabbed_messages.js gpp/messages/urls.py gpp/messages/views2.py gpp/templates/messages/tabbed_base.html
diffstat 5 files changed, 32 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gpp/messages/static/css/messages.css	Tue Apr 26 02:11:00 2011 +0000
+++ b/gpp/messages/static/css/messages.css	Sun May 01 02:11:48 2011 +0000
@@ -17,7 +17,7 @@
 
 table.messages th {
    color: black;
-   background: #bdd6d6;
+   background: #87b6d9;
    padding: 3px 4px 3px 4px;
    font-weight: bold;
 }
--- a/gpp/messages/static/js/tabbed_messages.js	Tue Apr 26 02:11:00 2011 +0000
+++ b/gpp/messages/static/js/tabbed_messages.js	Sun May 01 02:11:48 2011 +0000
@@ -6,7 +6,12 @@
       },
       load: function(event, ui) {
          selectedTab = ui;
-         if (doReply && ui.index == 1)
+         if (ui.index == 1 && receiver && !doReply)
+         {
+            $('#id_receiver').val(receiver);
+            receiver = '';
+         }
+         else if (doReply && ui.index == 1)
          {
             doReply = false;
             var msg = msgCache[$msgDialog.msgId];
--- a/gpp/messages/urls.py	Tue Apr 26 02:11:00 2011 +0000
+++ b/gpp/messages/urls.py	Sun May 01 02:11:48 2011 +0000
@@ -29,6 +29,9 @@
     url(r'^beta/(inbox|compose|outbox|trash|options)/$',
         'index',
         name='messages-beta_index_named'),
+    url(r'^beta/compose/([\w.@+-]{1,30})/$', 
+        'compose_to', 
+        name='messages-beta_compose_to'),
     url(r'^beta/inbox-tab/$',
         'inbox',
         name='messages-beta_inbox'),
--- a/gpp/messages/views2.py	Tue Apr 26 02:11:00 2011 +0000
+++ b/gpp/messages/views2.py	Sun May 01 02:11:48 2011 +0000
@@ -5,6 +5,7 @@
 import datetime
 
 from django.contrib.auth.decorators import login_required
+from django.contrib.auth.models import User
 from django.contrib import messages
 from django.core.paginator import Paginator, EmptyPage, InvalidPage
 from django.core.urlresolvers import reverse
@@ -52,6 +53,22 @@
         })
 
 
+@login_required
+def compose_to(request, receiver):
+    """
+    This function displays the base tabbed private messages view,
+    and configures it to display the compose PM tab for the given
+    receiver.
+
+    """
+    user = get_object_or_404(User, username=receiver)
+    tab_index = TAB_INDICES['compose']
+    return render(request, 'messages/tabbed_base.html', {
+        'tab': tab_index,
+        'receiver': receiver,
+        })
+
+
 def inbox(request):
     """
     Returns the inbox for the user.
--- a/gpp/templates/messages/tabbed_base.html	Tue Apr 26 02:11:00 2011 +0000
+++ b/gpp/templates/messages/tabbed_base.html	Sun May 01 02:11:48 2011 +0000
@@ -10,6 +10,11 @@
 //<![CDATA[
    var initialTab = {{ tab }};
    var username = "{{ request.user.username }}";
+{% if receiver %}
+   var receiver = "{{ receiver }}";
+{% else %}
+   var receiver = "";
+{% endif %}
 //]]>
 </script>
 <script type="text/javascript" src="{{ STATIC_URL }}js/tabbed_messages.js"></script>