rails-adminlte 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +5 -1
- data/lib/rails/adminlte/version.rb +1 -1
- data/vendor/assets/javascripts/adminlte/adminlte.js +1025 -668
- data/vendor/assets/stylesheets/adminlte/adminlte.css +125 -90
- data/vendor/assets/stylesheets/adminlte/alt/AdminLTE-select2.css +4 -1
- data/vendor/assets/stylesheets/adminlte/alt/AdminLTE-select2.min.css +1 -1
- data/vendor/assets/stylesheets/adminlte/alt/AdminLTE-without-plugins.css +98 -88
- data/vendor/assets/stylesheets/adminlte/alt/AdminLTE-without-plugins.min.css +4 -4
- data/vendor/assets/stylesheets/adminlte/skins/_all-skins.css +84 -73
- data/vendor/assets/stylesheets/adminlte/skins/_all-skins.min.css +1 -1
- data/vendor/assets/stylesheets/adminlte/skins/skin-black-light.css +12 -14
- data/vendor/assets/stylesheets/adminlte/skins/skin-black-light.min.css +1 -1
- data/vendor/assets/stylesheets/adminlte/skins/skin-black.css +7 -4
- data/vendor/assets/stylesheets/adminlte/skins/skin-black.min.css +1 -1
- data/vendor/assets/stylesheets/adminlte/skins/skin-blue-light.css +6 -7
- data/vendor/assets/stylesheets/adminlte/skins/skin-blue-light.min.css +1 -1
- data/vendor/assets/stylesheets/adminlte/skins/skin-blue.css +7 -4
- data/vendor/assets/stylesheets/adminlte/skins/skin-blue.min.css +1 -1
- data/vendor/assets/stylesheets/adminlte/skins/skin-green-light.css +6 -7
- data/vendor/assets/stylesheets/adminlte/skins/skin-green-light.min.css +1 -1
- data/vendor/assets/stylesheets/adminlte/skins/skin-green.css +7 -4
- data/vendor/assets/stylesheets/adminlte/skins/skin-green.min.css +1 -1
- data/vendor/assets/stylesheets/adminlte/skins/skin-purple-light.css +6 -7
- data/vendor/assets/stylesheets/adminlte/skins/skin-purple-light.min.css +1 -1
- data/vendor/assets/stylesheets/adminlte/skins/skin-purple.css +7 -4
- data/vendor/assets/stylesheets/adminlte/skins/skin-purple.min.css +1 -1
- data/vendor/assets/stylesheets/adminlte/skins/skin-red-light.css +6 -7
- data/vendor/assets/stylesheets/adminlte/skins/skin-red-light.min.css +1 -1
- data/vendor/assets/stylesheets/adminlte/skins/skin-red.css +7 -4
- data/vendor/assets/stylesheets/adminlte/skins/skin-red.min.css +1 -1
- data/vendor/assets/stylesheets/adminlte/skins/skin-yellow-light.css +6 -7
- data/vendor/assets/stylesheets/adminlte/skins/skin-yellow-light.min.css +1 -1
- data/vendor/assets/stylesheets/adminlte/skins/skin-yellow.css +7 -4
- data/vendor/assets/stylesheets/adminlte/skins/skin-yellow.min.css +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 840a75b56048504a5748cf42ab2f5c871caafdc12d7e42ddd5111c1607dde4f1
|
4
|
+
data.tar.gz: d89c3de74b7009e7e0bf36bf02a0f03f0de3f3760912c536be4b5f6be8b3e69b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7bd9aac0b495b7ee4e9a476ce6fc5436556ae5b9284c1b7ecdf4882cb3ae0425b923744815f604f353a2f95df4f7c1f292431554d4b4ad30021aa608950e4e0
|
7
|
+
data.tar.gz: 4cabe191e2477ad6008337ccb1a07d53a82dca1dae9f20b463b368d6f581c5b9c09cd3d7b44a01b9789f1fec66533683527932baf436178c20a176b6e0d05427
|
data/README.md
CHANGED
@@ -8,6 +8,7 @@ How to use my plugin.
|
|
8
8
|
Add this line to your application's Gemfile:
|
9
9
|
|
10
10
|
```ruby
|
11
|
+
gem 'font-awesome-rails'
|
11
12
|
gem 'rails-adminlte'
|
12
13
|
```
|
13
14
|
|
@@ -34,11 +35,14 @@ Add the following to your `app/assets/javascripts/application.js`:
|
|
34
35
|
|
35
36
|
Add the following to your `app/assets/stylesheets/application.css`:
|
36
37
|
|
38
|
+
*= require bootstrap
|
37
39
|
*= require adminlte/adminlte
|
40
|
+
*= require adminlte/skins/_all-skins
|
41
|
+
*= require font-awesome
|
38
42
|
|
39
43
|
## Version
|
40
44
|
|
41
|
-
0.1.
|
45
|
+
0.1.8 (AdminLTE 2.4.2)
|
42
46
|
## License
|
43
47
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
44
48
|
|
@@ -1,772 +1,1129 @@
|
|
1
1
|
/*! AdminLTE app.js
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
2
|
+
* ================
|
3
|
+
* Main JS application file for AdminLTE v2. This file
|
4
|
+
* should be included in all pages. It controls some layout
|
5
|
+
* options and implements exclusive AdminLTE plugins.
|
6
|
+
*
|
7
|
+
* @Author Almsaeed Studio
|
8
|
+
* @Support <https://www.almsaeedstudio.com>
|
9
|
+
* @Email <abdullah@almsaeedstudio.com>
|
10
|
+
* @version 2.4.2
|
11
|
+
* @repository git://github.com/almasaeed2010/AdminLTE.git
|
12
|
+
* @license MIT <http://opensource.org/licenses/MIT>
|
13
|
+
*/
|
14
|
+
|
15
|
+
// Make sure jQuery has been loaded
|
16
|
+
if (typeof jQuery === 'undefined') {
|
17
|
+
throw new Error('AdminLTE requires jQuery')
|
17
18
|
}
|
18
19
|
|
19
|
-
/*
|
20
|
+
/* BoxRefresh()
|
21
|
+
* =========
|
22
|
+
* Adds AJAX content control to a box.
|
20
23
|
*
|
21
|
-
* @
|
22
|
-
*
|
23
|
-
*
|
24
|
-
* to the template. Keeping everything wrapped in an object
|
25
|
-
* prevents conflict with other plugins and is a better
|
26
|
-
* way to organize our code.
|
24
|
+
* @Usage: $('#my-box').boxRefresh(options)
|
25
|
+
* or add [data-widget="box-refresh"] to the box element
|
26
|
+
* Pass any option as data-option="value"
|
27
27
|
*/
|
28
|
-
|
28
|
+
+function ($) {
|
29
|
+
'use strict';
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
navbarMenuHeight: "200px", //The height of the inner menu
|
42
|
-
//General animation speed for JS animated elements such as box collapse/expand and
|
43
|
-
//sidebar treeview slide up/down. This option accepts an integer as milliseconds,
|
44
|
-
//'fast', 'normal', or 'slow'
|
45
|
-
animationSpeed: 500,
|
46
|
-
//Sidebar push menu toggle button selector
|
47
|
-
sidebarToggleSelector: "[data-toggle='offcanvas']",
|
48
|
-
//Activate sidebar push menu
|
49
|
-
sidebarPushMenu: true,
|
50
|
-
//Activate sidebar slimscroll if the fixed layout is set (requires SlimScroll Plugin)
|
51
|
-
sidebarSlimScroll: true,
|
52
|
-
//Enable sidebar expand on hover effect for sidebar mini
|
53
|
-
//This option is forced to true if both the fixed layout and sidebar mini
|
54
|
-
//are used together
|
55
|
-
sidebarExpandOnHover: false,
|
56
|
-
//BoxRefresh Plugin
|
57
|
-
enableBoxRefresh: true,
|
58
|
-
//Bootstrap.js tooltip
|
59
|
-
enableBSToppltip: true,
|
60
|
-
BSTooltipSelector: "[data-toggle='tooltip']",
|
61
|
-
//Enable Fast Click. Fastclick.js creates a more
|
62
|
-
//native touch experience with touch devices. If you
|
63
|
-
//choose to enable the plugin, make sure you load the script
|
64
|
-
//before AdminLTE's app.js
|
65
|
-
enableFastclick: false,
|
66
|
-
//Control Sidebar Tree views
|
67
|
-
enableControlTreeView: true,
|
68
|
-
//Control Sidebar Options
|
69
|
-
enableControlSidebar: true,
|
70
|
-
controlSidebarOptions: {
|
71
|
-
//Which button should trigger the open/close event
|
72
|
-
toggleBtnSelector: "[data-toggle='control-sidebar']",
|
73
|
-
//The sidebar selector
|
74
|
-
selector: ".control-sidebar",
|
75
|
-
//Enable slide over content
|
76
|
-
slide: true
|
77
|
-
},
|
78
|
-
//Box Widget Plugin. Enable this plugin
|
79
|
-
//to allow boxes to be collapsed and/or removed
|
80
|
-
enableBoxWidget: true,
|
81
|
-
//Box Widget plugin options
|
82
|
-
boxWidgetOptions: {
|
83
|
-
boxWidgetIcons: {
|
84
|
-
//Collapse icon
|
85
|
-
collapse: 'fa-minus',
|
86
|
-
//Open icon
|
87
|
-
open: 'fa-plus',
|
88
|
-
//Remove icon
|
89
|
-
remove: 'fa-times'
|
31
|
+
var DataKey = 'lte.boxrefresh';
|
32
|
+
|
33
|
+
var Default = {
|
34
|
+
source : '',
|
35
|
+
params : {},
|
36
|
+
trigger : '.refresh-btn',
|
37
|
+
content : '.box-body',
|
38
|
+
loadInContent : true,
|
39
|
+
responseType : '',
|
40
|
+
overlayTemplate: '<div class="overlay"><div class="fa fa-refresh fa-spin"></div></div>',
|
41
|
+
onLoadStart : function () {
|
90
42
|
},
|
91
|
-
|
92
|
-
|
93
|
-
remove: '[data-widget="remove"]',
|
94
|
-
//Collapse button selector
|
95
|
-
collapse: '[data-widget="collapse"]'
|
43
|
+
onLoadDone : function (response) {
|
44
|
+
return response;
|
96
45
|
}
|
97
|
-
}
|
98
|
-
//Direct Chat plugin options
|
99
|
-
directChat: {
|
100
|
-
//Enable direct chat by default
|
101
|
-
enable: true,
|
102
|
-
//The button to open and close the chat contacts pane
|
103
|
-
contactToggleSelector: '[data-widget="chat-pane-toggle"]'
|
104
|
-
},
|
105
|
-
//Define the set of colors to use globally around the website
|
106
|
-
colors: {
|
107
|
-
lightBlue: "#3c8dbc",
|
108
|
-
red: "#f56954",
|
109
|
-
green: "#00a65a",
|
110
|
-
aqua: "#00c0ef",
|
111
|
-
yellow: "#f39c12",
|
112
|
-
blue: "#0073b7",
|
113
|
-
navy: "#001F3F",
|
114
|
-
teal: "#39CCCC",
|
115
|
-
olive: "#3D9970",
|
116
|
-
lime: "#01FF70",
|
117
|
-
orange: "#FF851B",
|
118
|
-
fuchsia: "#F012BE",
|
119
|
-
purple: "#8E24AA",
|
120
|
-
maroon: "#D81B60",
|
121
|
-
black: "#222222",
|
122
|
-
gray: "#d2d6de"
|
123
|
-
},
|
124
|
-
//The standard screen sizes that bootstrap uses.
|
125
|
-
//If you change these in the variables.less file, change
|
126
|
-
//them here too.
|
127
|
-
screenSizes: {
|
128
|
-
xs: 480,
|
129
|
-
sm: 768,
|
130
|
-
md: 992,
|
131
|
-
lg: 1200
|
132
|
-
}
|
133
|
-
};
|
134
|
-
|
135
|
-
/* ------------------
|
136
|
-
* - Implementation -
|
137
|
-
* ------------------
|
138
|
-
* The next block of code implements AdminLTE's
|
139
|
-
* functions and plugins as specified by the
|
140
|
-
* options above.
|
141
|
-
*/
|
142
|
-
$(function () {
|
143
|
-
"use strict";
|
46
|
+
};
|
144
47
|
|
145
|
-
|
146
|
-
|
48
|
+
var Selector = {
|
49
|
+
data: '[data-widget="box-refresh"]'
|
50
|
+
};
|
147
51
|
|
148
|
-
//
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
52
|
+
// BoxRefresh Class Definition
|
53
|
+
// =========================
|
54
|
+
var BoxRefresh = function (element, options) {
|
55
|
+
this.element = element;
|
56
|
+
this.options = options;
|
57
|
+
this.$overlay = $(options.overlay);
|
154
58
|
|
155
|
-
|
156
|
-
|
59
|
+
if (options.source === '') {
|
60
|
+
throw new Error('Source url was not defined. Please specify a url in your BoxRefresh source option.');
|
61
|
+
}
|
157
62
|
|
158
|
-
|
159
|
-
|
63
|
+
this._setUpListeners();
|
64
|
+
this.load();
|
65
|
+
};
|
160
66
|
|
161
|
-
|
162
|
-
|
67
|
+
BoxRefresh.prototype.load = function () {
|
68
|
+
this._addOverlay();
|
69
|
+
this.options.onLoadStart.call($(this));
|
163
70
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
71
|
+
$.get(this.options.source, this.options.params, function (response) {
|
72
|
+
if (this.options.loadInContent) {
|
73
|
+
$(this.options.content).html(response);
|
74
|
+
}
|
75
|
+
this.options.onLoadDone.call($(this), response);
|
76
|
+
this._removeOverlay();
|
77
|
+
}.bind(this), this.options.responseType !== '' && this.options.responseType);
|
78
|
+
};
|
168
79
|
|
169
|
-
//
|
170
|
-
if (o.enableControlSidebar) {
|
171
|
-
$.AdminLTE.controlSidebar.activate();
|
172
|
-
}
|
80
|
+
// Private
|
173
81
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
}).css("width", "100%");
|
181
|
-
}
|
82
|
+
BoxRefresh.prototype._setUpListeners = function () {
|
83
|
+
$(this.element).on('click', Selector.trigger, function (event) {
|
84
|
+
if (event) event.preventDefault();
|
85
|
+
this.load();
|
86
|
+
}.bind(this));
|
87
|
+
};
|
182
88
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
}
|
89
|
+
BoxRefresh.prototype._addOverlay = function () {
|
90
|
+
$(this.element).append(this.$overlay);
|
91
|
+
};
|
187
92
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
selector: o.BSTooltipSelector,
|
192
|
-
container: 'body'
|
193
|
-
});
|
194
|
-
}
|
93
|
+
BoxRefresh.prototype._removeOverlay = function () {
|
94
|
+
$(this.element).remove(this.$overlay);
|
95
|
+
};
|
195
96
|
|
196
|
-
//
|
197
|
-
|
198
|
-
|
199
|
-
|
97
|
+
// Plugin Definition
|
98
|
+
// =================
|
99
|
+
function Plugin(option) {
|
100
|
+
return this.each(function () {
|
101
|
+
var $this = $(this);
|
102
|
+
var data = $this.data(DataKey);
|
200
103
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
104
|
+
if (!data) {
|
105
|
+
var options = $.extend({}, Default, $this.data(), typeof option == 'object' && option);
|
106
|
+
$this.data(DataKey, (data = new BoxRefresh($this, options)));
|
107
|
+
}
|
205
108
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
109
|
+
if (typeof data == 'string') {
|
110
|
+
if (typeof data[option] == 'undefined') {
|
111
|
+
throw new Error('No method named ' + option);
|
112
|
+
}
|
113
|
+
data[option]();
|
114
|
+
}
|
211
115
|
});
|
212
116
|
}
|
213
117
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
$('.btn-group[data-toggle="btn-toggle"]').each(function () {
|
219
|
-
var group = $(this);
|
220
|
-
$(this).find(".btn").on('click', function (e) {
|
221
|
-
group.find(".btn.active").removeClass("active");
|
222
|
-
$(this).addClass("active");
|
223
|
-
e.preventDefault();
|
224
|
-
});
|
118
|
+
var old = $.fn.boxRefresh;
|
119
|
+
|
120
|
+
$.fn.boxRefresh = Plugin;
|
121
|
+
$.fn.boxRefresh.Constructor = BoxRefresh;
|
225
122
|
|
123
|
+
// No Conflict Mode
|
124
|
+
// ================
|
125
|
+
$.fn.boxRefresh.noConflict = function () {
|
126
|
+
$.fn.boxRefresh = old;
|
127
|
+
return this;
|
128
|
+
};
|
129
|
+
|
130
|
+
// BoxRefresh Data API
|
131
|
+
// =================
|
132
|
+
$(window).on('load', function () {
|
133
|
+
$(Selector.data).each(function () {
|
134
|
+
Plugin.call($(this));
|
135
|
+
});
|
226
136
|
});
|
227
|
-
});
|
228
137
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
138
|
+
}(jQuery);
|
139
|
+
|
140
|
+
|
141
|
+
/* BoxWidget()
|
142
|
+
* ======
|
143
|
+
* Adds box widget functions to boxes.
|
144
|
+
*
|
145
|
+
* @Usage: $('.my-box').boxWidget(options)
|
146
|
+
* This plugin auto activates on any element using the `.box` class
|
147
|
+
* Pass any option as data-option="value"
|
233
148
|
*/
|
234
|
-
function
|
149
|
+
+function ($) {
|
235
150
|
'use strict';
|
236
|
-
/* Layout
|
237
|
-
* ======
|
238
|
-
* Fixes the layout height in case min-height fails.
|
239
|
-
*
|
240
|
-
* @type Object
|
241
|
-
* @usage $.AdminLTE.layout.activate()
|
242
|
-
* $.AdminLTE.layout.fix()
|
243
|
-
* $.AdminLTE.layout.fixSidebar()
|
244
|
-
*/
|
245
|
-
$.AdminLTE.layout = {
|
246
|
-
activate: function () {
|
247
|
-
var _this = this;
|
248
|
-
_this.fix();
|
249
|
-
_this.fixSidebar();
|
250
|
-
$('body, html, .wrapper').css('height', 'auto');
|
251
|
-
$(window, ".wrapper").resize(function () {
|
252
|
-
_this.fix();
|
253
|
-
_this.fixSidebar();
|
254
|
-
});
|
255
|
-
},
|
256
|
-
fix: function () {
|
257
|
-
// Remove overflow from .wrapper if layout-boxed exists
|
258
|
-
$(".layout-boxed > .wrapper").css('overflow', 'hidden');
|
259
|
-
//Get window height and the wrapper height
|
260
|
-
var footer_height = $('.main-footer').outerHeight() || 0;
|
261
|
-
var neg = $('.main-header').outerHeight() + footer_height;
|
262
|
-
var window_height = $(window).height();
|
263
|
-
var sidebar_height = $(".sidebar").height() || 0;
|
264
|
-
//Set the min-height of the content and sidebar based on the
|
265
|
-
//the height of the document.
|
266
|
-
if ($("body").hasClass("fixed")) {
|
267
|
-
$(".content-wrapper, .right-side").css('min-height', window_height - footer_height);
|
268
|
-
} else {
|
269
|
-
var postSetWidth;
|
270
|
-
if (window_height >= sidebar_height) {
|
271
|
-
$(".content-wrapper, .right-side").css('min-height', window_height - neg);
|
272
|
-
postSetWidth = window_height - neg;
|
273
|
-
} else {
|
274
|
-
$(".content-wrapper, .right-side").css('min-height', sidebar_height);
|
275
|
-
postSetWidth = sidebar_height;
|
276
|
-
}
|
277
151
|
|
278
|
-
|
279
|
-
var controlSidebar = $($.AdminLTE.options.controlSidebarOptions.selector);
|
280
|
-
if (typeof controlSidebar !== "undefined") {
|
281
|
-
if (controlSidebar.height() > postSetWidth)
|
282
|
-
$(".content-wrapper, .right-side").css('min-height', controlSidebar.height());
|
283
|
-
}
|
152
|
+
var DataKey = 'lte.boxwidget';
|
284
153
|
|
154
|
+
var Default = {
|
155
|
+
animationSpeed : 500,
|
156
|
+
collapseTrigger: '[data-widget="collapse"]',
|
157
|
+
removeTrigger : '[data-widget="remove"]',
|
158
|
+
collapseIcon : 'fa-minus',
|
159
|
+
expandIcon : 'fa-plus',
|
160
|
+
removeIcon : 'fa-times'
|
161
|
+
};
|
162
|
+
|
163
|
+
var Selector = {
|
164
|
+
data : '.box',
|
165
|
+
collapsed: '.collapsed-box',
|
166
|
+
header : '.box-header',
|
167
|
+
body : '.box-body',
|
168
|
+
footer : '.box-footer',
|
169
|
+
tools : '.box-tools'
|
170
|
+
};
|
171
|
+
|
172
|
+
var ClassName = {
|
173
|
+
collapsed: 'collapsed-box'
|
174
|
+
};
|
175
|
+
|
176
|
+
var Event = {
|
177
|
+
collapsed: 'collapsed.boxwidget',
|
178
|
+
expanded : 'expanded.boxwidget',
|
179
|
+
removed : 'removed.boxwidget'
|
180
|
+
};
|
181
|
+
|
182
|
+
// BoxWidget Class Definition
|
183
|
+
// =====================
|
184
|
+
var BoxWidget = function (element, options) {
|
185
|
+
this.element = element;
|
186
|
+
this.options = options;
|
187
|
+
|
188
|
+
this._setUpListeners();
|
189
|
+
};
|
190
|
+
|
191
|
+
BoxWidget.prototype.toggle = function () {
|
192
|
+
var isOpen = !$(this.element).is(Selector.collapsed);
|
193
|
+
|
194
|
+
if (isOpen) {
|
195
|
+
this.collapse();
|
196
|
+
} else {
|
197
|
+
this.expand();
|
198
|
+
}
|
199
|
+
};
|
200
|
+
|
201
|
+
BoxWidget.prototype.expand = function () {
|
202
|
+
var expandedEvent = $.Event(Event.expanded);
|
203
|
+
var collapseIcon = this.options.collapseIcon;
|
204
|
+
var expandIcon = this.options.expandIcon;
|
205
|
+
|
206
|
+
$(this.element).removeClass(ClassName.collapsed);
|
207
|
+
|
208
|
+
$(this.element)
|
209
|
+
.children(Selector.header + ', ' + Selector.body + ', ' + Selector.footer)
|
210
|
+
.children(Selector.tools)
|
211
|
+
.find('.' + expandIcon)
|
212
|
+
.removeClass(expandIcon)
|
213
|
+
.addClass(collapseIcon);
|
214
|
+
|
215
|
+
$(this.element).children(Selector.body + ', ' + Selector.footer)
|
216
|
+
.slideDown(this.options.animationSpeed, function () {
|
217
|
+
$(this.element).trigger(expandedEvent);
|
218
|
+
}.bind(this));
|
219
|
+
};
|
220
|
+
|
221
|
+
BoxWidget.prototype.collapse = function () {
|
222
|
+
var collapsedEvent = $.Event(Event.collapsed);
|
223
|
+
var collapseIcon = this.options.collapseIcon;
|
224
|
+
var expandIcon = this.options.expandIcon;
|
225
|
+
|
226
|
+
$(this.element)
|
227
|
+
.children(Selector.header + ', ' + Selector.body + ', ' + Selector.footer)
|
228
|
+
.children(Selector.tools)
|
229
|
+
.find('.' + collapseIcon)
|
230
|
+
.removeClass(collapseIcon)
|
231
|
+
.addClass(expandIcon);
|
232
|
+
|
233
|
+
$(this.element).children(Selector.body + ', ' + Selector.footer)
|
234
|
+
.slideUp(this.options.animationSpeed, function () {
|
235
|
+
$(this.element).addClass(ClassName.collapsed);
|
236
|
+
$(this.element).trigger(collapsedEvent);
|
237
|
+
}.bind(this));
|
238
|
+
};
|
239
|
+
|
240
|
+
BoxWidget.prototype.remove = function () {
|
241
|
+
var removedEvent = $.Event(Event.removed);
|
242
|
+
|
243
|
+
$(this.element).slideUp(this.options.animationSpeed, function () {
|
244
|
+
$(this.element).trigger(removedEvent);
|
245
|
+
$(this.element).remove();
|
246
|
+
}.bind(this));
|
247
|
+
};
|
248
|
+
|
249
|
+
// Private
|
250
|
+
|
251
|
+
BoxWidget.prototype._setUpListeners = function () {
|
252
|
+
var that = this;
|
253
|
+
|
254
|
+
$(this.element).on('click', this.options.collapseTrigger, function (event) {
|
255
|
+
if (event) event.preventDefault();
|
256
|
+
that.toggle($(this));
|
257
|
+
return false;
|
258
|
+
});
|
259
|
+
|
260
|
+
$(this.element).on('click', this.options.removeTrigger, function (event) {
|
261
|
+
if (event) event.preventDefault();
|
262
|
+
that.remove($(this));
|
263
|
+
return false;
|
264
|
+
});
|
265
|
+
};
|
266
|
+
|
267
|
+
// Plugin Definition
|
268
|
+
// =================
|
269
|
+
function Plugin(option) {
|
270
|
+
return this.each(function () {
|
271
|
+
var $this = $(this);
|
272
|
+
var data = $this.data(DataKey);
|
273
|
+
|
274
|
+
if (!data) {
|
275
|
+
var options = $.extend({}, Default, $this.data(), typeof option == 'object' && option);
|
276
|
+
$this.data(DataKey, (data = new BoxWidget($this, options)));
|
285
277
|
}
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
if (typeof $.fn.slimScroll != 'undefined') {
|
291
|
-
$(".sidebar").slimScroll({destroy: true}).height("auto");
|
292
|
-
}
|
293
|
-
return;
|
294
|
-
} else if (typeof $.fn.slimScroll == 'undefined' && window.console) {
|
295
|
-
window.console.error("Error: the fixed layout requires the slimscroll plugin!");
|
296
|
-
}
|
297
|
-
//Enable slimscroll for fixed layout
|
298
|
-
if ($.AdminLTE.options.sidebarSlimScroll) {
|
299
|
-
if (typeof $.fn.slimScroll != 'undefined') {
|
300
|
-
//Destroy if it exists
|
301
|
-
$(".sidebar").slimScroll({destroy: true}).height("auto");
|
302
|
-
//Add slimscroll
|
303
|
-
$(".sidebar").slimScroll({
|
304
|
-
height: ($(window).height() - $(".main-header").height()) + "px",
|
305
|
-
color: "rgba(0,0,0,0.2)",
|
306
|
-
size: "3px"
|
307
|
-
});
|
278
|
+
|
279
|
+
if (typeof option == 'string') {
|
280
|
+
if (typeof data[option] == 'undefined') {
|
281
|
+
throw new Error('No method named ' + option);
|
308
282
|
}
|
283
|
+
data[option]();
|
309
284
|
}
|
285
|
+
});
|
286
|
+
}
|
287
|
+
|
288
|
+
var old = $.fn.boxWidget;
|
289
|
+
|
290
|
+
$.fn.boxWidget = Plugin;
|
291
|
+
$.fn.boxWidget.Constructor = BoxWidget;
|
292
|
+
|
293
|
+
// No Conflict Mode
|
294
|
+
// ================
|
295
|
+
$.fn.boxWidget.noConflict = function () {
|
296
|
+
$.fn.boxWidget = old;
|
297
|
+
return this;
|
298
|
+
};
|
299
|
+
|
300
|
+
// BoxWidget Data API
|
301
|
+
// ==================
|
302
|
+
$(window).on('load', function () {
|
303
|
+
$(Selector.data).each(function () {
|
304
|
+
Plugin.call($(this));
|
305
|
+
});
|
306
|
+
});
|
307
|
+
}(jQuery);
|
308
|
+
|
309
|
+
|
310
|
+
/* ControlSidebar()
|
311
|
+
* ===============
|
312
|
+
* Toggles the state of the control sidebar
|
313
|
+
*
|
314
|
+
* @Usage: $('#control-sidebar-trigger').controlSidebar(options)
|
315
|
+
* or add [data-toggle="control-sidebar"] to the trigger
|
316
|
+
* Pass any option as data-option="value"
|
317
|
+
*/
|
318
|
+
+function ($) {
|
319
|
+
'use strict';
|
320
|
+
|
321
|
+
var DataKey = 'lte.controlsidebar';
|
322
|
+
|
323
|
+
var Default = {
|
324
|
+
slide: true
|
325
|
+
};
|
326
|
+
|
327
|
+
var Selector = {
|
328
|
+
sidebar: '.control-sidebar',
|
329
|
+
data : '[data-toggle="control-sidebar"]',
|
330
|
+
open : '.control-sidebar-open',
|
331
|
+
bg : '.control-sidebar-bg',
|
332
|
+
wrapper: '.wrapper',
|
333
|
+
content: '.content-wrapper',
|
334
|
+
boxed : '.layout-boxed'
|
335
|
+
};
|
336
|
+
|
337
|
+
var ClassName = {
|
338
|
+
open : 'control-sidebar-open',
|
339
|
+
fixed: 'fixed'
|
340
|
+
};
|
341
|
+
|
342
|
+
var Event = {
|
343
|
+
collapsed: 'collapsed.controlsidebar',
|
344
|
+
expanded : 'expanded.controlsidebar'
|
345
|
+
};
|
346
|
+
|
347
|
+
// ControlSidebar Class Definition
|
348
|
+
// ===============================
|
349
|
+
var ControlSidebar = function (element, options) {
|
350
|
+
this.element = element;
|
351
|
+
this.options = options;
|
352
|
+
this.hasBindedResize = false;
|
353
|
+
|
354
|
+
this.init();
|
355
|
+
};
|
356
|
+
|
357
|
+
ControlSidebar.prototype.init = function () {
|
358
|
+
// Add click listener if the element hasn't been
|
359
|
+
// initialized using the data API
|
360
|
+
if (!$(this.element).is(Selector.data)) {
|
361
|
+
$(this).on('click', this.toggle);
|
310
362
|
}
|
363
|
+
|
364
|
+
this.fix();
|
365
|
+
$(window).resize(function () {
|
366
|
+
this.fix();
|
367
|
+
}.bind(this));
|
311
368
|
};
|
312
369
|
|
313
|
-
|
314
|
-
|
315
|
-
* Adds the push menu functionality to the sidebar.
|
316
|
-
*
|
317
|
-
* @type Function
|
318
|
-
* @usage: $.AdminLTE.pushMenu("[data-toggle='offcanvas']")
|
319
|
-
*/
|
320
|
-
$.AdminLTE.pushMenu = {
|
321
|
-
activate: function (toggleBtn) {
|
322
|
-
//Get the screen sizes
|
323
|
-
var screenSizes = $.AdminLTE.options.screenSizes;
|
324
|
-
|
325
|
-
//Enable sidebar toggle
|
326
|
-
$(document).on('click', toggleBtn, function (e) {
|
327
|
-
e.preventDefault();
|
328
|
-
|
329
|
-
//Enable sidebar push menu
|
330
|
-
if ($(window).width() > (screenSizes.sm - 1)) {
|
331
|
-
if ($("body").hasClass('sidebar-collapse')) {
|
332
|
-
$("body").removeClass('sidebar-collapse').trigger('expanded.pushMenu');
|
333
|
-
} else {
|
334
|
-
$("body").addClass('sidebar-collapse').trigger('collapsed.pushMenu');
|
335
|
-
}
|
336
|
-
}
|
337
|
-
//Handle sidebar push menu for small screens
|
338
|
-
else {
|
339
|
-
if ($("body").hasClass('sidebar-open')) {
|
340
|
-
$("body").removeClass('sidebar-open').removeClass('sidebar-collapse').trigger('collapsed.pushMenu');
|
341
|
-
} else {
|
342
|
-
$("body").addClass('sidebar-open').trigger('expanded.pushMenu');
|
343
|
-
}
|
344
|
-
}
|
345
|
-
});
|
370
|
+
ControlSidebar.prototype.toggle = function (event) {
|
371
|
+
if (event) event.preventDefault();
|
346
372
|
|
347
|
-
|
348
|
-
//Enable hide menu when clicking on the content-wrapper on small screens
|
349
|
-
if ($(window).width() <= (screenSizes.sm - 1) && $("body").hasClass("sidebar-open")) {
|
350
|
-
$("body").removeClass('sidebar-open');
|
351
|
-
}
|
352
|
-
});
|
373
|
+
this.fix();
|
353
374
|
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
375
|
+
if (!$(Selector.sidebar).is(Selector.open) && !$('body').is(Selector.open)) {
|
376
|
+
this.expand();
|
377
|
+
} else {
|
378
|
+
this.collapse();
|
379
|
+
}
|
380
|
+
};
|
381
|
+
|
382
|
+
ControlSidebar.prototype.expand = function () {
|
383
|
+
if (!this.options.slide) {
|
384
|
+
$('body').addClass(ClassName.open);
|
385
|
+
} else {
|
386
|
+
$(Selector.sidebar).addClass(ClassName.open);
|
387
|
+
}
|
388
|
+
|
389
|
+
$(this.element).trigger($.Event(Event.expanded));
|
390
|
+
};
|
391
|
+
|
392
|
+
ControlSidebar.prototype.collapse = function () {
|
393
|
+
$('body, ' + Selector.sidebar).removeClass(ClassName.open);
|
394
|
+
$(this.element).trigger($.Event(Event.collapsed));
|
395
|
+
};
|
396
|
+
|
397
|
+
ControlSidebar.prototype.fix = function () {
|
398
|
+
if ($('body').is(Selector.boxed)) {
|
399
|
+
this._fixForBoxed($(Selector.bg));
|
400
|
+
}
|
401
|
+
};
|
402
|
+
|
403
|
+
// Private
|
404
|
+
|
405
|
+
ControlSidebar.prototype._fixForBoxed = function (bg) {
|
406
|
+
bg.css({
|
407
|
+
position: 'absolute',
|
408
|
+
height : $(Selector.wrapper).height()
|
409
|
+
});
|
410
|
+
};
|
411
|
+
|
412
|
+
// Plugin Definition
|
413
|
+
// =================
|
414
|
+
function Plugin(option) {
|
415
|
+
return this.each(function () {
|
416
|
+
var $this = $(this);
|
417
|
+
var data = $this.data(DataKey);
|
418
|
+
|
419
|
+
if (!data) {
|
420
|
+
var options = $.extend({}, Default, $this.data(), typeof option == 'object' && option);
|
421
|
+
$this.data(DataKey, (data = new ControlSidebar($this, options)));
|
359
422
|
}
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
423
|
+
|
424
|
+
if (typeof option == 'string') data.toggle();
|
425
|
+
});
|
426
|
+
}
|
427
|
+
|
428
|
+
var old = $.fn.controlSidebar;
|
429
|
+
|
430
|
+
$.fn.controlSidebar = Plugin;
|
431
|
+
$.fn.controlSidebar.Constructor = ControlSidebar;
|
432
|
+
|
433
|
+
// No Conflict Mode
|
434
|
+
// ================
|
435
|
+
$.fn.controlSidebar.noConflict = function () {
|
436
|
+
$.fn.controlSidebar = old;
|
437
|
+
return this;
|
438
|
+
};
|
439
|
+
|
440
|
+
// ControlSidebar Data API
|
441
|
+
// =======================
|
442
|
+
$(document).on('click', Selector.data, function (event) {
|
443
|
+
if (event) event.preventDefault();
|
444
|
+
Plugin.call($(this), 'toggle');
|
445
|
+
});
|
446
|
+
|
447
|
+
}(jQuery);
|
448
|
+
|
449
|
+
|
450
|
+
/* DirectChat()
|
451
|
+
* ===============
|
452
|
+
* Toggles the state of the control sidebar
|
453
|
+
*
|
454
|
+
* @Usage: $('#my-chat-box').directChat()
|
455
|
+
* or add [data-widget="direct-chat"] to the trigger
|
456
|
+
*/
|
457
|
+
+function ($) {
|
458
|
+
'use strict';
|
459
|
+
|
460
|
+
var DataKey = 'lte.directchat';
|
461
|
+
|
462
|
+
var Selector = {
|
463
|
+
data: '[data-widget="chat-pane-toggle"]',
|
464
|
+
box : '.direct-chat'
|
465
|
+
};
|
466
|
+
|
467
|
+
var ClassName = {
|
468
|
+
open: 'direct-chat-contacts-open'
|
469
|
+
};
|
470
|
+
|
471
|
+
// DirectChat Class Definition
|
472
|
+
// ===========================
|
473
|
+
var DirectChat = function (element) {
|
474
|
+
this.element = element;
|
475
|
+
};
|
476
|
+
|
477
|
+
DirectChat.prototype.toggle = function ($trigger) {
|
478
|
+
$trigger.parents(Selector.box).first().toggleClass(ClassName.open);
|
479
|
+
};
|
480
|
+
|
481
|
+
// Plugin Definition
|
482
|
+
// =================
|
483
|
+
function Plugin(option) {
|
484
|
+
return this.each(function () {
|
485
|
+
var $this = $(this);
|
486
|
+
var data = $this.data(DataKey);
|
487
|
+
|
488
|
+
if (!data) {
|
489
|
+
$this.data(DataKey, (data = new DirectChat($this)));
|
385
490
|
}
|
386
|
-
|
491
|
+
|
492
|
+
if (typeof option == 'string') data.toggle($this);
|
493
|
+
});
|
494
|
+
}
|
495
|
+
|
496
|
+
var old = $.fn.directChat;
|
497
|
+
|
498
|
+
$.fn.directChat = Plugin;
|
499
|
+
$.fn.directChat.Constructor = DirectChat;
|
500
|
+
|
501
|
+
// No Conflict Mode
|
502
|
+
// ================
|
503
|
+
$.fn.directChat.noConflict = function () {
|
504
|
+
$.fn.directChat = old;
|
505
|
+
return this;
|
387
506
|
};
|
388
507
|
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
//If the menu is not visible
|
417
|
-
else if ((checkElement.is('.treeview-menu')) && (!checkElement.is(':visible'))) {
|
418
|
-
//Get the parent menu
|
419
|
-
var parent = $this.parents('ul').first();
|
420
|
-
//Close all open menus within the parent
|
421
|
-
var ul = parent.find('ul:visible').slideUp(animationSpeed);
|
422
|
-
//Remove the menu-open class from the parent
|
423
|
-
ul.removeClass('menu-open');
|
424
|
-
//Get the parent li
|
425
|
-
var parent_li = $this.parent("li");
|
426
|
-
|
427
|
-
//Open the target menu and add the menu-open class
|
428
|
-
checkElement.slideDown(animationSpeed, function () {
|
429
|
-
//Add the class active to the parent li
|
430
|
-
checkElement.addClass('menu-open');
|
431
|
-
parent.find('li.active').removeClass('active');
|
432
|
-
parent_li.addClass('active');
|
433
|
-
//Fix the layout in case the sidebar stretches over the height of the window
|
434
|
-
_this.layout.fix();
|
435
|
-
});
|
436
|
-
}
|
437
|
-
//if this isn't a link, prevent the page from being redirected
|
438
|
-
if (checkElement.is('.treeview-menu')) {
|
439
|
-
e.preventDefault();
|
440
|
-
}
|
441
|
-
});
|
508
|
+
// DirectChat Data API
|
509
|
+
// ===================
|
510
|
+
$(document).on('click', Selector.data, function (event) {
|
511
|
+
if (event) event.preventDefault();
|
512
|
+
Plugin.call($(this), 'toggle');
|
513
|
+
});
|
514
|
+
|
515
|
+
}(jQuery);
|
516
|
+
|
517
|
+
|
518
|
+
/* Layout()
|
519
|
+
* ========
|
520
|
+
* Implements AdminLTE layout.
|
521
|
+
* Fixes the layout height in case min-height fails.
|
522
|
+
*
|
523
|
+
* @usage activated automatically upon window load.
|
524
|
+
* Configure any options by passing data-option="value"
|
525
|
+
* to the body tag.
|
526
|
+
*/
|
527
|
+
+function ($) {
|
528
|
+
'use strict';
|
529
|
+
|
530
|
+
var DataKey = 'lte.layout';
|
531
|
+
|
532
|
+
var Default = {
|
533
|
+
slimscroll : true,
|
534
|
+
resetHeight: true
|
442
535
|
};
|
443
536
|
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
537
|
+
var Selector = {
|
538
|
+
wrapper : '.wrapper',
|
539
|
+
contentWrapper: '.content-wrapper',
|
540
|
+
layoutBoxed : '.layout-boxed',
|
541
|
+
mainFooter : '.main-footer',
|
542
|
+
mainHeader : '.main-header',
|
543
|
+
sidebar : '.sidebar',
|
544
|
+
controlSidebar: '.control-sidebar',
|
545
|
+
fixed : '.fixed',
|
546
|
+
sidebarMenu : '.sidebar-menu',
|
547
|
+
logo : '.main-header .logo'
|
548
|
+
};
|
549
|
+
|
550
|
+
var ClassName = {
|
551
|
+
fixed : 'fixed',
|
552
|
+
holdTransition: 'hold-transition'
|
553
|
+
};
|
554
|
+
|
555
|
+
var Layout = function (options) {
|
556
|
+
this.options = options;
|
557
|
+
this.bindedResize = false;
|
558
|
+
this.activate();
|
559
|
+
};
|
560
|
+
|
561
|
+
Layout.prototype.activate = function () {
|
562
|
+
this.fix();
|
563
|
+
this.fixSidebar();
|
564
|
+
|
565
|
+
$('body').removeClass(ClassName.holdTransition);
|
566
|
+
|
567
|
+
if (this.options.resetHeight) {
|
568
|
+
$('body, html, ' + Selector.wrapper).css({
|
569
|
+
'height' : 'auto',
|
570
|
+
'min-height': '100%'
|
474
571
|
});
|
572
|
+
}
|
475
573
|
|
476
|
-
|
477
|
-
|
478
|
-
|
574
|
+
if (!this.bindedResize) {
|
575
|
+
$(window).resize(function () {
|
576
|
+
this.fix();
|
577
|
+
this.fixSidebar();
|
479
578
|
|
480
|
-
|
481
|
-
|
482
|
-
|
579
|
+
$(Selector.logo + ', ' + Selector.sidebar).one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function () {
|
580
|
+
this.fix();
|
581
|
+
this.fixSidebar();
|
582
|
+
}.bind(this));
|
583
|
+
}.bind(this));
|
584
|
+
|
585
|
+
this.bindedResize = true;
|
586
|
+
}
|
587
|
+
|
588
|
+
$(Selector.sidebarMenu).on('expanded.tree', function () {
|
589
|
+
this.fix();
|
590
|
+
this.fixSidebar();
|
591
|
+
}.bind(this));
|
592
|
+
|
593
|
+
$(Selector.sidebarMenu).on('collapsed.tree', function () {
|
594
|
+
this.fix();
|
595
|
+
this.fixSidebar();
|
596
|
+
}.bind(this));
|
597
|
+
};
|
598
|
+
|
599
|
+
Layout.prototype.fix = function () {
|
600
|
+
// Remove overflow from .wrapper if layout-boxed exists
|
601
|
+
$(Selector.layoutBoxed + ' > ' + Selector.wrapper).css('overflow', 'hidden');
|
602
|
+
|
603
|
+
// Get window height and the wrapper height
|
604
|
+
var footerHeight = $(Selector.mainFooter).outerHeight() || 0;
|
605
|
+
var neg = $(Selector.mainHeader).outerHeight() + footerHeight;
|
606
|
+
var windowHeight = $(window).height();
|
607
|
+
var sidebarHeight = $(Selector.sidebar).height() || 0;
|
608
|
+
|
609
|
+
// Set the min-height of the content and sidebar based on
|
610
|
+
// the height of the document.
|
611
|
+
if ($('body').hasClass(ClassName.fixed)) {
|
612
|
+
$(Selector.contentWrapper).css('min-height', windowHeight - footerHeight);
|
613
|
+
} else {
|
614
|
+
var postSetHeight;
|
615
|
+
|
616
|
+
if (windowHeight >= sidebarHeight) {
|
617
|
+
$(Selector.contentWrapper).css('min-height', windowHeight - neg);
|
618
|
+
postSetHeight = windowHeight - neg;
|
483
619
|
} else {
|
484
|
-
|
485
|
-
|
486
|
-
_this._fixForContent(sidebar);
|
487
|
-
}
|
620
|
+
$(Selector.contentWrapper).css('min-height', sidebarHeight);
|
621
|
+
postSetHeight = sidebarHeight;
|
488
622
|
}
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
} else {
|
496
|
-
//Push the content by adding the open class to the body instead
|
497
|
-
//of the sidebar itself
|
498
|
-
$('body').addClass('control-sidebar-open');
|
623
|
+
|
624
|
+
// Fix for the control sidebar height
|
625
|
+
var $controlSidebar = $(Selector.controlSidebar);
|
626
|
+
if (typeof $controlSidebar !== 'undefined') {
|
627
|
+
if ($controlSidebar.height() > postSetHeight)
|
628
|
+
$(Selector.contentWrapper).css('min-height', $controlSidebar.height());
|
499
629
|
}
|
500
|
-
}
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
630
|
+
}
|
631
|
+
};
|
632
|
+
|
633
|
+
Layout.prototype.fixSidebar = function () {
|
634
|
+
// Make sure the body tag has the .fixed class
|
635
|
+
if (!$('body').hasClass(ClassName.fixed)) {
|
636
|
+
if (typeof $.fn.slimScroll !== 'undefined') {
|
637
|
+
$(Selector.sidebar).slimScroll({ destroy: true }).height('auto');
|
507
638
|
}
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
if
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
_this.hasBindedResize = true;
|
521
|
-
} else {
|
522
|
-
sidebar.css({
|
523
|
-
'position': 'fixed',
|
524
|
-
'height': 'auto'
|
639
|
+
return;
|
640
|
+
}
|
641
|
+
|
642
|
+
// Enable slimscroll for fixed layout
|
643
|
+
if (this.options.slimscroll) {
|
644
|
+
if (typeof $.fn.slimScroll !== 'undefined') {
|
645
|
+
// Destroy if it exists
|
646
|
+
// $(Selector.sidebar).slimScroll({ destroy: true }).height('auto')
|
647
|
+
|
648
|
+
// Add slimscroll
|
649
|
+
$(Selector.sidebar).slimScroll({
|
650
|
+
height: ($(window).height() - $(Selector.mainHeader).height()) + 'px'
|
525
651
|
});
|
526
652
|
}
|
527
|
-
},
|
528
|
-
_fixForFixed: function (sidebar) {
|
529
|
-
sidebar.css({
|
530
|
-
'position': 'fixed',
|
531
|
-
'max-height': '100%',
|
532
|
-
'overflow': 'auto',
|
533
|
-
'padding-bottom': '50px'
|
534
|
-
});
|
535
|
-
},
|
536
|
-
_fixForContent: function (sidebar) {
|
537
|
-
$(".content-wrapper, .right-side").css('min-height', sidebar.height());
|
538
653
|
}
|
539
654
|
};
|
540
655
|
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
selectors: $.AdminLTE.options.boxWidgetOptions.boxWidgetSelectors,
|
552
|
-
icons: $.AdminLTE.options.boxWidgetOptions.boxWidgetIcons,
|
553
|
-
animationSpeed: $.AdminLTE.options.animationSpeed,
|
554
|
-
activate: function (_box) {
|
555
|
-
var _this = this;
|
556
|
-
if (!_box) {
|
557
|
-
_box = document; // activate all boxes per default
|
656
|
+
// Plugin Definition
|
657
|
+
// =================
|
658
|
+
function Plugin(option) {
|
659
|
+
return this.each(function () {
|
660
|
+
var $this = $(this);
|
661
|
+
var data = $this.data(DataKey);
|
662
|
+
|
663
|
+
if (!data) {
|
664
|
+
var options = $.extend({}, Default, $this.data(), typeof option === 'object' && option);
|
665
|
+
$this.data(DataKey, (data = new Layout(options)));
|
558
666
|
}
|
559
|
-
//Listen for collapse event triggers
|
560
|
-
$(_box).on('click', _this.selectors.collapse, function (e) {
|
561
|
-
e.preventDefault();
|
562
|
-
_this.collapse($(this));
|
563
|
-
});
|
564
667
|
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
},
|
571
|
-
collapse: function (element) {
|
572
|
-
var _this = this;
|
573
|
-
//Find the box parent
|
574
|
-
var box = element.parents(".box").first();
|
575
|
-
//Find the body and the footer
|
576
|
-
var box_content = box.find("> .box-body, > .box-footer, > form >.box-body, > form > .box-footer");
|
577
|
-
if (!box.hasClass("collapsed-box")) {
|
578
|
-
//Convert minus into plus
|
579
|
-
element.children(":first")
|
580
|
-
.removeClass(_this.icons.collapse)
|
581
|
-
.addClass(_this.icons.open);
|
582
|
-
//Hide the content
|
583
|
-
box_content.slideUp(_this.animationSpeed, function () {
|
584
|
-
box.addClass("collapsed-box");
|
585
|
-
});
|
586
|
-
} else {
|
587
|
-
//Convert plus into minus
|
588
|
-
element.children(":first")
|
589
|
-
.removeClass(_this.icons.open)
|
590
|
-
.addClass(_this.icons.collapse);
|
591
|
-
//Show the content
|
592
|
-
box_content.slideDown(_this.animationSpeed, function () {
|
593
|
-
box.removeClass("collapsed-box");
|
594
|
-
});
|
668
|
+
if (typeof option === 'string') {
|
669
|
+
if (typeof data[option] === 'undefined') {
|
670
|
+
throw new Error('No method named ' + option);
|
671
|
+
}
|
672
|
+
data[option]();
|
595
673
|
}
|
596
|
-
}
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
674
|
+
});
|
675
|
+
}
|
676
|
+
|
677
|
+
var old = $.fn.layout;
|
678
|
+
|
679
|
+
$.fn.layout = Plugin;
|
680
|
+
$.fn.layout.Constuctor = Layout;
|
681
|
+
|
682
|
+
// No conflict mode
|
683
|
+
// ================
|
684
|
+
$.fn.layout.noConflict = function () {
|
685
|
+
$.fn.layout = old;
|
686
|
+
return this;
|
602
687
|
};
|
603
|
-
}
|
604
688
|
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
689
|
+
// Layout DATA-API
|
690
|
+
// ===============
|
691
|
+
$(window).on('load', function () {
|
692
|
+
Plugin.call($('body'));
|
693
|
+
});
|
694
|
+
}(jQuery);
|
695
|
+
|
610
696
|
|
611
|
-
/*
|
612
|
-
*
|
613
|
-
*
|
614
|
-
* This is a custom plugin to use with the component BOX. It allows you to add
|
615
|
-
* a refresh button to the box. It converts the box's state to a loading state.
|
697
|
+
/* PushMenu()
|
698
|
+
* ==========
|
699
|
+
* Adds the push menu functionality to the sidebar.
|
616
700
|
*
|
617
|
-
* @
|
618
|
-
*
|
701
|
+
* @usage: $('.btn').pushMenu(options)
|
702
|
+
* or add [data-toggle="push-menu"] to any button
|
703
|
+
* Pass any option as data-option="value"
|
619
704
|
*/
|
620
|
-
|
705
|
+
+function ($) {
|
706
|
+
'use strict';
|
621
707
|
|
622
|
-
|
708
|
+
var DataKey = 'lte.pushmenu';
|
623
709
|
|
624
|
-
|
710
|
+
var Default = {
|
711
|
+
collapseScreenSize : 767,
|
712
|
+
expandOnHover : false,
|
713
|
+
expandTransitionDelay: 200
|
714
|
+
};
|
625
715
|
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
return box;
|
638
|
-
} //When the source has been loaded
|
716
|
+
var Selector = {
|
717
|
+
collapsed : '.sidebar-collapse',
|
718
|
+
open : '.sidebar-open',
|
719
|
+
mainSidebar : '.main-sidebar',
|
720
|
+
contentWrapper: '.content-wrapper',
|
721
|
+
searchInput : '.sidebar-form .form-control',
|
722
|
+
button : '[data-toggle="push-menu"]',
|
723
|
+
mini : '.sidebar-mini',
|
724
|
+
expanded : '.sidebar-expanded-on-hover',
|
725
|
+
layoutFixed : '.fixed'
|
726
|
+
};
|
639
727
|
|
640
|
-
|
728
|
+
var ClassName = {
|
729
|
+
collapsed : 'sidebar-collapse',
|
730
|
+
open : 'sidebar-open',
|
731
|
+
mini : 'sidebar-mini',
|
732
|
+
expanded : 'sidebar-expanded-on-hover',
|
733
|
+
expandFeature: 'sidebar-mini-expand-feature',
|
734
|
+
layoutFixed : 'fixed'
|
735
|
+
};
|
641
736
|
|
642
|
-
|
643
|
-
|
737
|
+
var Event = {
|
738
|
+
expanded : 'expanded.pushMenu',
|
739
|
+
collapsed: 'collapsed.pushMenu'
|
740
|
+
};
|
644
741
|
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
742
|
+
// PushMenu Class Definition
|
743
|
+
// =========================
|
744
|
+
var PushMenu = function (options) {
|
745
|
+
this.options = options;
|
746
|
+
this.init();
|
747
|
+
};
|
748
|
+
|
749
|
+
PushMenu.prototype.init = function () {
|
750
|
+
if (this.options.expandOnHover
|
751
|
+
|| ($('body').is(Selector.mini + Selector.layoutFixed))) {
|
752
|
+
this.expandOnHover();
|
753
|
+
$('body').addClass(ClassName.expandFeature);
|
754
|
+
}
|
755
|
+
|
756
|
+
$(Selector.contentWrapper).click(function () {
|
757
|
+
// Enable hide menu when clicking on the content-wrapper on small screens
|
758
|
+
if ($(window).width() <= this.options.collapseScreenSize && $('body').hasClass(ClassName.open)) {
|
759
|
+
this.close();
|
652
760
|
}
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
//On trigger click
|
659
|
-
rBtn.on('click', function (e) {
|
660
|
-
e.preventDefault();
|
661
|
-
//Add loading overlay
|
662
|
-
start(box);
|
663
|
-
|
664
|
-
//Perform ajax call
|
665
|
-
box.find(".box-body").load(settings.source, function () {
|
666
|
-
done(box);
|
667
|
-
});
|
668
|
-
});
|
761
|
+
}.bind(this));
|
762
|
+
|
763
|
+
// __Fix for android devices
|
764
|
+
$(Selector.searchInput).click(function (e) {
|
765
|
+
e.stopPropagation();
|
669
766
|
});
|
767
|
+
};
|
670
768
|
|
671
|
-
|
672
|
-
|
673
|
-
|
769
|
+
PushMenu.prototype.toggle = function () {
|
770
|
+
var windowWidth = $(window).width();
|
771
|
+
var isOpen = !$('body').hasClass(ClassName.collapsed);
|
674
772
|
|
675
|
-
|
773
|
+
if (windowWidth <= this.options.collapseScreenSize) {
|
774
|
+
isOpen = $('body').hasClass(ClassName.open);
|
676
775
|
}
|
677
776
|
|
678
|
-
|
679
|
-
|
680
|
-
|
777
|
+
if (!isOpen) {
|
778
|
+
this.open();
|
779
|
+
} else {
|
780
|
+
this.close();
|
781
|
+
}
|
782
|
+
};
|
783
|
+
|
784
|
+
PushMenu.prototype.open = function () {
|
785
|
+
var windowWidth = $(window).width();
|
681
786
|
|
682
|
-
|
787
|
+
if (windowWidth > this.options.collapseScreenSize) {
|
788
|
+
$('body').removeClass(ClassName.collapsed)
|
789
|
+
.trigger($.Event(Event.expanded));
|
683
790
|
}
|
791
|
+
else {
|
792
|
+
$('body').addClass(ClassName.open)
|
793
|
+
.trigger($.Event(Event.expanded));
|
794
|
+
}
|
795
|
+
};
|
796
|
+
|
797
|
+
PushMenu.prototype.close = function () {
|
798
|
+
var windowWidth = $(window).width();
|
799
|
+
if (windowWidth > this.options.collapseScreenSize) {
|
800
|
+
$('body').addClass(ClassName.collapsed)
|
801
|
+
.trigger($.Event(Event.collapsed));
|
802
|
+
} else {
|
803
|
+
$('body').removeClass(ClassName.open + ' ' + ClassName.collapsed)
|
804
|
+
.trigger($.Event(Event.collapsed));
|
805
|
+
}
|
806
|
+
};
|
807
|
+
|
808
|
+
PushMenu.prototype.expandOnHover = function () {
|
809
|
+
$(Selector.mainSidebar).hover(function () {
|
810
|
+
if ($('body').is(Selector.mini + Selector.collapsed)
|
811
|
+
&& $(window).width() > this.options.collapseScreenSize) {
|
812
|
+
this.expand();
|
813
|
+
}
|
814
|
+
}.bind(this), function () {
|
815
|
+
if ($('body').is(Selector.expanded)) {
|
816
|
+
this.collapse();
|
817
|
+
}
|
818
|
+
}.bind(this));
|
819
|
+
};
|
820
|
+
|
821
|
+
PushMenu.prototype.expand = function () {
|
822
|
+
setTimeout(function () {
|
823
|
+
$('body').removeClass(ClassName.collapsed)
|
824
|
+
.addClass(ClassName.expanded);
|
825
|
+
}, this.options.expandTransitionDelay);
|
826
|
+
};
|
827
|
+
|
828
|
+
PushMenu.prototype.collapse = function () {
|
829
|
+
setTimeout(function () {
|
830
|
+
$('body').removeClass(ClassName.expanded)
|
831
|
+
.addClass(ClassName.collapsed);
|
832
|
+
}, this.options.expandTransitionDelay);
|
833
|
+
};
|
834
|
+
|
835
|
+
// PushMenu Plugin Definition
|
836
|
+
// ==========================
|
837
|
+
function Plugin(option) {
|
838
|
+
return this.each(function () {
|
839
|
+
var $this = $(this);
|
840
|
+
var data = $this.data(DataKey);
|
841
|
+
|
842
|
+
if (!data) {
|
843
|
+
var options = $.extend({}, Default, $this.data(), typeof option == 'object' && option);
|
844
|
+
$this.data(DataKey, (data = new PushMenu(options)));
|
845
|
+
}
|
684
846
|
|
847
|
+
if (option === 'toggle') data.toggle();
|
848
|
+
});
|
849
|
+
}
|
850
|
+
|
851
|
+
var old = $.fn.pushMenu;
|
852
|
+
|
853
|
+
$.fn.pushMenu = Plugin;
|
854
|
+
$.fn.pushMenu.Constructor = PushMenu;
|
855
|
+
|
856
|
+
// No Conflict Mode
|
857
|
+
// ================
|
858
|
+
$.fn.pushMenu.noConflict = function () {
|
859
|
+
$.fn.pushMenu = old;
|
860
|
+
return this;
|
685
861
|
};
|
686
862
|
|
687
|
-
|
863
|
+
// Data API
|
864
|
+
// ========
|
865
|
+
$(document).on('click', Selector.button, function (e) {
|
866
|
+
e.preventDefault();
|
867
|
+
Plugin.call($(this), 'toggle');
|
868
|
+
});
|
869
|
+
$(window).on('load', function () {
|
870
|
+
Plugin.call($(Selector.button));
|
871
|
+
});
|
872
|
+
}(jQuery);
|
873
|
+
|
688
874
|
|
689
|
-
/*
|
690
|
-
*
|
691
|
-
*
|
692
|
-
* This is a custom plugin to use with the component BOX. It allows you to activate
|
693
|
-
* a box inserted in the DOM after the app.js was loaded, toggle and remove box.
|
875
|
+
/* TodoList()
|
876
|
+
* =========
|
877
|
+
* Converts a list into a todoList.
|
694
878
|
*
|
695
|
-
* @
|
696
|
-
*
|
697
|
-
*
|
698
|
-
* @usage $("#box-widget").removeBox();
|
879
|
+
* @Usage: $('.my-list').todoList(options)
|
880
|
+
* or add [data-widget="todo-list"] to the ul element
|
881
|
+
* Pass any option as data-option="value"
|
699
882
|
*/
|
700
|
-
|
701
|
-
|
883
|
+
+function ($) {
|
702
884
|
'use strict';
|
703
885
|
|
704
|
-
|
705
|
-
|
886
|
+
var DataKey = 'lte.todolist';
|
887
|
+
|
888
|
+
var Default = {
|
889
|
+
onCheck : function (item) {
|
890
|
+
return item;
|
891
|
+
},
|
892
|
+
onUnCheck: function (item) {
|
893
|
+
return item;
|
894
|
+
}
|
895
|
+
};
|
896
|
+
|
897
|
+
var Selector = {
|
898
|
+
data: '[data-widget="todo-list"]'
|
899
|
+
};
|
900
|
+
|
901
|
+
var ClassName = {
|
902
|
+
done: 'done'
|
903
|
+
};
|
904
|
+
|
905
|
+
// TodoList Class Definition
|
906
|
+
// =========================
|
907
|
+
var TodoList = function (element, options) {
|
908
|
+
this.element = element;
|
909
|
+
this.options = options;
|
910
|
+
|
911
|
+
this._setUpListeners();
|
912
|
+
};
|
913
|
+
|
914
|
+
TodoList.prototype.toggle = function (item) {
|
915
|
+
item.parents(Selector.li).first().toggleClass(ClassName.done);
|
916
|
+
if (!item.prop('checked')) {
|
917
|
+
this.unCheck(item);
|
918
|
+
return;
|
919
|
+
}
|
920
|
+
|
921
|
+
this.check(item);
|
706
922
|
};
|
707
923
|
|
708
|
-
|
709
|
-
|
710
|
-
$.AdminLTE.boxWidget.collapse(button);
|
924
|
+
TodoList.prototype.check = function (item) {
|
925
|
+
this.options.onCheck.call(item);
|
711
926
|
};
|
712
927
|
|
713
|
-
|
714
|
-
|
715
|
-
$.AdminLTE.boxWidget.remove(button);
|
928
|
+
TodoList.prototype.unCheck = function (item) {
|
929
|
+
this.options.onUnCheck.call(item);
|
716
930
|
};
|
717
931
|
|
718
|
-
|
932
|
+
// Private
|
719
933
|
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
934
|
+
TodoList.prototype._setUpListeners = function () {
|
935
|
+
var that = this;
|
936
|
+
$(this.element).on('change ifChanged', 'input:checkbox', function () {
|
937
|
+
that.toggle($(this));
|
938
|
+
});
|
939
|
+
};
|
940
|
+
|
941
|
+
// Plugin Definition
|
942
|
+
// =================
|
943
|
+
function Plugin(option) {
|
944
|
+
return this.each(function () {
|
945
|
+
var $this = $(this);
|
946
|
+
var data = $this.data(DataKey);
|
947
|
+
|
948
|
+
if (!data) {
|
949
|
+
var options = $.extend({}, Default, $this.data(), typeof option == 'object' && option);
|
950
|
+
$this.data(DataKey, (data = new TodoList($this, options)));
|
951
|
+
}
|
952
|
+
|
953
|
+
if (typeof data == 'string') {
|
954
|
+
if (typeof data[option] == 'undefined') {
|
955
|
+
throw new Error('No method named ' + option);
|
956
|
+
}
|
957
|
+
data[option]();
|
958
|
+
}
|
959
|
+
});
|
960
|
+
}
|
961
|
+
|
962
|
+
var old = $.fn.todoList;
|
963
|
+
|
964
|
+
$.fn.todoList = Plugin;
|
965
|
+
$.fn.todoList.Constructor = TodoList;
|
966
|
+
|
967
|
+
// No Conflict Mode
|
968
|
+
// ================
|
969
|
+
$.fn.todoList.noConflict = function () {
|
970
|
+
$.fn.todoList = old;
|
971
|
+
return this;
|
972
|
+
};
|
973
|
+
|
974
|
+
// TodoList Data API
|
975
|
+
// =================
|
976
|
+
$(window).on('load', function () {
|
977
|
+
$(Selector.data).each(function () {
|
978
|
+
Plugin.call($(this));
|
979
|
+
});
|
980
|
+
});
|
981
|
+
|
982
|
+
}(jQuery);
|
983
|
+
|
984
|
+
|
985
|
+
/* Tree()
|
986
|
+
* ======
|
987
|
+
* Converts a nested list into a multilevel
|
988
|
+
* tree view menu.
|
724
989
|
*
|
725
|
-
* @
|
726
|
-
*
|
990
|
+
* @Usage: $('.my-menu').tree(options)
|
991
|
+
* or add [data-widget="tree"] to the ul element
|
992
|
+
* Pass any option as data-option="value"
|
727
993
|
*/
|
728
|
-
|
729
|
-
|
994
|
+
+function ($) {
|
730
995
|
'use strict';
|
731
996
|
|
732
|
-
|
733
|
-
// Render options
|
734
|
-
var settings = $.extend({
|
735
|
-
//When the user checks the input
|
736
|
-
onCheck: function (ele) {
|
737
|
-
return ele;
|
738
|
-
},
|
739
|
-
//When the user unchecks the input
|
740
|
-
onUncheck: function (ele) {
|
741
|
-
return ele;
|
742
|
-
}
|
743
|
-
}, options);
|
997
|
+
var DataKey = 'lte.tree';
|
744
998
|
|
745
|
-
|
999
|
+
var Default = {
|
1000
|
+
animationSpeed: 500,
|
1001
|
+
accordion : true,
|
1002
|
+
followLink : false,
|
1003
|
+
trigger : '.treeview a'
|
1004
|
+
};
|
746
1005
|
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
1006
|
+
var Selector = {
|
1007
|
+
tree : '.tree',
|
1008
|
+
treeview : '.treeview',
|
1009
|
+
treeviewMenu: '.treeview-menu',
|
1010
|
+
open : '.menu-open, .active',
|
1011
|
+
li : 'li',
|
1012
|
+
data : '[data-widget="tree"]',
|
1013
|
+
active : '.active'
|
1014
|
+
};
|
753
1015
|
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
1016
|
+
var ClassName = {
|
1017
|
+
open: 'menu-open',
|
1018
|
+
tree: 'tree'
|
1019
|
+
};
|
1020
|
+
|
1021
|
+
var Event = {
|
1022
|
+
collapsed: 'collapsed.tree',
|
1023
|
+
expanded : 'expanded.tree'
|
1024
|
+
};
|
1025
|
+
|
1026
|
+
// Tree Class Definition
|
1027
|
+
// =====================
|
1028
|
+
var Tree = function (element, options) {
|
1029
|
+
this.element = element;
|
1030
|
+
this.options = options;
|
1031
|
+
|
1032
|
+
$(this.element).addClass(ClassName.tree);
|
1033
|
+
|
1034
|
+
$(Selector.treeview + Selector.active, this.element).addClass(ClassName.open);
|
1035
|
+
|
1036
|
+
this._setUpListeners();
|
1037
|
+
};
|
1038
|
+
|
1039
|
+
Tree.prototype.toggle = function (link, event) {
|
1040
|
+
var treeviewMenu = link.next(Selector.treeviewMenu);
|
1041
|
+
var parentLi = link.parent();
|
1042
|
+
var isOpen = parentLi.hasClass(ClassName.open);
|
1043
|
+
|
1044
|
+
if (!parentLi.is(Selector.treeview)) {
|
1045
|
+
return;
|
1046
|
+
}
|
1047
|
+
|
1048
|
+
if (!this.options.followLink || link.attr('href') === '#') {
|
1049
|
+
event.preventDefault();
|
1050
|
+
}
|
1051
|
+
|
1052
|
+
if (isOpen) {
|
1053
|
+
this.collapse(treeviewMenu, parentLi);
|
1054
|
+
} else {
|
1055
|
+
this.expand(treeviewMenu, parentLi);
|
1056
|
+
}
|
1057
|
+
};
|
1058
|
+
|
1059
|
+
Tree.prototype.expand = function (tree, parent) {
|
1060
|
+
var expandedEvent = $.Event(Event.expanded);
|
1061
|
+
|
1062
|
+
if (this.options.accordion) {
|
1063
|
+
var openMenuLi = parent.siblings(Selector.open);
|
1064
|
+
var openTree = openMenuLi.children(Selector.treeviewMenu);
|
1065
|
+
this.collapse(openTree, openMenuLi);
|
1066
|
+
}
|
1067
|
+
|
1068
|
+
parent.addClass(ClassName.open);
|
1069
|
+
tree.slideDown(this.options.animationSpeed, function () {
|
1070
|
+
$(this.element).trigger(expandedEvent);
|
1071
|
+
}.bind(this));
|
1072
|
+
};
|
1073
|
+
|
1074
|
+
Tree.prototype.collapse = function (tree, parentLi) {
|
1075
|
+
var collapsedEvent = $.Event(Event.collapsed);
|
1076
|
+
|
1077
|
+
tree.find(Selector.open).removeClass(ClassName.open);
|
1078
|
+
parentLi.removeClass(ClassName.open);
|
1079
|
+
tree.slideUp(this.options.animationSpeed, function () {
|
1080
|
+
tree.find(Selector.open + ' > ' + Selector.treeview).slideUp();
|
1081
|
+
$(this.element).trigger(collapsedEvent);
|
1082
|
+
}.bind(this));
|
1083
|
+
};
|
1084
|
+
|
1085
|
+
// Private
|
1086
|
+
|
1087
|
+
Tree.prototype._setUpListeners = function () {
|
1088
|
+
var that = this;
|
1089
|
+
|
1090
|
+
$(this.element).on('click', this.options.trigger, function (event) {
|
1091
|
+
that.toggle($(this), event);
|
1092
|
+
});
|
1093
|
+
};
|
1094
|
+
|
1095
|
+
// Plugin Definition
|
1096
|
+
// =================
|
1097
|
+
function Plugin(option) {
|
1098
|
+
return this.each(function () {
|
1099
|
+
var $this = $(this);
|
1100
|
+
var data = $this.data(DataKey);
|
1101
|
+
|
1102
|
+
if (!data) {
|
1103
|
+
var options = $.extend({}, Default, $this.data(), typeof option == 'object' && option);
|
1104
|
+
$this.data(DataKey, new Tree($this, options));
|
769
1105
|
}
|
770
1106
|
});
|
1107
|
+
}
|
1108
|
+
|
1109
|
+
var old = $.fn.tree;
|
1110
|
+
|
1111
|
+
$.fn.tree = Plugin;
|
1112
|
+
$.fn.tree.Constructor = Tree;
|
1113
|
+
|
1114
|
+
// No Conflict Mode
|
1115
|
+
// ================
|
1116
|
+
$.fn.tree.noConflict = function () {
|
1117
|
+
$.fn.tree = old;
|
1118
|
+
return this;
|
771
1119
|
};
|
772
|
-
|
1120
|
+
|
1121
|
+
// Tree Data API
|
1122
|
+
// =============
|
1123
|
+
$(window).on('load', function () {
|
1124
|
+
$(Selector.data).each(function () {
|
1125
|
+
Plugin.call($(this));
|
1126
|
+
});
|
1127
|
+
});
|
1128
|
+
|
1129
|
+
}(jQuery);
|