forked from adamfeuer/d3js-tree-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
118 lines (116 loc) · 4.98 KB
/
index.html
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
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="css/foundation.css" />
<link rel="stylesheet" href="css/d3-context-menu.css" />
<link rel="stylesheet" href="css/toastr.css" />
<link rel="stylesheet" href="css/app.css" />
</head>
<body>
<div class="row">
<div class="large-10 columns">
<ul class="button-group radius even-3">
<li><a href="#" class="button small radius success" onclick="save_tree()">Save tree</a></li>
<li><a href="/tree/file" class="button small radius info">Download JSON tree file</a></li>
<li><a href="#" class="button small radius info" data-reveal-id="UploadFileModal">Upload JSON tree file</a></li>
</ul>
</div>
<div class="large-2 columns">
</div>
</div>
<div id="tree-container"></div>
<div id="RenameNodeModal" class="reveal-modal" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
<h2 id="modalTitle">Rename Node</h2>
<form>
<div class="row">
<div class="large-12 columns">
<label>Node name
<input type="text" class="inputName" id='RenameNodeName' placeholder="node name" />
</label>
</div>
</div>
<div class="row">
<div class="large-8 columns">
</div>
<div class="large-4 columns">
<a href="#" class="button info" onclick="close_modal()">Cancel</a>
<a href="#" class="button success" onclick="rename_node()">Rename</a>
</div>
</div>
</form>
<a class="close-reveal-modal" aria-label="Close">×</a>
</div>
<div id="CreateNodeModal" class="reveal-modal" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
<h2 id="modalTitle">Create Node</h2>
<form>
<div class="row">
<div class="large-12 columns">
<label>Node name
<input type="text" class="inputName" id='CreateNodeName' placeholder="node name" />
</label>
</div>
</div>
<div class="row">
<div class="large-8 columns">
</div>
<div class="large-4 columns">
<a href="#" class="button info" onclick="close_modal()">Cancel</a>
<a href="#" class="button success" onclick="create_node()">Create</a>
</div>
</div>
</form>
<a class="close-reveal-modal" aria-label="Close">×</a>
</div>
<div id="UploadFileModal" class="reveal-modal" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
<h2 id="modalTitle">Upload JSON tree file</h2>
<form action="/tree/file" method="post" enctype="multipart/form-data">
<div class="row">
<div class="large-12 columns">
<label>JSON tree file
<input type="file" name="flare.json" accept="application/json">
</label>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<a href="#" class="button info" onclick="close_modal()">Cancel</a>
<input type="submit" class="button success" value="Upload file">
</div>
</div>
</form>
<a class="close-reveal-modal" aria-label="Close">×</a>
</div>
<script src="js/vendor/underscore-min.js"></script>
<script src="js/vendor/fastclick.js"></script>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="js/vendor/jquery.js"></script>
<script src="js/foundation.min.js"></script>
<script src="js/dndTree.js"></script>
<script src="js/vendor/toastr.js"></script>
<script src="js/vendor/d3-context-menu.js"></script>
<script>
$(document).foundation();
$(document).on('opened', '[data-reveal]', function () {
var element = $(".inputName:visible").first();
element.focus(function(){
this.selectionStart = this.selectionEnd = this.value.length;
});
element.focus();
});
$('#RenameNodeName').keyup(function(e){
if(e.keyCode == 13)
{
rename_node();
}
});
$('#CreateNodeName').keyup(function(e){
if(e.keyCode == 13)
{
create_node();
}
});
</script>
</body>
</html>