admin_lte-rails 2.2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/CODE_OF_CONDUCT.md +13 -0
  6. data/Gemfile +7 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +65 -0
  9. data/Rakefile +86 -0
  10. data/admin_lte.gemspec +45 -0
  11. data/app/assets/javascripts/admin_lte/admin_lte.js +11 -0
  12. data/app/assets/javascripts/admin_lte/app.js +743 -0
  13. data/app/assets/stylesheets/admin_lte/admin_lte_font.scss +1 -0
  14. data/app/assets/stylesheets/admin_lte/ltr/.scss +1 -0
  15. data/app/assets/stylesheets/admin_lte/ltr/AdminLTE.scss +4211 -0
  16. data/app/assets/stylesheets/admin_lte/ltr/_bootstrap.scss +2 -0
  17. data/app/assets/stylesheets/admin_lte/ltr/admin_lte.css +16 -0
  18. data/app/assets/stylesheets/admin_lte/ltr/skins/_all-skins.scss +1787 -0
  19. data/app/assets/stylesheets/admin_lte/ltr/skins/skin-black-light.scss +175 -0
  20. data/app/assets/stylesheets/admin_lte/ltr/skins/skin-black.scss +153 -0
  21. data/app/assets/stylesheets/admin_lte/ltr/skins/skin-blue-light.scss +166 -0
  22. data/app/assets/stylesheets/admin_lte/ltr/skins/skin-blue.scss +141 -0
  23. data/app/assets/stylesheets/admin_lte/ltr/skins/skin-green-light.scss +155 -0
  24. data/app/assets/stylesheets/admin_lte/ltr/skins/skin-green.scss +133 -0
  25. data/app/assets/stylesheets/admin_lte/ltr/skins/skin-purple-light.scss +155 -0
  26. data/app/assets/stylesheets/admin_lte/ltr/skins/skin-purple.scss +133 -0
  27. data/app/assets/stylesheets/admin_lte/ltr/skins/skin-red-light.scss +155 -0
  28. data/app/assets/stylesheets/admin_lte/ltr/skins/skin-red.scss +133 -0
  29. data/app/assets/stylesheets/admin_lte/ltr/skins/skin-yellow-light.scss +155 -0
  30. data/app/assets/stylesheets/admin_lte/ltr/skins/skin-yellow.scss +133 -0
  31. data/app/assets/stylesheets/admin_lte/rtl/.scss +2 -0
  32. data/app/assets/stylesheets/admin_lte/rtl/AdminLTE.scss +4212 -0
  33. data/app/assets/stylesheets/admin_lte/rtl/_bootstrap.scss +4 -0
  34. data/app/assets/stylesheets/admin_lte/rtl/admin_lte.css +16 -0
  35. data/app/assets/stylesheets/admin_lte/rtl/skins/_all-skins.scss +1788 -0
  36. data/app/assets/stylesheets/admin_lte/rtl/skins/skin-black-light.scss +176 -0
  37. data/app/assets/stylesheets/admin_lte/rtl/skins/skin-black.scss +154 -0
  38. data/app/assets/stylesheets/admin_lte/rtl/skins/skin-blue-light.scss +167 -0
  39. data/app/assets/stylesheets/admin_lte/rtl/skins/skin-blue.scss +142 -0
  40. data/app/assets/stylesheets/admin_lte/rtl/skins/skin-green-light.scss +156 -0
  41. data/app/assets/stylesheets/admin_lte/rtl/skins/skin-green.scss +134 -0
  42. data/app/assets/stylesheets/admin_lte/rtl/skins/skin-purple-light.scss +156 -0
  43. data/app/assets/stylesheets/admin_lte/rtl/skins/skin-purple.scss +134 -0
  44. data/app/assets/stylesheets/admin_lte/rtl/skins/skin-red-light.scss +156 -0
  45. data/app/assets/stylesheets/admin_lte/rtl/skins/skin-red.scss +134 -0
  46. data/app/assets/stylesheets/admin_lte/rtl/skins/skin-yellow-light.scss +156 -0
  47. data/app/assets/stylesheets/admin_lte/rtl/skins/skin-yellow.scss +134 -0
  48. data/bin/console +14 -0
  49. data/bin/setup +7 -0
  50. data/lib/admin_lte-rails.rb +57 -0
  51. data/lib/admin_lte-rails/version.rb +3 -0
  52. data/lib/ltr/_bootstrap.scss +2 -0
  53. data/lib/ltr/admin_lte.css +16 -0
  54. data/lib/rtl/_bootstrap.scss +4 -0
  55. data/lib/rtl/admin_lte.css +16 -0
  56. data/lib/to_rtl.js +6 -0
  57. metadata +380 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2acbd6870fa4d52952520a8e0f23b483d33fe3e0
