-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdemo-2.html
85 lines (71 loc) · 4.22 KB
/
demo-2.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
<!doctype html>
<html lang="en">
<head>
<title>File Tree Browser Demo 2 - Bootstrap modal Image Picker</title>
<meta name="description" content="Retrieves directories and files recursively with Ajax from a main directory and displays the tree structure. Programmed in pure Javascript / CSS without any dependency. PHP connector is provided, you can write your own in any server language (NodeJS, ASP, ...)">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body>
<h1 class="pt-5 text-center">File Tree Browser Demo 2 - Bootstrap modal Image Picker</h1>
<div class="d-flex mx-auto justify-content-center my-3" role="group">
<a href="index.html" class="btn btn-primary mr-4">Demo 1</a>
<a href="#" class="btn btn-secondary disabled">Demo 2</a>
</div>
<p class="text-center">Documentation & Download: <a href="https://github.com/migliori/file-tree-browser" title="File Tree Browser">https://github.com/migliori/file-tree-browser</a></p>
<!-- Button trigger modal -->
<div class="text-center my-5">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#file-tree-browser-modal">Choose an image</button>
</div>
<!-- Output image -->
<div id="ft-output" class="text-center my-5"></div>
<!-- Modal -->
<div class="modal fade" id="file-tree-browser-modal" tabindex="-1" role="dialog" aria-labelledby="file-tree-browser-modal-label" aria-hidden="true">
<div class="modal-dialog modal-dialog-scrollable modal-xl" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="file-tree-browser-modal-label">Choose an image</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="container" id="file-tree-browser-wrapper">
<div class="row">
<div class="col-sm-3 ft-tree"></div>
<div class="col-sm-9 ft-explorer"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="text-center"><a href="https://www.miglisoft.com/">@miglisoft</a></p>
<script src="dist/js/file-tree-browser.js"></script>
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script>
$(document).ready(function() {
var options = {
mainDir: 'demo-files',
explorerMode: 'grid',
extensions: ['.jpg', '.jpeg', '.png'],
elementClick: function (filePath, fileName) {
},
cancelBtnClick: function (filePath, fileName) {
$('#file-tree-browser-modal').modal('hide');
},
okBtnClick: function (filePath, fileName) {
$('#ft-output').html('<img src="/' + filePath + '" class="img-fluid img-thumbnail" alt="">');
$('#file-tree-browser-modal').modal('hide');
}
};
var ft = new FileTreeBrowser('file-tree-browser-wrapper', options);
});
</script>
</body>
</html>