Add a bread crumb to the send started email page.
authorDiane Trout <diane@caltech.edu>
Tue, 6 Oct 2009 19:45:33 +0000 (19:45 +0000)
committerDiane Trout <diane@caltech.edu>
Tue, 6 Oct 2009 19:45:33 +0000 (19:45 +0000)
I modified the base template to re-include the default place for
a bread crumb, and added a bit of test code to make sure the bread crumb
is actually present.

htsworkflow/frontend/experiments/fixtures/test_flowcells.json
htsworkflow/frontend/experiments/models.py
htsworkflow/frontend/experiments/tests.py
htsworkflow/frontend/experiments/views.py
htsworkflow/frontend/templates/base.html
htsworkflow/frontend/templates/experiments/email_preview.html

index b744e2bed8146898e1affd0c7fe898d2b7cd81bc..698813fdf7de4d07522e9c7fba23feee95bc2b3b 100644 (file)
        "date_joined": "2009-01-01 00:01:01"
        }
    },
+  {"pk": 7, "model": "auth.user", 
+   "fields": {
+       "username": "supertest",
+       "first_name": "",
+       "last_name": "",
+       "is_active": true,
+       "is_superuser": true,
+       "is_staff": true,
+       "last_login": "2009-01-01 00:00:01",
+       "groups": [],
+       "user_permissions": [],
+       "password": "sha1$foo$5e4eefec1144a04becfb7da79244f07c487fc345",
+       "email": "",
+       "date_joined": "2009-01-01 00:01:01"
+       }
+   },
  {"pk": 1, "model": "experiments.clusterstation", "fields": {"name": "old"}}, 
  {"pk": 2, "model": "experiments.clusterstation", "fields": {"name": "loaner"}}, 
  {"pk": 3, "model": "experiments.clusterstation", "fields": {"name": "new"}}, 
index eafe06a080e7f45d55ac6a827a480be1a24b1fb6..7fdf3f1e97a96d26522cc66b23e43cdf3a716136 100755 (executable)
@@ -74,6 +74,11 @@ class FlowCell(models.Model):
 
   class Meta:
     ordering = ["-run_date"]
+
+  def get_admin_url(self):
+    # that's the django way... except it didn't work
+    #return urlresolvers.reverse('admin_experiments_FlowCell_change', args=(self.id,))
+    return '/admin/experiments/flowcell/%s/' % (self.id,)
   
 ### -----------------------
 class DataRun(models.Model):
index 8ad953481006ead7f63c8cc0e46e44d512d3597a..f9b7527696362953b2f448a0fb067f631854714e 100644 (file)
@@ -1,3 +1,4 @@
+import re
 try:
     import json
 except ImportError, e:
@@ -124,3 +125,15 @@ class TestEmailNotify(TestCase):
         self.failUnlessEqual(len(mail.outbox), 4)
         for m in mail.outbox:
             self.failUnless(len(m.body) > 0)
+
+    def test_email_navigation(self):
+        """
+        Can we navigate between the flowcell and email forms properly?
+        """
+        self.client.login(username='supertest', password='BJOKL5kAj6aFZ6A5') 
+        response = self.client.get('/experiments/started/153/')
+        self.failUnlessEqual(response.status_code, 200)
+        self.failUnless(re.search('Flowcell 303TUAAXX', response.content))
+        # require that navigation back to the admin page exists
+        self.failUnless(re.search('<a href="/admin/experiments/flowcell/153/">[^<]+</a>', response.content))
+        
index 3505a3bf594e7cfbd0b50afce09f6374e504280d..e03c038e48f7f2e197a20ef73494670bcf717076 100755 (executable)
@@ -90,7 +90,7 @@ def startedEmail(request, pk):
                   })
 
         # build view
-        subject = "Flowcell  %s" % ( fc.flowcell_id )
+        subject = "Flowcell %s" % ( fc.flowcell_id )
         body = email_template.render(context)
 
         if send:
@@ -102,11 +102,13 @@ def startedEmail(request, pk):
         emails.append((user_email, subject, body, sending))
 
     verify_context = Context({
-        'send': send,
-        'warnings': warnings,
         'emails': emails,
+        'flowcell': fc,
         'from': sender,
+        'send': send,
         'site_managers': settings.MANAGERS,
+        'title': fc.flowcell_id,
+        'warnings': warnings,
         })
     return HttpResponse(email_verify.render(verify_context))
     
index b88d67945f09edd2f3e5710b331f8ef9d69cf045..7f64055b1ed09d36623b01d6dad937b21a045a9e 100644 (file)
@@ -1,8 +1,7 @@
 {% load i18n %}
 
 <!-- Container -->
-    <!--
-    {% if not is_popup %}
+   {% if not is_popup %}
     
     <div id="header">
         <div id="branding">
@@ -17,8 +16,7 @@
     
     {% block breadcrumbs %}<div class="breadcrumbs"><a href="/">{% trans 'Home' %}</a>{% if title %} &rsaquo; {{ title }}{% endif %}</div>{% endblock %}
     {% endif %}
-    -->
-        {% if messages %}
+       {% if messages %}
         <ul  class="djangocss" class="messagelist">{% for message in messages %}<li>{{ message }}</li>{% endfor %}</ul>
         {% endif %}
 
index cef7d0651aefa687e89217c674c1989feaef1d20..9c35c6d1b2e1ee030083e53910dc686bd760f4f6 100644 (file)
@@ -1,13 +1,24 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html> <head>
-<title></title>
-</head>
-<body>
+{% extends "base.html" %}
+{% load i18n %}
+
+{% block breadcrumbs %}
+<div class="breadcrumbs">
+  <a href="/admin">{% trans 'Home' %}</a> &rsaquo;
+  <a href="/admin/experiments">Experiments</a> &rsaquo;
+  <a href="/admin/experiments/flowcell">flowcell</a> &rsaquo;
+  <a href="{{ flowcell.get_admin_url }}">{{ flowcell.flowcell_id }}</a>
+</div>  
+{% endblock %}
+
+{% block content %}
+{% if warnings %}
+<hr/>
 <p>
 {% for user_admin_url, username in warnings %}
 Warning: User <a href="{{ user_admin_url}}">{{ username }}</a> has no
 email address <br/>
 {% endfor %}
+{% endif %}
 </p>
 {% for to, subject, body, sending in emails %}
 <hr/>
@@ -24,5 +35,4 @@ email address <br/>
 <input type="checkbox" id="bcc" name="bcc" checked="on"/><br/>
 <input type="hidden" name="send" value="1"/>
 <input type="submit" value="Send Email"/>
-</body>
-</html>
+{% endblock %}
\ No newline at end of file