-
Notifications
You must be signed in to change notification settings - Fork 66
/
index.html
133 lines (119 loc) · 4.68 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
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css">
<link rel="stylesheet" href="/dist/style.css">
</head>
<body>
<div class="container">
<p></p>
<div class="row">
<div class="col-md-6">
<h3>Single</h3>
<div class="form-group">
<div id="media-manager-1"></div>
</div>
<div class="form-group">
<input id="file-input-1" type="text" class="form-control" placeholder="File">
</div>
</div>
<div class="col-md-6">
<h3>Multiple</h3>
<div class="form-group">
<div id="media-manager-3"></div>
</div>
<div class="form-group">
<textarea id="file-input-3" class="form-control" placeholder="Files"></textarea>
</div>
</div>
</div>
<div class="row">
<div class="col-md-push-3 col-md-6">
<h3>Modal</h3>
<div class="form-group">
<div class="input-group">
<input id="file-input-2" type="text" class="form-control" placeholder="File">
<span class="input-group-btn">
<button class="btn btn-primary" type="button" data-toggle="modal" data-target="#media-manager-modal"><i class="fa fa-folder-open"></i> Browse</button>
</span>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="media-manager-modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Media Manager</h4>
</div>
<div class="modal-body">
<div id="media-manager-2"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
<script src="/dist/mm.js"></script>
<script type="text/javascript">
/* global MM, $ */
var mm1, mm2, mm3;
var api = {
baseUrl: 'http://127.0.0.1/mm-server/web/api/',
listUrl: 'list',
downloadUrl: 'download',
uploadUrl: 'upload'
};
mm1 = new MM({
el: '#media-manager-1',
api: api,
input: {
el: '#file-input-1',
multiple: false
}
});
mm3 = new MM({
el: '#media-manager-3',
basePath: '/',
api: api,
input: {
el: '#file-input-3',
multiple: true
},
height: '400px'
});
$('#media-manager-modal').on('show.bs.modal', function (e) {
mm2 = new MM({
el: '#media-manager-2',
path: '/',
api: api,
input: {
el: '#file-input-2',
multiple: false
},
height: '400px',
onSelect: function(e) {
$('#media-manager-modal').modal('hide');
}
});
});
$('#media-manager-modal').on('hide.bs.modal', function (e) {
mm2.destroy();
});
</script>
</body>
</html>