mirror of
https://github.com/jazzband/django-categories.git
synced 2026-03-16 22:30:24 +00:00
Make the initial state of the editor tree an app setting with collapsed as the default.
This commit is contained in:
parent
e8b7aeca8f
commit
858a356e42
3 changed files with 4 additions and 2 deletions
|
|
@ -7,3 +7,5 @@ STATIC_URL = getattr(settings, 'STATIC_URL', settings.MEDIA_URL)
|
|||
if STATIC_URL == None:
|
||||
STATIC_URL = settings.MEDIA_URL
|
||||
MEDIA_PATH = getattr(settings, 'EDITOR_MEDIA_PATH', '%seditor/' % STATIC_URL)
|
||||
|
||||
TREE_INITIAL_STATE = getattr(settings, 'EDITOR_TREE_INITIAL_STATE', 'collapsed')
|
||||
|
|
@ -5,8 +5,7 @@
|
|||
<script type="text/javascript">
|
||||
(function($) {
|
||||
$(document).ready(function() {
|
||||
//treeTable = $("#result_list").treeTable({initialState : "expanded"});
|
||||
treeTable = $("#result_list").treeTable({initialState : "collapsed"});
|
||||
treeTable = $("#result_list").treeTable({initialState : "{{ EDITOR_TREE_INITIAL_STATE }}"});
|
||||
function toggleChildren() {
|
||||
this.checked = event.currentTarget.checked;
|
||||
var row = this.parentNode.parentNode.parentNode;
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ class TreeEditor(admin.ModelAdmin):
|
|||
"""
|
||||
extra_context = extra_context or {}
|
||||
extra_context['EDITOR_MEDIA_PATH'] = settings.MEDIA_PATH
|
||||
extra_context['EDITOR_TREE_INITIAL_STATE'] = settings.TREE_INITIAL_STATE
|
||||
extra_context['tree_structure'] = mark_safe(simplejson.dumps(
|
||||
_build_tree_structure(self.model)))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue