diff mbox

[Branch,~linaro-validation/lava-server/trunk] Rev 361: add ajax_table.html to lava-server from lava-scheduler (Chris Johnston)

Message ID 20120422232212.14767.40471.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Michael-Doyle Hudson April 22, 2012, 11:22 p.m. UTC
Merge authors:
  Chris Johnston (chrisjohnston)
Related merge proposals:
  https://code.launchpad.net/~chrisjohnston/lava-server/move-ajax-table-html/+merge/102929
  proposed by: Chris Johnston (chrisjohnston)
  review: Approve - Zygmunt Krynicki (zkrynicki)
------------------------------------------------------------
revno: 361 [merge]
committer: Michael Hudson-Doyle <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Mon 2012-04-23 11:20:22 +1200
message:
  add ajax_table.html to lava-server from lava-scheduler (Chris Johnston)
added:
  lava_server/templates/ajax_table.html
modified:
  lava/utils/data_tables/tables.py


--
lp:lava-server
https://code.launchpad.net/~linaro-validation/lava-server/trunk

You are subscribed to branch lp:lava-server.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-server/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava/utils/data_tables/tables.py'
--- lava/utils/data_tables/tables.py	2012-03-08 00:11:20 +0000
+++ lava/utils/data_tables/tables.py	2012-04-20 19:58:36 +0000
@@ -123,7 +123,7 @@ 
             method.
         """
         if template is None:
-            template = 'lava_scheduler_app/ajax_table.html'
+            template = 'ajax_table.html'
         # The reason we pass data=[] here and patch the queryset in below is
         # because of a bootstrapping issue.  We want to sort the initial
         # queryset, and this is much cleaner if the table has has its .columns

=== added file 'lava_server/templates/ajax_table.html'
--- lava_server/templates/ajax_table.html	1970-01-01 00:00:00 +0000
+++ lava_server/templates/ajax_table.html	2012-04-20 19:58:36 +0000
@@ -0,0 +1,25 @@ 
+{% extends "django_tables2/table.html" %}
+
+{% block table.thead %}
+<thead>
+  <tr>
+    {% for column in table.columns %}
+    <th {{ column.attrs.th.as_html }}>{{ column.header }}</th>
+    {% endfor %}
+  </tr>
+</thead>
+{% endblock table.thead %}
+
+{% block table %}
+{{ block.super }}
+{% comment %}
+The div below is a ridiculous hack to avoid the jQuery.details.js
+setting the display: of the script element to "block" when showing a
+table that is in a <details> element.
+{% endcomment %}
+<div>
+<script type="text/javascript">
+$("#{{ table.attrs.id }}").dataTable({{ table.datatable_options|safe }});
+</script>
+</div>
+{% endblock %}