adminlte2-rails 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -1
  3. data/lib/adminlte2/rails/version.rb +1 -1
  4. data/lib/generators/admin_lte2/templates/_admin_lte_2_header.html.erb +9 -1
  5. data/lib/generators/admin_lte2/templates/_admin_lte_2_sidebar.html.erb +7 -7
  6. data/lib/generators/admin_lte2/templates/admin_lte_2.html.erb +65 -4
  7. data/vendor/assets/javascripts/app.js +472 -267
  8. data/vendor/assets/stylesheets/AdminLTE/AdminLTE.css +457 -410
  9. data/vendor/assets/stylesheets/AdminLTE/skins/_all-skins.css +1057 -146
  10. data/vendor/assets/stylesheets/AdminLTE/skins/_all-skins.min.css +1 -1
  11. data/vendor/assets/stylesheets/AdminLTE/skins/skin-black-light.css +175 -0
  12. data/vendor/assets/stylesheets/AdminLTE/skins/skin-black-light.min.css +1 -0
  13. data/vendor/assets/stylesheets/AdminLTE/skins/skin-black.css +27 -39
  14. data/vendor/assets/stylesheets/AdminLTE/skins/skin-black.min.css +1 -1
  15. data/vendor/assets/stylesheets/AdminLTE/skins/skin-blue-light.css +166 -0
  16. data/vendor/assets/stylesheets/AdminLTE/skins/skin-blue-light.min.css +1 -0
  17. data/vendor/assets/stylesheets/AdminLTE/skins/skin-blue.css +11 -21
  18. data/vendor/assets/stylesheets/AdminLTE/skins/skin-blue.min.css +1 -1
  19. data/vendor/assets/stylesheets/AdminLTE/skins/skin-green-light.css +155 -0
  20. data/vendor/assets/stylesheets/AdminLTE/skins/skin-green-light.min.css +1 -0
  21. data/vendor/assets/stylesheets/AdminLTE/skins/skin-green.css +10 -17
  22. data/vendor/assets/stylesheets/AdminLTE/skins/skin-green.min.css +1 -1
  23. data/vendor/assets/stylesheets/AdminLTE/skins/skin-purple-light.css +155 -0
  24. data/vendor/assets/stylesheets/AdminLTE/skins/skin-purple-light.min.css +1 -0
  25. data/vendor/assets/stylesheets/AdminLTE/skins/skin-purple.css +10 -17
  26. data/vendor/assets/stylesheets/AdminLTE/skins/skin-purple.min.css +1 -1
  27. data/vendor/assets/stylesheets/AdminLTE/skins/skin-red-light.css +155 -0
  28. data/vendor/assets/stylesheets/AdminLTE/skins/skin-red-light.min.css +1 -0
  29. data/vendor/assets/stylesheets/AdminLTE/skins/skin-red.css +10 -17
  30. data/vendor/assets/stylesheets/AdminLTE/skins/skin-red.min.css +1 -1
  31. data/vendor/assets/stylesheets/AdminLTE/skins/skin-yellow-light.css +155 -0
  32. data/vendor/assets/stylesheets/AdminLTE/skins/skin-yellow-light.min.css +1 -0
  33. data/vendor/assets/stylesheets/AdminLTE/skins/skin-yellow.css +10 -17
  34. data/vendor/assets/stylesheets/AdminLTE/skins/skin-yellow.min.css +1 -1
  35. metadata +13 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10a368779e6b3e376e246f5de6875b7c07fad726
4
- data.tar.gz: d9bce280e352957869e9fe3c3a075e40b2963f63
3
+ metadata.gz: c572cbc8c12791d3fc726536f67ad3c1507d0f77
4
+ data.tar.gz: d965133c397d915618115b5b843d55411305eb90
5
5
  SHA512:
6
- metadata.gz: d56312bfb81b07322786648ab5d288aee303844e55e9d0453ad096400996ca87edb41421c1323e5889143f1cfb7571d28580f4985fe1d00755c84bed6c574e9f
7
- data.tar.gz: 704ac14d33d0583da98c970c23757666c8f35b95932626b23c0e2fbc482596000197a40c48d7fbd21b4e9d0652ed5c10cd5c729a3bdac409eedd0837dcc24504
6
+ metadata.gz: 521396842262051e20941be07e7ce87e5f6ea14c2d020368a46183add93adc8ec36acf6fc0ab5a73def3cc812297be474e054228f8a3a82e0b4663a7fe35fab8
7
+ data.tar.gz: f70bfb63e519a53c90e4c2edae10902c278b8413fbdadc7b2748cf8aeded5c601de2894b9653636f511242ea31d0f9dab6fb103d22c875360c8428fe63c944a5
@@ -1,4 +1,10 @@
1
- ## 0.0.4 (WIP)
1
+ ## 0.0.6 (WIP)
2
+
3
+ ## 0.0.5
4
+ - Update HTML / JS / CSS to AdminLTE 2.1.0
5
+ - Add Sidebar introduced in AdminteLTE 2.1.0
6
+
7
+ ## 0.0.4
2
8
  - Layout: add alert
3
9
  - Layout: Add controller / action name to body
4
10
  - New plugins:
@@ -1,5 +1,5 @@
1
1
  module AdminLTE2
2
2
  module Rails
3
- VERSION = '0.0.4'
3
+ VERSION = '0.0.5'
4
4
  end
5
5
  end
@@ -2,7 +2,12 @@
2
2
  <header class="main-header">
3
3
 
4
4
  <!-- Logo -->
