Current work on simplifying the inventory tracking page. simplify_inventory
authorDiane Trout <diane@caltech.edu>
Mon, 3 Jan 2011 20:52:30 +0000 (12:52 -0800)
committerDiane Trout <diane@caltech.edu>
Mon, 3 Jan 2011 20:52:30 +0000 (12:52 -0800)
Its still a work in progress and I need to implement the compontents to
browse inventory items by category.

In addition, somehow I need to re-integrate the component
that prints labels for archived runfolders on disk.

htsworkflow/frontend/inventory/models.py
htsworkflow/frontend/inventory/urls.py
htsworkflow/frontend/inventory/views.py
htsworkflow/frontend/static/css/changelists.css
htsworkflow/frontend/templates/inventory/inventory_category.html [new file with mode: 0644]
htsworkflow/frontend/templates/inventory/inventory_index.html

index dfeb7dbd63e4d0dae43b933cd4d55c164586d35a..06b1bfe52099658df8da3f0a292c42d9317d2da1 100644 (file)
@@ -103,6 +103,9 @@ class ItemType(models.Model):
     def __unicode__(self):
         return u"%s" % (self.name)
 
+    class Meta:
+        ordering = ('name',)
+
 class ItemStatus(models.Model):
     name = models.CharField(max_length=64, unique=True)
     notes = models.TextField(blank=True, null=True)
index 49ede616e44a0ecce7f25ca5a4242cb4d9e48589..44f64874a63e4f56fb06e23dc1df4aa0632894d4 100644 (file)
@@ -7,8 +7,8 @@ urlpatterns = patterns('',
      (r'^lts/link/(?P<flowcell>.+)/(?P<serial>.+)/$', 'htsworkflow.frontend.inventory.views.link_flowcell_and_device'),
      
     # INDEX
-    (r'^(?P<uuid>[a-fA-F0-9]{32})/$', 'htsworkflow.frontend.inventory.views.item_summary_by_uuid'),
-    (r'^(?P<uuid>[a-fA-F0-9]{32})/print/$', 'htsworkflow.frontend.inventory.views.item_print'),
-    (r'^(?P<barcode_id>.+)/$', 'htsworkflow.frontend.inventory.views.item_summary_by_barcode'),
-    (r'^$', 'htsworkflow.frontend.inventory.views.index')
+    #(r'^(?P<uuid>[a-fA-F0-9]{32})/$', 'htsworkflow.frontend.inventory.views.item_summary_by_uuid'),
+    #(r'^(?P<uuid>[a-fA-F0-9]{32})/print/$', 'htsworkflow.frontend.inventory.views.item_print'),
+    #(r'^(?P<barcode_id>.+)/$', 'htsworkflow.frontend.inventory.views.item_summary_by_barcode'),
+    (r'^$', 'htsworkflow.frontend.inventory.views.category_index')
     )
index dfb92a96ba8c41007b562f9cca750c6a8cd9a1b5..388745fda33c332a8509d26b670cf5e89d33511a 100644 (file)
@@ -133,6 +133,29 @@ def data_items(request):
     
     return HttpResponse(json.dumps(d), content_type="application/javascript")
 
+@login_required
+def category_index(request):
+    """
+    List various object types
+    """
+    # build changelist
+    item_changelist = ChangeList(request, ItemType,
+        list_filter=[],                 
+        search_fields=[],
+        list_per_page=200,
+        queryset=ItemType.objects.all()
+    )
+
+    context_dict = {
+        'item_changelist': item_changelist,
+        'page_name': 'Inventory Objects'
+    }
+    context_dict.update(INVENTORY_CONTEXT_DEFAULTS)
+    
+    return render_to_response('inventory/inventory_category.html',
+                              context_dict,
+                              context_instance=RequestContext(request))
+
 @login_required
 def index(request):
     """
index cf0f2439ef6bb25ad39c4c0e8f17fff76d9b0f11..c483686a702e7a130266162b1f19790a3b874492 100644 (file)
@@ -3,7 +3,7 @@
 /* CHANGELISTS */
 #changelist {  margin-bottom: 0pm; }
 #changelist table { display: block; }
-#changelist table.filtered { margin-right: 21em; overflow-y: scroll; }
+#changelist table.filtered { margin-right: 21em; overflow-y: scroll; width: auto;}
 .change-list .filtered table { border-right:1px solid #ddd;  }
 .change-list .filtered { min-height:400px; }
 .change-list .filtered { background:white url(../img/changelist-bg.gif) top right repeat-y !important; }
diff --git a/htsworkflow/frontend/templates/inventory/inventory_category.html b/htsworkflow/frontend/templates/inventory/inventory_category.html
new file mode 100644 (file)
index 0000000..88f0a33
--- /dev/null
@@ -0,0 +1,39 @@
+{% extends "base_site.html" %}
+{% load adminmedia admin_list i18n %}
+{% block bodyclass %}change-list{% endblock %}
+{% block coltype %}flex{% endblock %}
+{% block content %}
+<div id="inventory-index-div" >
+  <div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist">
+    {% block search %}{% search_form item_changelist %}{% endblock %}
+    {% block pagination %}{% pagination item_changelist %}{% endblock %}
+
+    {% block filters %}
+    {% if item_changelist.has_filters %}
+    <div id="changelist-filter">
+      <h2 >{% trans 'Filter' %}</h2>
+      {% for spec in item_changelist.filter_specs %}
+         {% admin_list_filter cl spec %}
+         {% endfor %}
+       </div>
+    {% endif %}
+    {% endblock %}
+  {% block summary_stats %}
+  <table class="{% if cl.has_filters %} filtered{% endif %}">
+    <thead >
+      <tr >
+        <td >Object Type</td>
+      </tr>
+    </thead>
+    <tbody >
+      {% for item in item_changelist.get_query_set %}
+      <tr >
+        <td >{{ item.name }}</td>
+      </tr>
+      {% endfor %}
+    </tbody>
+  </table>
+  {% endblock %}
+</div>
+{% endblock %}
index 399dae1c6940ac4abf21bfad5fa7a2e749188f9e..f920345d91fc4c19d9e20b2d41dee83646e9b840 100644 (file)
@@ -1,19 +1,5 @@
 {% extends "base_site.html" %}
 {% load adminmedia admin_list i18n %}
-{% block extrahead %}
-    <script type="text/javascript">
-      $(document).ready(function() {
-        $(window).resize(function() {
-           var window_height = $(window).height();
-           var position = $("#changelist table").position();
-           height = window_height - position.top;
-           $("#changelist table.filtered").height(height);
-           $("#changelist-filter").height(height);
-        });
-        $(window).resize();
-      });
-    </script>
-{% endblock %}
 {% block bodyclass %}change-list{% endblock %}
 {% block coltype %}flex{% endblock %}
 {% block content %}