adminlte_theme 0.1.0

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