5
- <a href="/" class="logo"><b>Admin</b>LTE</a>
5
+ <a href="/" class="logo">
6
+ <!-- mini logo for sidebar mini 50x50 pixels -->
7
+ <span class="logo-mini"><b>A</b>LT</span>
8
+ <!-- logo for regular state and mobile devices -->
9
+ <span class="logo-lg"><b>Admin</b>LTE</span>
10
+ </a>
6
11
 
7
12
  <!-- Header Navbar -->
8
13
  <nav class="navbar navbar-static-top" role="navigation">
@@ -144,6 +149,9 @@
144
149
  </li>
145
150
  </ul>
146
151
  </li>
152
+ <li>
153
+ <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
154
+ </li>
147
155
  </ul>
148
156
  </div>
149
157
  </nav>
@@ -20,9 +20,9 @@
20
20
  <form action="#" method="get" class="sidebar-form">
21
21
  <div class="input-group">
22
22
  <input type="text" name="q" class="form-control" placeholder="Search..."/>
23
- <span class="input-group-btn">
24
- <button type='submit' name='search' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i></button>
25
- </span>
23
+ <span class="input-group-btn">
24
+ <button type='submit' name='search' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i></button>
25
+ </span>
26
26
  </div>
27
27
  </form>
28
28
  <!-- /.search form -->
@@ -30,11 +30,11 @@
30
30
  <!-- Sidebar Menu -->
31
31
  <ul class="sidebar-menu">
32
32
  <li class="header">HEADER</li>
33
- <!-- Optionally, you can add icons to the links -->
34
- <li class="active"><a href="#"><span>Link</span></a><</li>
35
- <li><a href="#"><span>Another Link</span></a></li>
33
+ <!-- Optionally, you can add icons to the links -->
34
+ <li class="active"><a href="#"><i class='fa fa-link'></i> <span>Link</span></a></li>
35
+ <li><a href="#"><i class='fa fa-link'></i> <span>Another Link</span></a></li>
36
36
  <li class="treeview">
37
- <a href="#"><span>Multilevel</span> <i class="fa fa-angle-left pull-right"></i></a>
37
+ <a href="#"><i class='fa fa-link'></i> <span>Multilevel</span> <i class="fa fa-angle-left pull-right"></i></a>
38
38
  <ul class="treeview-menu">
39
39
  <li><a href="#">Link in level 2</a></li>
40
40
  <li><a href="#">Link in level 2</a></li>
@@ -5,18 +5,18 @@
5
5
  <title>AdminLTE 2 | Dashboard</title>
6
6
  <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
7
7
  <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
8
- <link href="http://code.ionicframework.com/ionicons/2.0.0/css/ionicons.min.css" rel="stylesheet" type="text/css" />
8
+ <link href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet" type="text/css" />
9
9
  <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
10
10
  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
11
11
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
12
12
  <!--[if lt IE 9]>
13
- <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
14
- <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
13
+ <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.2/html5shiv.js"></script>
14
+ <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
15
15
  <![endif]-->
16
16
  <%= csrf_meta_tags %>
17
17
  </head>
18
18
 
19
- <body class="skin-blue fixed <%= params[:controller].parameterize %> <%= action_name %>">
19
+ <body class="skin-blue sidebar-mini fixed <%= params[:controller].parameterize %> <%= action_name %>">
20
20
  <div class="wrapper">
21
21
 
22
22
  <%= render partial: 'layouts/admin_lte_2_header' %>
@@ -68,6 +68,67 @@
68
68
  <strong>Copyright &copy; 2015 <a href="#">Company</a>.</strong> All rights reserved.
69
69
  </footer>
70
70
 
71
+ <aside class="control-sidebar control-sidebar-dark">
72
+ <!-- Create the tabs -->
73
+ <ul class="nav nav-tabs nav-justified control-sidebar-tabs">
74
+ <li class="active"><a href="#control-sidebar-home-tab" data-toggle="tab" aria-expanded="true"><i class="fa fa-home"></i></a></li>
75
+ <li class=""><a href="#control-sidebar-settings-tab" data-toggle="tab" aria-expanded="false"><i class="fa fa-gears"></i></a></li>
76
+ </ul>
77
+ <!-- Tab panes -->
78
+ <div class="tab-content">
79
+ <!-- Home tab content -->
80
+ <div class="tab-pane active" id="control-sidebar-home-tab">
81
+ <h3 class="control-sidebar-heading">Recent Activity</h3>
82
+ <ul class="control-sidebar-menu">
83
+ <li>
84
+ <a href="javascript::;">
85
+ <i class="menu-icon fa fa-birthday-cake bg-red"></i>
86
+ <div class="menu-info">
87
+ <h4 class="control-sidebar-subheading">Langdon's Birthday</h4>
88
+ <p>Will be 23 on April 24th</p>
89
+ </div>
90
+ </a>
91
+ </li>
92
+ </ul><!-- /.control-sidebar-menu -->
93
+
94
+ <h3 class="control-sidebar-heading">Tasks Progress</h3>
95
+ <ul class="control-sidebar-menu">
96
+ <li>
97
+ <a href="javascript::;">
98
+ <h4 class="control-sidebar-subheading">
99
+ Custom Template Design
100
+ <span class="label label-danger pull-right">70%</span>
101
+ </h4>
102
+ <div class="progress progress-xxs">
103
+ <div class="progress-bar progress-bar-danger" style="width: 70%"></div>
104
+ </div>
105
+ </a>
106
+ </li>
107
+ </ul><!-- /.control-sidebar-menu -->
108
+
109
+ </div><!-- /.tab-pane -->
110
+ <!-- Stats tab content -->
111
+ <div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div><!-- /.tab-pane -->
112
+ <!-- Settings tab content -->
113
+ <div class="tab-pane" id="control-sidebar-settings-tab">
114
+ <form method="post">
115
+ <h3 class="control-sidebar-heading">General Settings</h3>
116
+ <div class="form-group">
117
+ <label class="control-sidebar-subheading">
118
+ Report panel usage
119
+ <input type="checkbox" class="pull-right" checked="">
120
+ </label>
121
+ <p>
122
+ Some information about this general settings option
123
+ </p>
124
+ </div><!-- /.form-group -->
125
+ </form>
126
+ </div><!-- /.tab-pane -->
127
+ </div>
128
+ </aside>
129
+
130
+ <div class="control-sidebar-bg" style="position: fixed; height: auto;"></div>
131
+
71
132
  </div><!-- ./wrapper -->
