diff --git a/categories/editor/static/editor/jquery.treeTable.css b/categories/editor/static/editor/jquery.treeTable.css index f9fccd9..9d9a263 100644 --- a/categories/editor/static/editor/jquery.treeTable.css +++ b/categories/editor/static/editor/jquery.treeTable.css @@ -14,6 +14,10 @@ zoom: 1; /* IE7 Hack */ } + +.treeTable td.action-checkbox, .treeTable th.action-checkbox-column { + padding-left: 20px; +} .treeTable tr.collapsed td .expander { background-image: url(toggle-expand-dark.png); } diff --git a/categories/editor/templates/admin/editor/tree_editor.html b/categories/editor/templates/admin/editor/tree_editor.html index dc1fa02..34da30e 100644 --- a/categories/editor/templates/admin/editor/tree_editor.html +++ b/categories/editor/templates/admin/editor/tree_editor.html @@ -1,39 +1,38 @@ {% extends "admin/change_list.html" %} {% load adminmedia admin_list i18n admin_tree_list %} {% block extrahead %} - {{block.super}} - + treeTable = $("#result_list").treeTable({initialState : "{{ EDITOR_TREE_INITIAL_STATE }}"}); + else + treeTable = $("#result_list").treeTable({initialState : "expanded"}); + function toggleChildren(index, value) { + var row = value.parentNode.parentNode; + if (row.className.match(/child-of-node-\d+/)) { + value.checked = /child-of-node-(\d+)/.exec(row.className); + } + if($(row).hasClass("parent")) { + $("table.treeTable tbody tr.child-of-" + row.id + " input").each(toggleChildren); + } + $("tr input.action-select").actions(); + }; + $('.action-select').each( + function(){ + $(this).bind('click', function(event){ + // Get the tr from checkbox -> td -> tr + var row = event.currentTarget.parentNode.parentNode; + $("table.treeTable tbody tr.child-of-" + row.id + " input").each(toggleChildren); + }); + }); + }); + })(django.jQuery); + {% endblock %} {% block result_list %} - {% if action_form and actions_on_top and cl.full_result_count %}{% admin_actions %}{% endif %} {% result_tree_list cl %} {% if action_form and actions_on_bottom and cl.full_result_count %}{% admin_actions %}{% endif %} {% endblock %} diff --git a/categories/editor/templates/admin/editor/tree_list_results.html b/categories/editor/templates/admin/editor/tree_list_results.html index 703bf45..379471e 100644 --- a/categories/editor/templates/admin/editor/tree_list_results.html +++ b/categories/editor/templates/admin/editor/tree_list_results.html @@ -1,24 +1,28 @@ {% if result_hidden_fields %} -
{# DIV for HTML validation #} -{% for item in result_hidden_fields %}{{ item }}{% endfor %} -
+
{# DIV for HTML validation #} + {% for item in result_hidden_fields %}{{ item }}{% endfor %} +
{% endif %} + {% if results %} -
- - - -{% for header in result_headers %} -{% if header.sortable %}{% endif %} -{{ header.text|capfirst }} -{% if header.sortable %}{% endif %}{% endfor %} - - - -{% for result in results %} -{% for item in result %}{{ item }}{% endfor %} -{% endfor %} - -
+
+ + + + {% for header in result_headers %} + + {% endfor %} + + + + {% for result in results %} + {% for item in result %}{{ item }}{% endfor %} + {% endfor %} + +
+ {% if header.sortable %}{% endif %} + {{ header.text|capfirst }} + {% if header.sortable %}{% endif %} +
-{% endif %} +{% endif %} \ No newline at end of file