forked from dbushell/Nestable
-
Notifications
You must be signed in to change notification settings - Fork 21
/
index.html
157 lines (142 loc) · 6.72 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Nestable++</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">
<link href="style.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container" style="background-color: #eee; height: 100vh;">
<h1 class="text-center">Nestable++</h1>
<div class="row">
<div class="col-md-6">
<h3>Menu</h3>
<div class="dd nestable">
<ol class="dd-list">
<!--- Initial Menu Items --->
<!--- Item1 --->
<li class="dd-item" data-id="1" data-name="Item 1" data-slug="item-slug-1" data-new="0" data-deleted="0">
<div class="dd-handle">Item 1</div>
<span class="button-delete btn btn-default btn-xs pull-right"
data-owner-id="1">
<i class="fa fa-times-circle-o" aria-hidden="true"></i>
</span>
<span class="button-edit btn btn-default btn-xs pull-right"
data-owner-id="1">
<i class="fa fa-pencil" aria-hidden="true"></i>
</span>
</li>
<!--- Item2 --->
<li class="dd-item" data-id="2" data-name="Item 2" data-slug="item-slug-2" data-new="0" data-deleted="0">
<div class="dd-handle">Item 2</div>
<span class="button-delete btn btn-default btn-xs pull-right"
data-owner-id="2">
<i class="fa fa-times-circle-o" aria-hidden="true"></i>
</span>
<span class="button-edit btn btn-default btn-xs pull-right"
data-owner-id="2">
<i class="fa fa-pencil" aria-hidden="true"></i>
</span>
</li>
<!--- Item3 --->
<li class="dd-item" data-id="3" data-name="Item 3" data-slug="item-slug-3" data-new="0" data-deleted="0">
<div class="dd-handle">Item 3</div>
<span class="button-delete btn btn-default btn-xs pull-right"
data-owner-id="3">
<i class="fa fa-times-circle-o" aria-hidden="true"></i>
</span>
<span class="button-edit btn btn-default btn-xs pull-right"
data-owner-id="3">
<i class="fa fa-pencil" aria-hidden="true"></i>
</span>
<!--- Item3 children --->
<ol class="dd-list">
<!--- Item4 --->
<li class="dd-item" data-id="4" data-name="Item 4" data-slug="item-slug-4" data-new="0" data-deleted="0">
<div class="dd-handle">Item 4</div>
<span class="button-delete btn btn-default btn-xs pull-right"
data-owner-id="4">
<i class="fa fa-times-circle-o" aria-hidden="true"></i>
</span>
<span class="button-edit btn btn-default btn-xs pull-right"
data-owner-id="4">
<i class="fa fa-pencil" aria-hidden="true"></i>
</span>
</li>
<!--- Item5 --->
<li class="dd-item" data-id="5" data-name="Item 5" data-slug="item-slug-5" data-new="0" data-deleted="0">
<div class="dd-handle">Item 5</div>
<span class="button-delete btn btn-default btn-xs pull-right"
data-owner-id="5">
<i class="fa fa-times-circle-o" aria-hidden="true"></i>
</span>
<span class="button-edit btn btn-default btn-xs pull-right"
data-owner-id="5">
<i class="fa fa-pencil" aria-hidden="true"></i>
</span>
</li>
</ol>
</li>
<!--------------------------->
</ol>
</div>
</div>
<div class="col-md-6">
<form class="form-inline" id="menu-add">
<h3>Add new menu item</h3>
<div class="form-group">
<label for="addInputName">Name</label>
<input type="text" class="form-control" id="addInputName" placeholder="Item name" required>
</div>
<div class="form-group">
<label for="addInputSlug">Slug</label>
<input type="text" class="form-control" id="addInputSlug" placeholder="item-slug" required>
</div>
<button class="btn btn-info" id="addButton">Add</button>
</form>
<form class="" id="menu-editor" style="display: none;">
<h3>Editing <span id="currentEditName"></span></h3>
<div class="form-group">
<label for="addInputName">Name</label>
<input type="text" class="form-control" id="editInputName" placeholder="Item name" required>
</div>
<div class="form-group">
<label for="addInputSlug">Slug</label>
<input type="text" class="form-control" id="editInputSlug" placeholder="item-slug">
</div>
<button class="btn btn-info" id="editButton">Edit</button>
</form>
</div>
</div>
<div class="row output-container">
<div class="col-md-offset-1 col-md-10">
<h2 class="text-center">Output:</h2>
<form class="form">
<textarea class="form-control" id="json-output" rows="5"></textarea>
</form>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="./jquery.nestable.js"></script>
<script src="./jquery.nestable++.js"></script>
<script>
$('.dd.nestable').nestable({
maxDepth: 5
})
.on('change', updateOutput);
</script>
</body>
</html>