4
+ data.tar.gz: cc45220bd63840b45fc306b8491332f0cfa85adc
5
+ SHA512:
6
+ metadata.gz: 26f2b8c39c13a2723b7b110b9b5da33d13ce99d81269db7629cb6783edb2919ded60df52e64326d9587b4cadcaa31f3c93baf85b4b404e311c235fd779775780
7
+ data.tar.gz: c2c08cb4a2eb9c252ce936c5300b313e8b6523a4d1f0ad2eb77134efd7578b1a754333ab95f68cea3fe93ae1fe0ad19d82fa32148c2987a18b6d007730aed9e9
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ node_modules/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ before_install: gem install bundler -v 1.10.5
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+ source 'http://rails-assets.org'
3
+
4
+ # Specify your gem's dependencies in admin_lte.gemspec
5
+ gemspec
6
+
7
+ gem 'rails-assets-admin-lte'
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Sameer Rahmani
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,65 @@
1
+ # AdminLTE Rails
2
+ Gem wrapper to include the AdminLTE dashboard interface via the Rails 3.1 asset pipeline.
3
+
4
+ This gem provides extra features on top of AdminLTE. For example two of the most awesome features
5
+ are SASS/SCSS and RTL support for AdminLTE which does not exists in the original version. Also
6
+ this gem fetch and converts the original source code (mostly) so main credits goes to AdminLTE
7
+ contributors.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'admin_lte-rails'
15
+ ```
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install admin_lte
23
+
24
+ ## Usage
25
+
26
+ To use the **admin_lte-rails** gem all you need to do is to require the related **admin_lte-rails** maniifest
27
+ in you application manifest. for example:
28
+
29
+ For ltr version of AdminLTE stylesheets add this to your `app/assets/stylesheets/application.css`:
30
+
31
+ ```css
32
+ //= require admin_lte/ltr/admin_lte
33
+ ```
34
+
35
+ and for the rtl version add this:
36
+
37
+ ```css
38
+ //= require admin_lte/rtl/admin_lte
39
+ ```
40
+
41
+ Also you need to add this into your `app/assets/javascripts/application.js`
42
+
43
+ ```js
44
+ //= require admin_lte/admin_lte
45
+ ```
46
+
47
+ **NOTE:** Default setting does not include the google font configuration so you have to add `Source Sans Pro` to your
48
+ project. I done this because I hate using online google font service. But if you like it you can simply add this line
49
+ before adding admin_lte into you manifest:
50
+
51
+ ```css
52
+ //= require admin_lte/admin_lte_font
53
+ ```
54
+
55
+ ## Development
56
+ To create the latest version of AdminLTE only run `rake convert` in this gem. That's it.
57
+
58
+ ## Contributing
59
+
60
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Yellowen/admin_lte-rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
61
+
62
+
63
+ ## License
64
+
65
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,86 @@
1
+ require 'pry'
2
+ require 'fileutils'
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task :default => :spec
9
+
10
+
11
+ desc 'Convert AdminLTE files'
12
+ task :convert do
13
+ ENV['EXECJS_RUNTIME'] = 'Node'
14
+
15
+ spec = Gem::Specification.find_by_name('rails-assets-admin-lte')
16
+ dir = "#{spec.gem_dir}/app/assets"
17
+ puts dir
18
+
19
+ app_path = File.expand_path('../app', __FILE__)
20
+ lib_path = File.expand_path('../lib', __FILE__)
21
+ cssjanus = File.expand_path('../lib/to_rtl.js', __FILE__)
22
+ style_dir = "#{app_path}/assets/stylesheets/admin_lte"
23
+ js_dir = "#{app_path}/assets/javscripts/admin-lte"
24
+
25
+ orig_style = "#{dir}/stylesheets/admin-lte"
26
+ admin_lte_font = "#{style_dir}/admin_lte_font.scss"
27
+ orig_js = "#{dir}/javascripts/admin-lte"
28
+
29
+ FileUtils.rmdir "#{style_dir}/ltr"
30
+ FileUtils.rmdir "#{style_dir}/rtl"
31
+
32
+ Dir.glob("#{dir}/stylesheets/**/*") do |file|
33
+
34
+ new_path = file.gsub(orig_style, "#{style_dir}/ltr/")
35
+ rtl_path = new_path.gsub('ltr/', 'rtl/')
36
+
37
+ FileUtils.mkdir_p File.dirname(new_path)
38
+ FileUtils.mkdir_p File.dirname(rtl_path)
39
+
40
+ unless File.directory? file
41
+ puts "Source: #{file}, #{File.basename(file)}"
42
+ puts "LTR: #{new_path}"
43
+ puts "RTL: #{rtl_path}"
44
+
45
+ FileUtils.cp(file, new_path)
46
+ if File.basename(file) == 'AdminLTE.scss'
47
+ puts "Removing google font configuration."
48
+ `head -n 1 #{file} > #{admin_lte_font}`
49
+ `tail -n +2 #{file} > #{new_path}`
50
+ end
51
+
52
+ `nodejs #{cssjanus} #{new_path} > #{rtl_path}`
53
+ puts "================="
54
+ end
55
+ end
56
+
57
+ FileUtils.cp("#{lib_path}/ltr/admin_lte.css",
58
+ "#{style_dir}/ltr/admin_lte.css")
59
+ FileUtils.cp("#{lib_path}/ltr/_bootstrap.scss",
60
+ "#{style_dir}/ltr/_bootstrap.scss")
61
+
62
+ FileUtils.cp("#{lib_path}/rtl/admin_lte.css",
63
+ "#{style_dir}/rtl/admin_lte.css")
64
+ FileUtils.cp("#{lib_path}/rtl/_bootstrap.scss",
65
+ "#{style_dir}/rtl/_bootstrap.scss")
66
+
67
+ # Dir.glob("#{dir}/javascripts/**/*") do |file|
68
+
69
+ # new_path = file.gsub(orig_js, "#{js_dir}/")
70
+
71
+ # FileUtils.mkdir_p File.dirname(new_path)
72
+
73
+
74
+ # unless File.directory? file
75
+ # puts "Source: #{file}"
76
+ # puts "DST: #{new_path}"
77
+ # puts "================="
78
+
79
+ # FileUtils.cp(file, new_path)
80
+ # end
81
+ # end
82
+
83
+
84
+
85
+
86
+ end
@@ -0,0 +1,45 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'admin_lte-rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'admin_lte-rails'
8
+ spec.version = AdminLte::VERSION
9
+ spec.authors = ["Sameer Rahmani"]
10
+ spec.email = ["lxsameer@gnu.org"]
11
+
12
+ spec.summary = %q{Gemified AdminLTE, with SASS and RTL support for Rails.}
13
+ spec.description = %q{Gemified AdminLTE, with SASS and RTL support for Rails.}
14
+ spec.homepage = "http://github.com/Yellowen/admin_lte-rails"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = 'bin'
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_dependency 'rails-assets-admin-lte'
23
+ spec.add_dependency 'jquery-rails'
24
+ spec.add_dependency 'font-awesome-rails'
25
+ spec.add_dependency 'jquery-ui-rails'
26
+ spec.add_dependency 'select2-rails'
27
+ spec.add_dependency 'momentjs-rails'
28
+ spec.add_dependency 'bootstrap3-datetimepicker-rails'
29
+ spec.add_dependency 'rails-assets-jquery-knob'
30
+ spec.add_dependency 'rails-assets-bootstrap-daterangepicker'
31
+ spec.add_dependency 'rails-assets-jquery-sparkline'
32
+ spec.add_dependency 'rails-assets-jquery-icheck'
33
+
34
+ spec.add_dependency 'bootstrap-sass'
35
+ spec.add_dependency 'rails-assets-bootstrap-rtl'
36
+
37
+ spec.add_dependency 'chart-js-rails'
38
+ spec.add_dependency 'ionicons-rails'
39
+
40
+ spec.add_development_dependency 'bundler', "~> 1.10"
41
+ spec.add_development_dependency 'rake', "~> 10.0"
42
+ spec.add_development_dependency 'rspec'
43
+ spec.add_development_dependency 'execjs'
44
+ spec.add_development_dependency 'pry'
45
+ end
@@ -0,0 +1,11 @@
1
+ //= require jquery-ui
2
+ //= require bootstrap
3
+ //= require select2
4
+ //= require moment
5
+ //= require bootstrap-datetimepicker
6
+ //= require bootstrap-daterangepicker
7
+ //= require jquery-knob
8
+ //= require jquery-sparkline
9
+ //= require jquery-icheck
10
+ //= require Chart
11
+ //= require admin_lte/app
@@ -0,0 +1,743 @@
1
+ /*! AdminLTE app.js
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 <http://www.almsaeedstudio.com>
9
+ * @Email <support@almsaeedstudio.com>
10
+ * @version 2.1.2
11
+ * @license MIT <http://opensource.org/licenses/MIT>
12
+ */
13
+
14
+ //Make sure jQuery has been loaded before app.js
15
+ if (typeof jQuery === "undefined") {
16
+ throw new Error("AdminLTE requires jQuery");
17
+ }
18
+
19
+ /* AdminLTE
20
+ *
21
+ * @type Object
22
+ * @description $.AdminLTE is the main object for the template's app.
23
+ * It's used for implementing functions and options related
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.
27
+ */
28
+ $.AdminLTE = {};
29
+
30
+ /* --------------------
31
+ * - AdminLTE Options -
32
+ * --------------------
33
+ * Modify these options to suit your implementation
34
+ */
35
+ $.AdminLTE.options = {
36
+ //Add slimscroll to navbar menus
37
+ //This requires you to load the slimscroll plugin
38
+ //in every page before app.js
39
+ navbarMenuSlimscroll: true,
40
+ navbarMenuSlimscrollWidth: "3px", //The width of the scroll bar
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 options 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: true,
66
+ //Control Sidebar Options
67
+ enableControlSidebar: true,
68
+ controlSidebarOptions: {
69
+ //Which button should trigger the open/close event
70
+ toggleBtnSelector: "[data-toggle='control-sidebar']",
71
+ //The sidebar selector
72
+ selector: ".control-sidebar",
73
+ //Enable slide over content
74
+ slide: true
75
+ },
76
+ //Box Widget Plugin. Enable this plugin
77
+ //to allow boxes to be collapsed and/or removed
78
+ enableBoxWidget: true,
79
+ //Box Widget plugin options
80
+ boxWidgetOptions: {
81
+ boxWidgetIcons: {
82
+ //Collapse icon
83
+ collapse: 'fa-minus',
84
+ //Open icon
85
+ open: 'fa-plus',
86
+ //Remove icon
87
+ remove: 'fa-times'
88
+ },
89
+ boxWidgetSelectors: {
90
+ //Remove button selector
91
+ remove: '[data-widget="remove"]',
92
+ //Collapse button selector
93
+ collapse: '[data-widget="collapse"]'
94
+ }
95
+ },
96
+ //Direct Chat plugin options
97
+ directChat: {
98
+ //Enable direct chat by default
99
+ enable: true,
100
+ //The button to open and close the chat contacts pane
101
+ contactToggleSelector: '[data-widget="chat-pane-toggle"]'
102
+ },
103
+ //Define the set of colors to use globally around the website
104
+ colors: {
105
+ lightBlue: "#3c8dbc",
106
+ red: "#f56954",
107
+ green: "#00a65a",
108
+ aqua: "#00c0ef",
109
+ yellow: "#f39c12",
110
+ blue: "#0073b7",
111
+ navy: "#001F3F",
112
+ teal: "#39CCCC",
113
+ olive: "#3D9970",
114
+ lime: "#01FF70",
115
+ orange: "#FF851B",
116
+ fuchsia: "#F012BE",
117
+ purple: "#8E24AA",
118
+ maroon: "#D81B60",
119
+ black: "#222222",
120
+ gray: "#d2d6de"
121
+ },
122
+ //The standard screen sizes that bootstrap uses.
123
+ //If you change these in the variables.less file, change
124
+ //them here too.
125
+ screenSizes: {
126
+ xs: 480,
127
+ sm: 768,
128
+ md: 992,
129
+ lg: 1200
130
+ }
131
+ };
132
+
133
+ /* ------------------
134
+ * - Implementation -
135
+ * ------------------
136
+ * The next block of code implements AdminLTE's
137
+ * functions and plugins as specified by the
138
+ * options above.
139
+ */
140
+ $(function () {
141
+ "use strict";
142
+
143
+ //Extend options if external options exist
144
+ if (typeof AdminLTEOptions !== "undefined") {
145
+ $.extend(true,
146
+ $.AdminLTE.options,
147
+ AdminLTEOptions);
148
+ }
149
+
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
+ $(document).on('click', o.directChat.contactToggleSelector, 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.
225
+ */
226
+ function _init() {
227
+ 'use strict';
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;
240
+ _this.fix();
241
+ _this.fixSidebar();
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());
256
+ } else {
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
+
273
+ }
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' && window.console) {
283
+ window.console.error("Error: the fixed layout requires the slimscroll plugin!");
284
+ }
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
+ }
297
+ }
298
+ }
299
+ };
300
+
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;
312
+
313
+ //Enable sidebar toggle
314
+ $(toggleBtn).on('click', function (e) {
315
+ e.preventDefault();
316
+
317
+ //Enable sidebar push menu
318
+ if ($(window).width() > (screenSizes.sm - 1)) {
319
+ if ($("body").hasClass('sidebar-collapse')) {
320
+ $("body").removeClass('sidebar-collapse').trigger('expanded.pushMenu');
321
+ } else {
322
+ $("body").addClass('sidebar-collapse').trigger('collapsed.pushMenu');
323
+ }
324
+ }
325
+ //Handle sidebar push menu for small screens
326
+ else {
327
+ if ($("body").hasClass('sidebar-open')) {
328
+ $("body").removeClass('sidebar-open').removeClass('sidebar-collapse').trigger('collapsed.pushMenu');
329
+ } else {
330
+ $("body").addClass('sidebar-open').trigger('expanded.pushMenu');
331
+ }
332
+ }
333
+ });
334
+
335
+ $(".content-wrapper").click(function () {
336
+ //Enable hide menu when clicking on the content-wrapper on small screens
337
+ if ($(window).width() <= (screenSizes.sm - 1) && $("body").hasClass("sidebar-open")) {
338
+ $("body").removeClass('sidebar-open');
339
+ }
340
+ });
341
+
342
+ //Enable expand on hover for sidebar mini
343
+ if ($.AdminLTE.options.sidebarExpandOnHover
344
+ || ($('body').hasClass('fixed')
345
+ && $('body').hasClass('sidebar-mini'))) {
346
+ this.expandOnHover();
347
+ }
348
+ },
349
+ expandOnHover: function () {
350
+ var _this = this;
351
+ var screenWidth = $.AdminLTE.options.screenSizes.sm - 1;
352
+ //Expand sidebar on hover
353
+ $('.main-sidebar').hover(function () {
354
+ if ($('body').hasClass('sidebar-mini')
355
+ && $("body").hasClass('sidebar-collapse')
356
+ && $(window).width() > screenWidth) {
357
+ _this.expand();
358
+ }
359
+ }, function () {
360
+ if ($('body').hasClass('sidebar-mini')
361
+ && $('body').hasClass('sidebar-expanded-on-hover')
362
+ && $(window).width() > screenWidth) {
363
+ _this.collapse();
364
+ }
365
+ });
366
+ },
367
+ expand: function () {
368
+ $("body").removeClass('sidebar-collapse').addClass('sidebar-expanded-on-hover');
369
+ },
370
+ collapse: function () {
371
+ if ($('body').hasClass('sidebar-expanded-on-hover')) {
372
+ $('body').removeClass('sidebar-expanded-on-hover').addClass('sidebar-collapse');
373
+ }
374
+ }
375
+ };
376
+
377
+ /* Tree()
378
+ * ======
379
+ * Converts the sidebar into a multilevel
380
+ * tree view menu.
381
+ *
382
+ * @type Function
383
+ * @Usage: $.AdminLTE.tree('.sidebar')
384
+ */
385
+ $.AdminLTE.tree = function (menu) {
386
+ var _this = this;
387
+ var animationSpeed = $.AdminLTE.options.animationSpeed;
388
+ $(document).on('click', menu + ' li a', function (e) {
389
+ //Get the clicked link and the next element
390
+ var $this = $(this);
391
+ var checkElement = $this.next();
392
+
393
+ //Check if the next element is a menu and is visible
394
+ if ((checkElement.is('.treeview-menu')) && (checkElement.is(':visible'))) {
395
+ //Close the menu
396
+ checkElement.slideUp(animationSpeed, function () {
397
+ checkElement.removeClass('menu-open');
398
+ //Fix the layout in case the sidebar stretches over the height of the window
399
+ //_this.layout.fix();
400
+ });
401
+ checkElement.parent("li").removeClass("active");
402
+ }
403
+ //If the menu is not visible
404
+ else if ((checkElement.is('.treeview-menu')) && (!checkElement.is(':visible'))) {
405
+ //Get the parent menu
406
+ var parent = $this.parents('ul').first();
407
+ //Close all open menus within the parent
408
+ var ul = parent.find('ul:visible').slideUp(animationSpeed);
409
+ //Remove the menu-open class from the parent
410
+ ul.removeClass('menu-open');
411
+ //Get the parent li
412
+ var parent_li = $this.parent("li");
413
+
414
+ //Open the target menu and add the menu-open class
415
+ checkElement.slideDown(animationSpeed, function () {
416
+ //Add the class active to the parent li
417
+ checkElement.addClass('menu-open');
418
+ parent.find('li.active').removeClass('active');
419
+ parent_li.addClass('active');
420
+ //Fix the layout in case the sidebar stretches over the height of the window
421
+ _this.layout.fix();
422
+ });
423
+ }
424
+ //if this isn't a link, prevent the page from being redirected
425
+ if (checkElement.is('.treeview-menu')) {
426
+ e.preventDefault();
427
+ }
428
+ });
429
+ };
430
+
431
+ /* ControlSidebar
432
+ * ==============
433
+ * Adds functionality to the right sidebar
434
+ *
435
+ * @type Object
436
+ * @usage $.AdminLTE.controlSidebar.activate(options)
437
+ */
438
+ $.AdminLTE.controlSidebar = {
439
+ //instantiate the object
440
+ activate: function () {
441
+ //Get the object
442
+ var _this = this;
443
+ //Update options
444
+ var o = $.AdminLTE.options.controlSidebarOptions;
445
+ //Get the sidebar
446
+ var sidebar = $(o.selector);
447
+ //The toggle button
448
+ var btn = $(o.toggleBtnSelector);
449
+
450
+ //Listen to the click event
451
+ btn.on('click', function (e) {
452
+ e.preventDefault();
453
+ //If the sidebar is not open
454
+ if (!sidebar.hasClass('control-sidebar-open')
455
+ && !$('body').hasClass('control-sidebar-open')) {
456
+ //Open the sidebar
457
+ _this.open(sidebar, o.slide);
458
+ } else {
459
+ _this.close(sidebar, o.slide);
460
+ }
461
+ });
462
+
463
+ //If the body has a boxed layout, fix the sidebar bg position
464
+ var bg = $(".control-sidebar-bg");
465
+ _this._fix(bg);
466
+
467
+ //If the body has a fixed layout, make the control sidebar fixed
468
+ if ($('body').hasClass('fixed')) {
469
+ _this._fixForFixed(sidebar);
470
+ } else {
471
+ //If the content height is less than the sidebar's height, force max height
472
+ if ($('.content-wrapper, .right-side').height() < sidebar.height()) {
473
+ _this._fixForContent(sidebar);
474
+ }
475
+ }
476
+ },
477
+ //Open the control sidebar
478
+ open: function (sidebar, slide) {
479
+ //Slide over content
480
+ if (slide) {
481
+ sidebar.addClass('control-sidebar-open');
482
+ } else {
483
+ //Push the content by adding the open class to the body instead
484
+ //of the sidebar itself
485
+ $('body').addClass('control-sidebar-open');
486
+ }
487
+ },
488
+ //Close the control sidebar
489
+ close: function (sidebar, slide) {
490
+ if (slide) {
491
+ sidebar.removeClass('control-sidebar-open');
492
+ } else {
493
+ $('body').removeClass('control-sidebar-open');
494
+ }
495
+ },
496
+ _fix: function (sidebar) {
497
+ var _this = this;
498
+ if ($("body").hasClass('layout-boxed')) {
499
+ sidebar.css('position', 'absolute');
500
+ sidebar.height($(".wrapper").height());
501
+ $(window).resize(function () {
502
+ _this._fix(sidebar);
503
+ });
504
+ } else {
505
+ sidebar.css({
506
+ 'position': 'fixed',
507
+ 'height': 'auto'
508
+ });
509
+ }
510
+ },
511
+ _fixForFixed: function (sidebar) {
512
+ sidebar.css({
513
+ 'position': 'fixed',
514
+ 'max-height': '100%',
515
+ 'overflow': 'auto',
516
+ 'padding-bottom': '50px'
517
+ });
518
+ },
519
+ _fixForContent: function (sidebar) {
520
+ $(".content-wrapper, .right-side").css('min-height', sidebar.height());
521
+ }
522
+ };
523
+
524
+ /* BoxWidget
525
+ * =========
526
+ * BoxWidget is a plugin to handle collapsing and
527
+ * removing boxes from the screen.
528
+ *
529
+ * @type Object
530
+ * @usage $.AdminLTE.boxWidget.activate()
531
+ * Set all your options in the main $.AdminLTE.options object
532
+ */
533
+ $.AdminLTE.boxWidget = {
534
+ selectors: $.AdminLTE.options.boxWidgetOptions.boxWidgetSelectors,
535
+ icons: $.AdminLTE.options.boxWidgetOptions.boxWidgetIcons,
536
+ animationSpeed: $.AdminLTE.options.animationSpeed,
537
+ activate: function (_box) {
538
+ var _this = this;
539
+ if (!_box) {
540
+ _box = document; // activate all boxes per default
541
+ }
542
+ //Listen for collapse event triggers
543
+ $(_box).on('click', _this.selectors.collapse, function (e) {
544
+ e.preventDefault();
545
+ _this.collapse($(this));
546
+ });
547
+
548
+ //Listen for remove event triggers
549
+ $(_box).on('click', _this.selectors.remove, function (e) {
550
+ e.preventDefault();
551
+ _this.remove($(this));
552
+ });
553
+ },
554
+ collapse: function (element) {
555
+ var _this = this;
556
+ //Find the box parent
557
+ var box = element.parents(".box").first();
558
+ //Find the body and the footer
559
+ var box_content = box.find("> .box-body, > .box-footer, > form >.box-body, > form > .box-footer");
560
+ if (!box.hasClass("collapsed-box")) {
561
+ //Convert minus into plus
562
+ element.children(":first")
563
+ .removeClass(_this.icons.collapse)
564
+ .addClass(_this.icons.open);
565
+ //Hide the content
566
+ box_content.slideUp(_this.animationSpeed, function () {
567
+ box.addClass("collapsed-box");
568
+ });
569
+ } else {
570
+ //Convert plus into minus
571
+ element.children(":first")
572
+ .removeClass(_this.icons.open)
573
+ .addClass(_this.icons.collapse);
574
+ //Show the content
575
+ box_content.slideDown(_this.animationSpeed, function () {
576
+ box.removeClass("collapsed-box");
577
+ });
578
+ }
579
+ },
580
+ remove: function (element) {
581
+ //Find the box parent
582
+ var box = element.parents(".box").first();
583
+ box.slideUp(this.animationSpeed);
584
+ }
585
+ };
586
+ }
587
+
588
+ /* ------------------
589
+ * - Custom Plugins -
590
+ * ------------------
591
+ * All custom plugins are defined below.
592
+ */
593
+
594
+ /*
595
+ * BOX REFRESH BUTTON
596
+ * ------------------
597
+ * This is a custom plugin to use with the component BOX. It allows you to add
598
+ * a refresh button to the box. It converts the box's state to a loading state.
599
+ *
600
+ * @type plugin
601
+ * @usage $("#box-widget").boxRefresh( options );
602
+ */
603
+ (function ($) {
604
+
605
+ "use strict";
606
+
607
+ $.fn.boxRefresh = function (options) {
608
+
609
+ // Render options
610
+ var settings = $.extend({
611
+ //Refresh button selector
612
+ trigger: ".refresh-btn",
613
+ //File source to be loaded (e.g: ajax/src.php)
614
+ source: "",
615
+ //Callbacks
616
+ onLoadStart: function (box) {
617
+ return box;
618
+ }, //Right after the button has been clicked
619
+ onLoadDone: function (box) {
620
+ return box;
621
+ } //When the source has been loaded
622
+
623
+ }, options);
624
+
625
+ //The overlay
626
+ var overlay = $('<div class="overlay"><div class="fa fa-refresh fa-spin"></div></div>');
627
+
628
+ return this.each(function () {
629
+ //if a source is specified
630
+ if (settings.source === "") {
631
+ if (window.console) {
632
+ window.console.log("Please specify a source first - boxRefresh()");
633
+ }
634
+ return;
635
+ }
636
+ //the box
637
+ var box = $(this);
638
+ //the button
639
+ var rBtn = box.find(settings.trigger).first();
640
+
641
+ //On trigger click
642
+ rBtn.on('click', function (e) {
643
+ e.preventDefault();
644
+ //Add loading overlay
645
+ start(box);
646
+
647
+ //Perform ajax call
648
+ box.find(".box-body").load(settings.source, function () {
649
+ done(box);
650
+ });
651
+ });
652
+ });
653
+
654
+ function start(box) {
655
+ //Add overlay and loading img
656
+ box.append(overlay);
657
+
658
+ settings.onLoadStart.call(box);
659
+ }
660
+
661
+ function done(box) {
662
+ //Remove overlay and loading img
663
+ box.find(overlay).remove();
664
+
665
+ settings.onLoadDone.call(box);
666
+ }
667
+
668
+ };
669
+
670
+ })(jQuery);
671
+
672
+ /*
673
+ * EXPLICIT BOX ACTIVATION
674
+ * -----------------------
675
+ * This is a custom plugin to use with the component BOX. It allows you to activate
676
+ * a box inserted in the DOM after the app.js was loaded.
677
+ *
678
+ * @type plugin
679
+ * @usage $("#box-widget").activateBox();
680
+ */
681
+ (function ($) {
682
+
683
+ 'use strict';
684
+
685
+ $.fn.activateBox = function () {
686
+ $.AdminLTE.boxWidget.activate(this);
687
+ };
688
+
689
+ })(jQuery);
690
+
691
+ /*
692
+ * TODO LIST CUSTOM PLUGIN
693
+ * -----------------------
694
+ * This plugin depends on iCheck plugin for checkbox and radio inputs
695
+ *
696
+ * @type plugin
697
+ * @usage $("#todo-widget").todolist( options );
698
+ */
699
+ (function ($) {
700
+
701
+ 'use strict';
702
+
703
+ $.fn.todolist = function (options) {
704
+ // Render options
705
+ var settings = $.extend({
706
+ //When the user checks the input
707
+ onCheck: function (ele) {
708
+ return ele;
709
+ },
710
+ //When the user unchecks the input
711
+ onUncheck: function (ele) {
712
+ return ele;
713
+ }
714
+ }, options);
715
+
716
+ return this.each(function () {
717
+
718
+ if (typeof $.fn.iCheck != 'undefined') {
719
+ $('input', this).on('ifChecked', function () {
720
+ var ele = $(this).parents("li").first();
721
+ ele.toggleClass("done");
722
+ settings.onCheck.call(ele);
723
+ });
724
+
725
+ $('input', this).on('ifUnchecked', function () {
726
+ var ele = $(this).parents("li").first();
727
+ ele.toggleClass("done");
728
+ settings.onUncheck.call(ele);
729
+ });
730
+ } else {
731
+ $('input', this).on('change', function () {
732
+ var ele = $(this).parents("li").first();
733
+ ele.toggleClass("done");
734
+ if ($('input', ele).is(":checked")) {
735
+ settings.onCheck.call(ele);
736
+ } else {
737
+ settings.onUncheck.call(ele);
738
+ }
739
+ });
740
+ }
741
+ });
742
+ };
743
+ }(jQuery));