summaryrefslogtreecommitdiff
path: root/templates/tree.html
blob: f1e45b470b74de337d6cf386ab5afe94a440b63c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
{% extends "base.html" %}
{% block js %}
<script type="text/javascript">
$(function() {
    {% block widgets %}{% endblock %}
   	function _hide_sidebar(first) {
   		if (first) {
   			$('#thesidebar').hide();
   		} else {
   			$('#thesidebar').hide("fast");
   		}
   		$('#theseparator').addClass('ui-icon-arrowthickstop-1-e');
   		$('#theseparator').removeClass('ui-icon-arrowthickstop-1-w');
   		$.cookie('sidebar', 'off', { expires: 30 });
   		return "off";
   	}
   	function _show_sidebar(first) {
   		_refresh_tree();
   		if (first) {
   			$('#thesidebar').show();
   		} else {
   			$('#thesidebar').show("fast");
   		}
   		$('#theseparator').removeClass('ui-icon-arrowthickstop-1-e');
   		$('#theseparator').addClass('ui-icon-arrowthickstop-1-w');
   		$.cookie('sidebar', 'on', { expires: 30 });
   		return "on";
   	}
   	function _load_state() {
   		c = $.cookie('sidebar');
   		_hide_sidebar(true);
	   	if (c == "on") {
	   		_show_sidebar(true);
	   		return "on";
	   	} else {
	   		return "off";
	   	}
	}
	var sidebar = _load_state();
	$('#theseparator').addClass('ui-icon');
	//$('#theseparator').hover(function() {
	//	$(this).addClass('ui-state-hover');
	//},function() {
	//	$(this).removeClass('ui-state-hover');
	//});
   	$('#theseparator').click(function() {
   		if (sidebar == "on") {
   			sidebar = _hide_sidebar();	
	   	} else {
	   		sidebar = _show_sidebar();
	   	}
   	});
   	// must be last to avoid loading the tree if it is invisible
   	function _refresh_tree() {
	   	$('#jstree').jstree({
	   		'json_data': {
	   			'ajax': {
	   				'url': function(n) {
	   					if (n == -1) {
	   						return {% if name %}"/rtree/"+{{name.id}}+".json"{% else %}"/rtree.json"{% endif %};
	   					} else {
	   						return "/ctree/"+n.attr('id')+".json";
	   					}
	   				}
	   			},
	   			"progressive_render"  : true
	   		},
	   		'animation': 0,
	   		'themeroller': {
	   			'item': 'ui-state-none',
	   			'opened': 'ui-icon-circlesmall-minus',
	   			'closed': 'ui-icon-circlesmall-plus'
	   		},
	   		'plugins': ['json_data','themeroller']
	   	});
	   	$('#jstree').removeClass('ui-widget-content');
	}
});
</script>
{% endblock %}
{% block main %}

<ul class="ilist" style="margin-bottom: 80px;">
	<li id="thesidebar">
	   <div id="tree">
	      <ul class="clist">
			{% if name %}
			{% if name.parent %}
			<li>{% if render.up %}<a href="{{name.parent.url}}">{%endif%}{{name.parent.url}}{%if render.up%}</a>{%endif%}</li>
			{% else %}
			<li><a href="/name">{{prefix_url}}</a></li>
			{% endif %}
			{% endif %}
			<li><div style="min-height: 300px;" class="ui-helper-reset" id="jstree"></div></li>
		  </ul>
	   </div>
	   <!-- div id="related">
	   		{% if name and name.links %}
	   		<h3 style="float: left;">Related resources</h3>
	   		{% if render.edit %}
	   		<a style="float: left; margin-top: 11px;" class="tip" title="Add Link" href="/name/{{name.id}}/addlink"><span class="ui-icon ui-icon-plus"></span></a>
	   		{% endif %}
	   		<div class="clear"></div>
	   		<ul class="links"">
	   		{% for link in name.links.all %}
	   		   <li>
	   		      <a class="tip" title="{{link.text}}" href="{{link.url}}">{{link.text}}</a>
	   		      <a class="tip" title="Remove link" href="/link/{{link.id}}/remove"><span class="ui-icon ui-icon-close" style="float: right; clear: both;"></span></a>
	   		   </li>
	   		{% endfor %}
	   		</ul>
	   		<div class="clear"></div>
	   		{% endif %}
	   </div -->
	</li>
	<li id="theseparator">&nbsp;</li>
	<li id="thecontent">
		<div id="headline">
			<a style="text-decoration: none" href="{% if name %}{{name.url}}{% else %}/user/home{% endif %}">{% if name %}{{name.shortname}}{% else %}Dashboard{% endif %}</a>
		</div>
		<div>
	    	{% block content %}{% endblock %}
	    </div>
	</li>
	
</ul>
{% endblock %}