Add a todo view that shows only libraries that have no
authorDiane Trout <diane@caltech.edu>
Tue, 11 Oct 2011 21:44:46 +0000 (14:44 -0700)
committerDiane Trout <diane@caltech.edu>
Tue, 11 Oct 2011 21:44:46 +0000 (14:44 -0700)
lanes.

htsworkflow/frontend/samples/views.py
htsworkflow/frontend/templates/samples/library_index.html
htsworkflow/frontend/urls.py

index 4703cd3ec4d2900b9be62cea224070cd417961ac..e3d15b798a99c19e502f7f59a330eda58d3e9a12 100644 (file)
@@ -89,21 +89,26 @@ def create_library_context(cl):
     cl.result_count = unicode(cl.paginator._count)
     return {'library_list': records }
 
-def library(request):
+def library(request, todo_only=False):
+    queryset = Library.objects.filter(hidden__exact=0)
+    if todo_only:
+        queryset = queryset.filter(lane=None)
     # build changelist
     fcl = ChangeList(request, Library,
         list_filter=['affiliations', 'library_species'],
         search_fields=['id', 'library_name', 'amplified_from_sample__id'],
         list_per_page=200,
-        queryset=Library.objects.filter(hidden__exact=0)
+        queryset=queryset
     )
 
-    context = { 'cl': fcl, 'title': 'Library Index'}
+    context = { 'cl': fcl, 'title': 'Library Index', 'todo_only': todo_only}
     context.update(create_library_context(fcl))
     t = get_template('samples/library_index.html')
     c = RequestContext(request, context)
     return HttpResponse( t.render(c) )
 
+def library_todo(request):
+    return library(request, todo_only=True)
 
 def library_to_flowcells(request, lib_id):
     """
index 024a83dfa1a0c019c533b07883e330dec3b1ed8b..511f7b4291e45853d1d767a879afad1ffe8a3131 100644 (file)
@@ -3,8 +3,8 @@
 {% block extrahead %}
     <!-- App Stuff -->
     <link type="text/css" rel="stylesheet" href="/static/css/app.css" />
-    
-    {% block additional_javascript %}    
+
+    {% block additional_javascript %}
     <script type="text/javascript" src="/static/js/jquery.min.js"></script>
     <script type="text/javascript" src="/static/js/htsw.js"></script>
     <script type="text/javascript">
 {% block coltype %}flex{% endblock %}
 
 {% block content %}
+<div id="library_header_link">
+{% if todo_only %}<a href="..">All</a>{% else %}<a href="todo/">Todo</a>
+{% endif %}
+</div>
 <div id="library-index-div" >
   <div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist">
     {% block search %}{% search_form cl %}{% endblock %}
+
     {% block pagination %}{% pagination cl %}{% endblock %}
 
     {% block filters %}
         <td ><a href="{{lib.library.get_absolute_url}}"><span property="libns:library_id">{{ lib.library_id }}</span></a></td>
         <td ><a href="{{lib.library.library_species.get_absolute_url}}" rel="libns:species"><span property="libns:species_name">{{ lib.species_name }}</span></a></td>
         <td ><a href="{{ lib.library.get_absolute_url }}"><span property="libns:library_name">{{ lib.library_name }}</span></a></td>
-        <td  bgcolor="#00BFFF">{{ lib.lanes_run.0.0 }}</td>      
-        <td  bgcolor="#00BFFF">{{ lib.lanes_run.0.1 }}</td>      
-        <td  bgcolor="#00BFFF">{{ lib.lanes_run.0.2 }}</td>      
+        <td  bgcolor="#00BFFF">{{ lib.lanes_run.0.0 }}</td>
+        <td  bgcolor="#00BFFF">{{ lib.lanes_run.0.1 }}</td>
+        <td  bgcolor="#00BFFF">{{ lib.lanes_run.0.2 }}</td>
         <td  bgcolor="#66CDAA">{{ lib.lanes_run.1.0 }}</td>
-        <td  bgcolor="#66CDAA">{{ lib.lanes_run.1.1 }}</td>      
-        <td  bgcolor="#66CDAA">{{ lib.lanes_run.1.2 }}</td>      
+        <td  bgcolor="#66CDAA">{{ lib.lanes_run.1.1 }}</td>
+        <td  bgcolor="#66CDAA">{{ lib.lanes_run.1.2 }}</td>
         {% if lib.is_archived %}
           <td ><img src="/static/img/hdd_unmount.png" alt="Archived" /></td>
         {% else %}
index ccba072b8395365b64c4e3149a6d29f2e54de77a..e9c0af479358e6b85c8da20dbcd971520b4d5b70 100644 (file)
@@ -38,6 +38,8 @@ urlpatterns = patterns('',
     (r'^reports/', include('htsworkflow.frontend.reports.urls')),
     # Library browser
     (r'^library/$', 'htsworkflow.frontend.samples.views.library'),
+    (r'^library/todo/$',
+      'htsworkflow.frontend.samples.views.library_todo'),
     (r'^library/(?P<lib_id>\w+)/$',
       'htsworkflow.frontend.samples.views.library_to_flowcells'),
     (r'^lanes_for/$', 'htsworkflow.frontend.samples.views.lanes_for'),