72
133
 
73
134
  <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
@@ -7,7 +7,7 @@
7
7
  * @Author Almsaeed Studio
8
8
  * @Support <http://www.almsaeedstudio.com>
9
9
  * @Email <support@almsaeedstudio.com>
10
- * @version 2.0.3
10
+ * @version 2.1.0
11
11
  * @license MIT <http://opensource.org/licenses/MIT>
12
12
  */
13
13
 
@@ -41,12 +41,20 @@ $.AdminLTE.options = {
41
41
  navbarMenuSlimscroll: true,
42
42
  navbarMenuSlimscrollWidth: "3px", //The width of the scroll bar
43
43
  navbarMenuHeight: "200px", //The height of the inner menu
44
+ //General animation speed for JS animated elements such as box collapse/expand and
45
+ //sidebar treeview slide up/down. This options accepts an integer as milliseconds,
46
+ //'fast', 'normal', or 'slow'
47
+ animationSpeed: 500,
44
48
  //Sidebar push menu toggle button selector
45
49
  sidebarToggleSelector: "[data-toggle='offcanvas']",
46
50
  //Activate sidebar push menu
47
51
  sidebarPushMenu: true,
48
52
  //Activate sidebar slimscroll if the fixed layout is set (requires SlimScroll Plugin)
49
53
  sidebarSlimScroll: true,
54
+ //Enable sidebar expand on hover effect for sidebar mini
55
+ //This option is forced to true if both the fixed layout and sidebar mini
56
+ //are used together
57
+ sidebarExpandOnHover: false,
50
58
  //BoxRefresh Plugin
51
59
  enableBoxRefresh: true,
52
60
  //Bootstrap.js tooltip
@@ -57,18 +65,28 @@ $.AdminLTE.options = {
57
65
  //choose to enable the plugin, make sure you load the script
58
66
  //before AdminLTE's app.js
59
67
  enableFastclick: 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
+ },
60
78
  //Box Widget Plugin. Enable this plugin
61
79
  //to allow boxes to be collapsed and/or removed
62
80
  enableBoxWidget: true,
63
81
  //Box Widget plugin options
64
82
  boxWidgetOptions: {
65
83
  boxWidgetIcons: {
66
- //The icon that triggers the collapse event
67
- collapse: 'fa fa-minus',
68
- //The icon that trigger the opening event
69
- open: 'fa fa-plus',
70
- //The icon that triggers the removing event
71
- remove: 'fa fa-times'
84
+ //Collapse icon
85
+ collapse: 'fa-minus',
86
+ //Open icon
87
+ open: 'fa-plus',
88
+ //Remove icon
89
+ remove: 'fa-times'
72
90
  },
73
91
  boxWidgetSelectors: {
74
92
  //Remove button selector
@@ -114,218 +132,457 @@ $.AdminLTE.options = {
114
132
  }
115
133
  };
116
134
 
117
- /* ----------------------
118
- * - AdminLTE Functions -
119
- * ----------------------
120
- * All AdminLTE functions are implemented below.
135
+ /* ------------------
136
+ * - Implementation -
137
+ * ------------------
138
+ * The next block of code implements AdminLTE's
139
+ * functions and plugins as specified by the
140
+ * options above.
121
141
  */
142
+ $(function () {
143
+ //Extend options if external options exist
144
+ if (typeof AdminLTEOptions !== "undefined") {
145
+ $.extend(true,
146
+ $.AdminLTE.options,
147
+ AdminLTEOptions);
148
+ }
122
149
 
123
- /* prepareLayout
124
- * =============
125
- * Fixes the layout height in case min-height fails.
126
- *
127
- * @type Object
128
- * @usage $.AdminLTE.layout.activate()
129
- * $.AdminLTE.layout.fix()
130
- * $.AdminLTE.layout.fixSidebar()
150
+ //Easy access to options
151
+ var o = $.AdminLTE.options;
152
+
153
+ //Set up the object
154
+ _init();
155
+
156
+ //Activate the layout maker
157
+ $.AdminLTE.layout.activate();
158
+
159
+ //Enable sidebar tree view controls
160
+ $.AdminLTE.tree('.sidebar');
161
+
162
+ //Enable control sidebar
163
+ if (o.enableControlSidebar) {
164
+ $.AdminLTE.controlSidebar.activate();
165
+ }
166
+
167
+ //Add slimscroll to navbar dropdown
168
+ if (o.navbarMenuSlimscroll && typeof $.fn.slimscroll != 'undefined') {
169
+ $(".navbar .menu").slimscroll({
170
+ height: o.navbarMenuHeight,
171
+ alwaysVisible: false,
172
+ size: o.navbarMenuSlimscrollWidth
173
+ }).css("width", "100%");
174
+ }
175
+
176
+ //Activate sidebar push menu
177
+ if (o.sidebarPushMenu) {
178
+ $.AdminLTE.pushMenu.activate(o.sidebarToggleSelector);
179
+ }
180
+
181
+ //Activate Bootstrap tooltip
182
+ if (o.enableBSToppltip) {
183
+ $('body').tooltip({
184
+ selector: o.BSTooltipSelector
185
+ });
186
+ }
187
+
188
+ //Activate box widget
189
+ if (o.enableBoxWidget) {
190
+ $.AdminLTE.boxWidget.activate();
191
+ }
192
+
193
+ //Activate fast click
194
+ if (o.enableFastclick && typeof FastClick != 'undefined') {
195
+ FastClick.attach(document.body);
196
+ }
197
+
198
+ //Activate direct chat widget
199
+ if (o.directChat.enable) {
200
+ $(o.directChat.contactToggleSelector).on('click', function () {
201
+ var box = $(this).parents('.direct-chat').first();
202
+ box.toggleClass('direct-chat-contacts-open');
203
+ });
204
+ }
205
+
206
+ /*
207
+ * INITIALIZE BUTTON TOGGLE
208
+ * ------------------------
209
+ */
210
+ $('.btn-group[data-toggle="btn-toggle"]').each(function () {
211
+ var group = $(this);
212
+ $(this).find(".btn").on('click', function (e) {
213
+ group.find(".btn.active").removeClass("active");
214
+ $(this).addClass("active");
215
+ e.preventDefault();
216
+ });
217
+
218
+ });
219
+ });
220
+
221
+ /* ----------------------------------
222
+ * - Initialize the AdminLTE Object -
223
+ * ----------------------------------
224
+ * All AdminLTE functions are implemented below.
131
225
  */
132
- $.AdminLTE.layout = {
133
- activate: function () {
134
- var _this = this;
135
- _this.fix();
136
- _this.fixSidebar();
137
- $(window, ".wrapper").resize(function () {
226
+ function _init() {
227
+
228
+ /* Layout
229
+ * ======
230
+ * Fixes the layout height in case min-height fails.
231
+ *
232
+ * @type Object
233
+ * @usage $.AdminLTE.layout.activate()
234
+ * $.AdminLTE.layout.fix()
235
+ * $.AdminLTE.layout.fixSidebar()
236
+ */
237
+ $.AdminLTE.layout = {
238
+ activate: function () {
239
+ var _this = this;
138
240
  _this.fix();
139
241
  _this.fixSidebar();
140
- });
141
- },
142
- fix: function () {
143
- //Get window height and the wrapper height
144
- var neg = $('.main-header').outerHeight() + $('.main-footer').outerHeight();
145
- var window_height = $(window).height();
146
- var sidebar_height = $(".sidebar").height();
147
- //Set the min-height of the content and sidebar based on the
148
- //the height of the document.
149
- if ($("body").hasClass("fixed")) {
150
- $(".content-wrapper, .right-side").css('min-height', window_height - $('.main-footer').outerHeight());
151
- } else {
152
- if (window_height >= sidebar_height) {
153
- $(".content-wrapper, .right-side").css('min-height', window_height - neg);
242
+ $(window, ".wrapper").resize(function () {
243
+ _this.fix();
244
+ _this.fixSidebar();
245
+ });
246
+ },
247
+ fix: function () {
248
+ //Get window height and the wrapper height
249
+ var neg = $('.main-header').outerHeight() + $('.main-footer').outerHeight();
250
+ var window_height = $(window).height();
251
+ var sidebar_height = $(".sidebar").height();
252
+ //Set the min-height of the content and sidebar based on the
253
+ //the height of the document.
254
+ if ($("body").hasClass("fixed")) {
255
+ $(".content-wrapper, .right-side").css('min-height', window_height - $('.main-footer').outerHeight());
154
256
  } else {
155
- $(".content-wrapper, .right-side").css('min-height', sidebar_height);
257
+ var postSetWidth;
258
+ if (window_height >= sidebar_height) {
259
+ $(".content-wrapper, .right-side").css('min-height', window_height - neg);
260
+ postSetWidth = window_height - neg;
261
+ } else {
262
+ $(".content-wrapper, .right-side").css('min-height', sidebar_height);
263
+ postSetWidth = sidebar_height;
264
+ }
265
+
266
+ //Fix for the control sidebar height
267
+ var controlSidebar = $($.AdminLTE.options.controlSidebarOptions.selector);
268
+ if (typeof controlSidebar !== "undefined") {
269
+ if (controlSidebar.height() > postSetWidth)
270
+ $(".content-wrapper, .right-side").css('min-height', controlSidebar.height());
271
+ }
272
+
156
273
  }
157
- }
158
- },
159
- fixSidebar: function () {
160
- //Make sure the body tag has the .fixed class
161
- if (!$("body").hasClass("fixed")) {
162
- if (typeof $.fn.slimScroll != 'undefined') {
163
- $(".sidebar").slimScroll({destroy: true}).height("auto");
274
+ },
275
+ fixSidebar: function () {
276
+ //Make sure the body tag has the .fixed class
277
+ if (!$("body").hasClass("fixed")) {
278
+ if (typeof $.fn.slimScroll != 'undefined') {
279
+ $(".sidebar").slimScroll({destroy: true}).height("auto");
280
+ }
281
+ return;
282
+ } else if (typeof $.fn.slimScroll == 'undefined' && console) {
283
+ console.error("Error: the fixed layout requires the slimscroll plugin!");
164
284
  }
165
- return;
166
- } else if (typeof $.fn.slimScroll == 'undefined' && console) {
167
- console.error("Error: the fixed layout requires the slimscroll plugin!");
168
- }
169
- //Enable slimscroll for fixed layout
170
- if ($.AdminLTE.options.sidebarSlimScroll) {
171
- if (typeof $.fn.slimScroll != 'undefined') {
172
- //Distroy if it exists
173
- $(".sidebar").slimScroll({destroy: true}).height("auto");
174
- //Add slimscroll
175
- $(".sidebar").slimscroll({
176
- height: ($(window).height() - $(".main-header").height()) + "px",
177
- color: "rgba(0,0,0,0.2)",
178
- size: "3px"
179
- });
285
+ //Enable slimscroll for fixed layout
286
+ if ($.AdminLTE.options.sidebarSlimScroll) {
287
+ if (typeof $.fn.slimScroll != 'undefined') {
288
+ //Destroy if it exists
289
+ $(".sidebar").slimScroll({destroy: true}).height("auto");
290
+ //Add slimscroll
291
+ $(".sidebar").slimscroll({
292
+ height: ($(window).height() - $(".main-header").height()) + "px",
293
+ color: "rgba(0,0,0,0.2)",
294
+ size: "3px"
295
+ });
296
+ }
180
297
  }
181
298
  }
182
- }
183
- };
299
+ };
184
300
 
185
- /* PushMenu()
186
- * ==========
187
- * Adds the push menu functionality to the sidebar.
188
- *
189
- * @type Function
190
- * @usage: $.AdminLTE.pushMenu("[data-toggle='offcanvas']")
191
- */
192
- $.AdminLTE.pushMenu = function (toggleBtn) {
193
- //Get the screen sizes
194
- var screenSizes = this.options.screenSizes;
301
+ /* PushMenu()
302
+ * ==========
303
+ * Adds the push menu functionality to the sidebar.
304
+ *
305
+ * @type Function
306
+ * @usage: $.AdminLTE.pushMenu("[data-toggle='offcanvas']")
307
+ */
308
+ $.AdminLTE.pushMenu = {
309
+ activate: function (toggleBtn) {
310
+ //Get the screen sizes
311
+ var screenSizes = $.AdminLTE.options.screenSizes;
195
312
 
196
- //Enable sidebar toggle
197
- $(toggleBtn).click(function (e) {
198
- e.preventDefault();
313
+ //Enable sidebar toggle
314
+ $(toggleBtn).on('click', function (e) {
315
+ e.preventDefault();
199
316
 
200
- //Enable sidebar push menu
201
- if ($(window).width() > (screenSizes.sm - 1)) {
202
- $("body").toggleClass('sidebar-collapse');
203
- }
204
- //Handle sidebar push menu for small screens
205
- else {
206
- if ($("body").hasClass('sidebar-open')) {
207
- $("body").removeClass('sidebar-open');
208
- $("body").removeClass('sidebar-collapse')
209
- } else {
210
- $("body").addClass('sidebar-open');
211
- }
212
- }
213
- });
317
+ //Enable sidebar push menu
318
+ if ($(window).width() > (screenSizes.sm - 1)) {
319
+ $("body").toggleClass('sidebar-collapse');
320
+ }
321
+ //Handle sidebar push menu for small screens
322
+ else {
323
+ if ($("body").hasClass('sidebar-open')) {
324
+ $("body").removeClass('sidebar-open');
325
+ $("body").removeClass('sidebar-collapse')
326
+ } else {
327
+ $("body").addClass('sidebar-open');
328
+ }
329
+ }
330
+ });
214
331
 
215
- $(".content-wrapper").click(function () {
216
- //Enable hide menu when clicking on the content-wrapper on small screens
217
- if ($(window).width() <= (screenSizes.sm - 1) && $("body").hasClass("sidebar-open")) {
218
- $("body").removeClass('sidebar-open');
219
- }
220
- });
332
+ $(".content-wrapper").click(function () {
333
+ //Enable hide menu when clicking on the content-wrapper on small screens
334
+ if ($(window).width() <= (screenSizes.sm - 1) && $("body").hasClass("sidebar-open")) {
335
+ $("body").removeClass('sidebar-open');
336
+ }
337
+ });
221
338
 
222
- };
339
+ //Enable expand on hover for sidebar mini
340
+ if ($.AdminLTE.options.sidebarExpandOnHover
341
+ || ($('body').hasClass('fixed')
342
+ && $('body').hasClass('sidebar-mini'))) {
343
+ this.expandOnHover();
344
+ }
223
345
 
224
- /* Tree()
225
- * ======
226
- * Converts the sidebar into a multilevel
227
- * tree view menu.
228
- *
229
- * @type Function
230
- * @Usage: $.AdminLTE.tree('.sidebar')
231
- */
232
- $.AdminLTE.tree = function (menu) {
233
- var _this = this;
234
-
235
- $("li a", $(menu)).click(function (e) {
236
- //Get the clicked link and the next element
237
- var $this = $(this);
238
- var checkElement = $this.next();
239
-
240
- //Check if the next element is a menu and is visible
241
- if ((checkElement.is('.treeview-menu')) && (checkElement.is(':visible'))) {
242
- //Close the menu
243
- checkElement.slideUp('normal', function () {
244
- checkElement.removeClass('menu-open');
245
- //Fix the layout in case the sidebar stretches over the height of the window
246
- //_this.layout.fix();
247
- });
248
- checkElement.parent("li").removeClass("active");
249
- }
250
- //If the menu is not visible
251
- else if ((checkElement.is('.treeview-menu')) && (!checkElement.is(':visible'))) {
252
- //Get the parent menu
253
- var parent = $this.parents('ul').first();
254
- //Close all open menus within the parent
255
- var ul = parent.find('ul:visible').slideUp('normal');
256
- //Remove the menu-open class from the parent
257
- ul.removeClass('menu-open');
258
- //Get the parent li
259
- var parent_li = $this.parent("li");
260
-
261
- //Open the target menu and add the menu-open class
262
- checkElement.slideDown('normal', function () {
263
- //Add the class active to the parent li
264
- checkElement.addClass('menu-open');
265
- parent.find('li.active').removeClass('active');
266
- parent_li.addClass('active');
267
- //Fix the layout in case the sidebar stretches over the height of the window
268
- _this.layout.fix();
346
+ },
347
+ expandOnHover: function () {
348
+ var _this = this;
349
+ var screenWidth = $.AdminLTE.options.screenSizes.sm - 1;
350
+ //Expand sidebar on hover
351
+ $('.main-sidebar').hover(function () {
352
+ if ($('body').hasClass('sidebar-mini')
353
+ && $("body").hasClass('sidebar-collapse')
354
+ && $(window).width() > screenWidth) {
355
+ _this.expand();
356
+ }
357
+ }, function () {
358
+ if ($('body').hasClass('sidebar-mini')
359
+ && $('body').hasClass('sidebar-expanded-on-hover')
360
+ && $(window).width() > screenWidth) {
361
+ _this.collapse();
362
+ }
269
363
  });
364
+ },
365
+ expand: function () {
366
+ $("body").removeClass('sidebar-collapse').addClass('sidebar-expanded-on-hover');
367
+ },
368
+ collapse: function () {
369
+ if ($('body').hasClass('sidebar-expanded-on-hover')) {
370
+ $('body').removeClass('sidebar-expanded-on-hover').addClass('sidebar-collapse');
371
+ }
270
372
  }
271
- //if this isn't a link, prevent the page from being redirected
272
- if (checkElement.is('.treeview-menu')) {
273
- e.preventDefault();
274
- }
275
- });
276
- };
373
+ };
277
374
 
278
- /* BoxWidget
279
- * =========
280
- * BoxWidget is plugin to handle collapsing and
281
- * removing boxes from the screen.
282
- *
283
- * @type Object
284
- * @usage $.AdminLTE.boxWidget.activate()
285
- * Set all of your option in the main $.AdminLTE.options object
286
- */
287
- $.AdminLTE.boxWidget = {
288
- activate: function () {
289
- var o = $.AdminLTE.options;
375
+ /* Tree()
376
+ * ======
377
+ * Converts the sidebar into a multilevel
378
+ * tree view menu.
379
+ *
380
+ * @type Function
381
+ * @Usage: $.AdminLTE.tree('.sidebar')
382
+ */
383
+ $.AdminLTE.tree = function (menu) {
290
384
  var _this = this;
291
- //Listen for collapse event triggers
292
- $(o.boxWidgetOptions.boxWidgetSelectors.collapse).click(function (e) {
293
- e.preventDefault();
294
- _this.collapse($(this));
385
+ var animationSpeed = $.AdminLTE.options.animationSpeed;
386
+ $("li a", $(menu)).on('click', function (e) {
387
+ //Get the clicked link and the next element
388
+ var $this = $(this);
389
+ var checkElement = $this.next();
390
+
391
+ //Check if the next element is a menu and is visible
392
+ if ((checkElement.is('.treeview-menu')) && (checkElement.is(':visible'))) {
393
+ //Close the menu
394
+ checkElement.slideUp(animationSpeed, function () {
395
+ checkElement.removeClass('menu-open');
396
+ //Fix the layout in case the sidebar stretches over the height of the window
397
+ //_this.layout.fix();
398
+ });
399
+ checkElement.parent("li").removeClass("active");
400
+ }
401
+ //If the menu is not visible
402
+ else if ((checkElement.is('.treeview-menu')) && (!checkElement.is(':visible'))) {
403
+ //Get the parent menu
404
+ var parent = $this.parents('ul').first();
405
+ //Close all open menus within the parent
406
+ var ul = parent.find('ul:visible').slideUp(animationSpeed);
407
+ //Remove the menu-open class from the parent
408
+ ul.removeClass('menu-open');
409
+ //Get the parent li
410
+ var parent_li = $this.parent("li");
411
+
412
+ //Open the target menu and add the menu-open class
413
+ checkElement.slideDown(animationSpeed, function () {
414
+ //Add the class active to the parent li
415
+ checkElement.addClass('menu-open');
416
+ parent.find('li.active').removeClass('active');
417
+ parent_li.addClass('active');
418
+ //Fix the layout in case the sidebar stretches over the height of the window
419
+ _this.layout.fix();
420
+ });
421
+ }
422
+ //if this isn't a link, prevent the page from being redirected
423
+ if (checkElement.is('.treeview-menu')) {
424
+ e.preventDefault();
425
+ }
295
426
  });
427
+ };
296
428
 
297
- //Listen for remove event triggers
298
- $(o.boxWidgetOptions.boxWidgetSelectors.remove).click(function (e) {
299
- e.preventDefault();
300
- _this.remove($(this));
301
- });
302
- },
303
- collapse: function (element) {
304
- //Find the box parent
305
- var box = element.parents(".box").first();
306
- //Find the body and the footer
307
- var bf = box.find(".box-body, .box-footer");
308
- if (!box.hasClass("collapsed-box")) {
309
- //Convert minus into plus
310
- element.children(".fa-minus").removeClass("fa-minus").addClass("fa-plus");
311
- bf.slideUp(300, function () {
312
- box.addClass("collapsed-box");
429
+ /* ControlSidebar
430
+ * ==============
431
+ * Adds functionality to the right sidebar
432
+ *
433
+ * @type Object
434
+ * @usage $.AdminLTE.controlSidebar.activate(options)
435
+ */
436
+ $.AdminLTE.controlSidebar = {
437
+ //instantiate the object
438
+ activate: function () {
439
+ //Get the object
440
+ var _this = this;
441
+ //Update options
442
+ var o = $.AdminLTE.options.controlSidebarOptions;
443
+ //Get the sidebar
444
+ var sidebar = $(o.selector);
445
+ //The toggle button
446
+ var btn = $(o.toggleBtnSelector);
447
+
448
+ //Listen to the click event
449
+ btn.on('click', function (e) {
450
+ e.preventDefault();
451
+ //If the sidebar is not open
452
+ if (!sidebar.hasClass('control-sidebar-open')
453
+ && !$('body').hasClass('control-sidebar-open')) {
454
+ //Open the sidebar
455
+ _this.open(sidebar, o.slide);
456
+ } else {
457
+ _this.close(sidebar, o.slide);
458
+ }
459
+ });
460
+
461
+ //If the body has a boxed layout, fix the sidebar bg position
462
+ var bg = $(".control-sidebar-bg");
463
+ _this._fix(bg);
464
+
465
+ //If the body has a fixed layout, make the control sidebar fixed
466
+ if ($('body').hasClass('fixed')) {
467
+ _this._fixForFixed(sidebar);
468
+ } else {
469
+ //If the content height is less than the sidebar's height, force max height
470
+ if ($('.content-wrapper, .right-side').height() < sidebar.height()) {
471
+ _this._fixForContent(sidebar);
472
+ }
473
+ }
474
+ },
475
+ //Open the control sidebar
476
+ open: function (sidebar, slide) {
477
+ var _this = this;
478
+ //Slide over content
479
+ if (slide) {
480
+ sidebar.addClass('control-sidebar-open');
481
+ } else {
482
+ //Push the content by adding the open class to the body instead
483
+ //of the sidebar itself
484
+ $('body').addClass('control-sidebar-open');
485
+ }
486
+ },
487
+ //Close the control sidebar
488
+ close: function (sidebar, slide) {
489
+ if (slide) {
490
+ sidebar.removeClass('control-sidebar-open');
491
+ } else {
492
+ $('body').removeClass('control-sidebar-open');
493
+ }
494
+ },
495
+ _fix: function (sidebar) {
496
+ var _this = this;
497
+ if ($("body").hasClass('layout-boxed')) {
498
+ sidebar.css('position', 'absolute');
499
+ sidebar.height($(".wrapper").height());
500
+ $(window).resize(function () {
501
+ _this._fix(sidebar);
502
+ });
503
+ } else {
504
+ sidebar.css({
505
+ 'position': 'fixed',
506
+ 'height': 'auto'
507
+ });
508
+ }
509
+ },
510
+ _fixForFixed: function (sidebar) {
511
+ sidebar.css({
512
+ 'position': 'fixed',
513
+ 'max-height': '100%',
514
+ 'overflow': 'auto',
515
+ 'padding-bottom': '50px'
516
+ });
517
+ },
518
+ _fixForContent: function (sidebar) {
519
+ $(".content-wrapper, .right-side").css('min-height', sidebar.height());
520
+ }
521
+ };
522
+
523
+ /* BoxWidget
524
+ * =========
525
+ * BoxWidget is a plugin to handle collapsing and
526
+ * removing boxes from the screen.
527
+ *
528
+ * @type Object
529
+ * @usage $.AdminLTE.boxWidget.activate()
530
+ * Set all your options in the main $.AdminLTE.options object
531
+ */
532
+ $.AdminLTE.boxWidget = {
533
+ selectors: $.AdminLTE.options.boxWidgetOptions.boxWidgetSelectors,
534
+ icons: $.AdminLTE.options.boxWidgetOptions.boxWidgetIcons,
535
+ animationSpeed: $.AdminLTE.options.animationSpeed,
536
+ activate: function (_box) {
537
+ var _this = this;
538
+ if (! _box) {
539
+ _box = document; // activate all boxes per default
540
+ }
541
+ //Listen for collapse event triggers
542
+ $(_box).find(_this.selectors.collapse).on('click', function (e) {
543
+ e.preventDefault();
544
+ _this.collapse($(this));
313
545
  });
314
- } else {
315
- //Convert plus into minus
316
- element.children(".fa-plus").removeClass("fa-plus").addClass("fa-minus");
317
- bf.slideDown(300, function () {
318
- box.removeClass("collapsed-box");
546
+
547
+ //Listen for remove event triggers
548
+ $(_box).find(_this.selectors.remove).on('click', function (e) {
549
+ e.preventDefault();
550
+ _this.remove($(this));
319
551
  });
552
+ },
553
+ collapse: function (element) {
554
+ var _this = this;
555
+ //Find the box parent
556
+ var box = element.parents(".box").first();
557
+ //Find the body and the footer
558
+ var box_content = box.find("> .box-body, > .box-footer");
559
+ if (!box.hasClass("collapsed-box")) {
560
+ //Convert minus into plus
561
+ element.children(":first")
562
+ .removeClass(_this.icons.collapse)
563
+ .addClass(_this.icons.open);
564
+ //Hide the content
565
+ box_content.slideUp(_this.animationSpeed, function () {
566
+ box.addClass("collapsed-box");
567
+ });
568
+ } else {
569
+ //Convert plus into minus
570
+ element.children(":first")
571
+ .removeClass(_this.icons.open)
572
+ .addClass(_this.icons.collapse);
573
+ //Show the content
574
+ box_content.slideDown(_this.animationSpeed, function () {
575
+ box.removeClass("collapsed-box");
576
+ });
577
+ }
578
+ },
579
+ remove: function (element) {
580
+ //Find the box parent
581
+ var box = element.parents(".box").first();
582
+ box.slideUp(this.animationSpeed);
320
583
  }
321
- },
322
- remove: function (element) {
323
- //Find the box parent
324
- var box = element.parents(".box").first();
325
- box.slideUp();
326
- },
327
- options: $.AdminLTE.options.boxWidgetOptions
328
- };
584
+ };
585
+ }
329
586
 
330
587
  /* ------------------
331
588
  * - Custom Plugins -
@@ -336,7 +593,7 @@ $.AdminLTE.boxWidget = {
336
593
  /*
337
594
  * BOX REFRESH BUTTON
338
595
  * ------------------
339
- * This is a custom plugin to use with the compenet BOX. It allows you to add
596
+ * This is a custom plugin to use with the component BOX. It allows you to add
340
597
  * a refresh button to the box. It converts the box's state to a loading state.
341
598
  *
342
599
  * @type plugin
@@ -348,7 +605,7 @@ $.AdminLTE.boxWidget = {
348
605
 
349
606
  // Render options
350
607
  var settings = $.extend({
351
- //Refressh button selector
608
+ //Refresh button selector
352
609
  trigger: ".refresh-btn",
353
610
  //File source to be loaded (e.g: ajax/src.php)
354
611
  source: "",
@@ -377,7 +634,7 @@ $.AdminLTE.boxWidget = {
377
634
  var rBtn = box.find(settings.trigger).first();
378
635
 
379
636
  //On trigger click
380
- rBtn.click(function (e) {
637
+ rBtn.on('click', function (e) {
381
638
  e.preventDefault();
382
639
  //Add loading overlay
383
640
  start(box);
@@ -407,6 +664,23 @@ $.AdminLTE.boxWidget = {
407
664
 
408
665
  })(jQuery);
409
666
 
667
+ /*
668
+ * EXPLICIT BOX ACTIVATION
669
+ * -----------------------
670
+ * This is a custom plugin to use with the component BOX. It allows you to activate
671
+ * a box inserted in the DOM after the app.js was loaded.
672
+ *
673
+ * @type plugin
674
+ * @usage $("#box-widget").activateBox();
675
+ */
676
+ (function ($) {
677
+
678
+ $.fn.activateBox = function () {
679
+ $.AdminLTE.boxWidget.activate(this);
680
+ };
681
+
682
+ })(jQuery);
683
+
410
684
  /*
411
685
  * TODO LIST CUSTOM PLUGIN
412
686
  * -----------------------
@@ -451,73 +725,4 @@ $.AdminLTE.boxWidget = {
451
725
  }
452
726
  });
453
727
  };
454
- }(jQuery));
455
-
456
- /* ------------------
457
- * - Implementation -
458
- * ------------------
459
- * The next block of code implements AdminLTE's
460
- * functions and plugins as specified by the
461
- * options above.
462
- */
463
- $(function () {
464
- //Easy access to options
465
- var o = $.AdminLTE.options;
466
-
467
- //Activate the layout maker
468
- $.AdminLTE.layout.activate();
469
-
470
- //Enable sidebar tree view controls
471
- $.AdminLTE.tree('.sidebar');
472
-
473
- //Add slimscroll to navbar dropdown
474
- if (o.navbarMenuSlimscroll && typeof $.fn.slimscroll != 'undefined') {
475
- $(".navbar .menu").slimscroll({
476
- height: "200px",
477
- alwaysVisible: false,
478
- size: "3px"
479
- }).css("width", "100%");
480
- }
481
-
482
- //Activate sidebar push menu
483
- if (o.sidebarPushMenu) {
484
- $.AdminLTE.pushMenu(o.sidebarToggleSelector);
485
- }
486
-
487
- //Activate Bootstrap tooltip
488
- if (o.enableBSToppltip) {
489
- $(o.BSTooltipSelector).tooltip();
490
- }
491
-
492
- //Activate box widget
493
- if (o.enableBoxWidget) {
494
- $.AdminLTE.boxWidget.activate();
495
- }
496
-
497
- //Activate fast click
498
- if (o.enableFastclick && typeof FastClick != 'undefined') {
499
- FastClick.attach(document.body);
500
- }
501
-
502
- //Activate direct chat widget
503
- if (o.directChat.enable) {
504
- $(o.directChat.contactToggleSelector).click(function () {
505
- var box = $(this).parents('.direct-chat').first();
506
- box.toggleClass('direct-chat-contacts-open');
507
- });
508
- }
509
-
510
- /*
511
- * INITIALIZE BUTTON TOGGLE
512
- * ------------------------
513
- */
514
- $('.btn-group[data-toggle="btn-toggle"]').each(function () {
515
- var group = $(this);
516
- $(this).find(".btn").click(function (e) {
517
- group.find(".btn.active").removeClass("active");
518
- $(this).addClass("active");
519
- e.preventDefault();
520
- });
521
-
522
- });
523
- });
728
+ }(jQuery));