geri 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +26 -0
  4. data/app/assets/javascripts/geri/admin.js +33 -0
  5. data/app/assets/javascripts/geri/admin/app.js +758 -0
  6. data/app/assets/javascripts/geri/admin/editor.js +56 -0
  7. data/app/assets/javascripts/geri/admin/password_resets.js +2 -0
  8. data/app/assets/stylesheets/geri/admin.css.less +60 -0
  9. data/app/assets/stylesheets/geri/admin/app.css +4915 -0
  10. data/app/assets/stylesheets/geri/admin/ckeditor/contents.css +135 -0
  11. data/app/assets/stylesheets/geri/admin/editor.css.less +38 -0
  12. data/app/assets/stylesheets/geri/admin/password_resets.css +4 -0
  13. data/app/assets/stylesheets/geri/admin/skin-blue.less +142 -0
  14. data/app/assets/vendor/ckeditor/CHANGES.md +1065 -0
  15. data/app/assets/vendor/ckeditor/LICENSE.md +1420 -0
  16. data/app/assets/vendor/ckeditor/README.md +39 -0
  17. data/app/assets/vendor/ckeditor/adapters/jquery.js +10 -0
  18. data/app/assets/vendor/ckeditor/build-config.js +69 -0
  19. data/app/assets/vendor/ckeditor/ckeditor.js +775 -0
  20. data/app/assets/vendor/ckeditor/config.js +34 -0
  21. data/app/assets/vendor/ckeditor/contents.css +135 -0
  22. data/app/assets/vendor/ckeditor/lang/en.js +5 -0
  23. data/app/assets/vendor/ckeditor/plugins/about/dialogs/about.js +7 -0
  24. data/app/assets/vendor/ckeditor/plugins/about/dialogs/hidpi/logo_ckeditor.png +0 -0
  25. data/app/assets/vendor/ckeditor/plugins/about/dialogs/logo_ckeditor.png +0 -0
  26. data/app/assets/vendor/ckeditor/plugins/clipboard/dialogs/paste.js +12 -0
  27. data/app/assets/vendor/ckeditor/plugins/dialog/dialogDefinition.js +4 -0
  28. data/app/assets/vendor/ckeditor/plugins/icons.png +0 -0
  29. data/app/assets/vendor/ckeditor/plugins/icons_hidpi.png +0 -0
  30. data/app/assets/vendor/ckeditor/plugins/link/dialogs/anchor.js +7 -0
  31. data/app/assets/vendor/ckeditor/plugins/link/dialogs/link.js +26 -0
  32. data/app/assets/vendor/ckeditor/plugins/link/images/anchor.png +0 -0
  33. data/app/assets/vendor/ckeditor/plugins/link/images/hidpi/anchor.png +0 -0
  34. data/app/assets/vendor/ckeditor/samples/css/samples.css +1640 -0
  35. data/app/assets/vendor/ckeditor/samples/img/github-top.png +0 -0
  36. data/app/assets/vendor/ckeditor/samples/img/header-bg.png +0 -0
  37. data/app/assets/vendor/ckeditor/samples/img/header-separator.png +0 -0
  38. data/app/assets/vendor/ckeditor/samples/img/logo.png +0 -0
  39. data/app/assets/vendor/ckeditor/samples/img/navigation-tip.png +0 -0
  40. data/app/assets/vendor/ckeditor/samples/index.html +128 -0
  41. data/app/assets/vendor/ckeditor/samples/js/sample.js +53 -0
  42. data/app/assets/vendor/ckeditor/samples/js/sf.js +17 -0
  43. data/app/assets/vendor/ckeditor/samples/old/ajax.html +85 -0
  44. data/app/assets/vendor/ckeditor/samples/old/api.html +210 -0
  45. data/app/assets/vendor/ckeditor/samples/old/appendto.html +59 -0
  46. data/app/assets/vendor/ckeditor/samples/old/assets/inlineall/logo.png +0 -0
  47. data/app/assets/vendor/ckeditor/samples/old/assets/outputxhtml/outputxhtml.css +204 -0
  48. data/app/assets/vendor/ckeditor/samples/old/assets/posteddata.php +59 -0
  49. data/app/assets/vendor/ckeditor/samples/old/assets/sample.jpg +0 -0
  50. data/app/assets/vendor/ckeditor/samples/old/assets/uilanguages/languages.js +7 -0
  51. data/app/assets/vendor/ckeditor/samples/old/datafiltering.html +508 -0
  52. data/app/assets/vendor/ckeditor/samples/old/dialog/assets/my_dialog.js +48 -0
  53. data/app/assets/vendor/ckeditor/samples/old/dialog/dialog.html +190 -0
  54. data/app/assets/vendor/ckeditor/samples/old/divreplace.html +144 -0
  55. data/app/assets/vendor/ckeditor/samples/old/enterkey/enterkey.html +106 -0
  56. data/app/assets/vendor/ckeditor/samples/old/index.html +122 -0
  57. data/app/assets/vendor/ckeditor/samples/old/inlineall.html +314 -0
  58. data/app/assets/vendor/ckeditor/samples/old/inlinebycode.html +124 -0
  59. data/app/assets/vendor/ckeditor/samples/old/inlinetextarea.html +113 -0
  60. data/app/assets/vendor/ckeditor/samples/old/jquery.html +103 -0
  61. data/app/assets/vendor/ckeditor/samples/old/readonly.html +76 -0
  62. data/app/assets/vendor/ckeditor/samples/old/replacebyclass.html +60 -0
  63. data/app/assets/vendor/ckeditor/samples/old/replacebycode.html +59 -0
  64. data/app/assets/vendor/ckeditor/samples/old/sample.css +357 -0
  65. data/app/assets/vendor/ckeditor/samples/old/sample.js +50 -0
  66. data/app/assets/vendor/ckeditor/samples/old/sample_posteddata.php +16 -0
  67. data/app/assets/vendor/ckeditor/samples/old/tabindex.html +78 -0
  68. data/app/assets/vendor/ckeditor/samples/old/toolbar/toolbar.html +235 -0
  69. data/app/assets/vendor/ckeditor/samples/old/uicolor.html +72 -0
  70. data/app/assets/vendor/ckeditor/samples/old/uilanguages.html +122 -0
  71. data/app/assets/vendor/ckeditor/samples/old/wysiwygarea/fullpage.html +80 -0
  72. data/app/assets/vendor/ckeditor/samples/old/xhtmlstyle.html +234 -0
  73. data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/css/fontello.css +55 -0
  74. data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/font/LICENSE.txt +10 -0
  75. data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/font/config.json +28 -0
  76. data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/font/fontello.eot +0 -0
  77. data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/font/fontello.svg +14 -0
  78. data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/font/fontello.ttf +0 -0
  79. data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/font/fontello.woff +0 -0
  80. data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/index.html +446 -0
  81. data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/js/abstracttoolbarmodifier.js +13 -0
  82. data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/js/fulltoolbareditor.js +9 -0
  83. data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/js/toolbarmodifier.js +33 -0
  84. data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/js/toolbartextmodifier.js +14 -0
  85. data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/lib/codemirror/LICENSE +19 -0
  86. data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.css +325 -0
  87. data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/lib/codemirror/codemirror.js +288 -0
  88. data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/lib/codemirror/javascript.js +25 -0
  89. data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/lib/codemirror/neo.css +36 -0
  90. data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/lib/codemirror/show-hint.css +38 -0
  91. data/app/assets/vendor/ckeditor/samples/toolbarconfigurator/lib/codemirror/show-hint.js +16 -0
  92. data/app/assets/vendor/ckeditor/skins/bootstrapck/dialog.css +1 -0
  93. data/app/assets/vendor/ckeditor/skins/bootstrapck/dialog_ie.css +1 -0
  94. data/app/assets/vendor/ckeditor/skins/bootstrapck/dialog_ie7.css +1 -0
  95. data/app/assets/vendor/ckeditor/skins/bootstrapck/dialog_ie8.css +1 -0
  96. data/app/assets/vendor/ckeditor/skins/bootstrapck/dialog_iequirks.css +1 -0
  97. data/app/assets/vendor/ckeditor/skins/bootstrapck/dialog_opera.css +1 -0
  98. data/app/assets/vendor/ckeditor/skins/bootstrapck/editor.css +1 -0
  99. data/app/assets/vendor/ckeditor/skins/bootstrapck/editor_gecko.css +1 -0
  100. data/app/assets/vendor/ckeditor/skins/bootstrapck/editor_ie.css +1 -0
  101. data/app/assets/vendor/ckeditor/skins/bootstrapck/editor_ie7.css +1 -0
  102. data/app/assets/vendor/ckeditor/skins/bootstrapck/editor_ie8.css +1 -0
  103. data/app/assets/vendor/ckeditor/skins/bootstrapck/editor_iequirks.css +1 -0
  104. data/app/assets/vendor/ckeditor/skins/bootstrapck/icons.png +0 -0
  105. data/app/assets/vendor/ckeditor/skins/bootstrapck/icons_hidpi.png +0 -0
  106. data/app/assets/vendor/ckeditor/skins/bootstrapck/images/arrow.png +0 -0
  107. data/app/assets/vendor/ckeditor/skins/bootstrapck/images/close.png +0 -0
  108. data/app/assets/vendor/ckeditor/skins/bootstrapck/images/hidpi/close.png +0 -0
  109. data/app/assets/vendor/ckeditor/skins/bootstrapck/images/hidpi/lock-open.png +0 -0
  110. data/app/assets/vendor/ckeditor/skins/bootstrapck/images/hidpi/lock.png +0 -0
  111. data/app/assets/vendor/ckeditor/skins/bootstrapck/images/hidpi/refresh.png +0 -0
  112. data/app/assets/vendor/ckeditor/skins/bootstrapck/images/lock-open.png +0 -0
  113. data/app/assets/vendor/ckeditor/skins/bootstrapck/images/lock.png +0 -0
  114. data/app/assets/vendor/ckeditor/skins/bootstrapck/images/refresh.png +0 -0
  115. data/app/assets/vendor/ckeditor/skins/bootstrapck/readme.md +35 -0
  116. data/app/assets/vendor/ckeditor/skins/bootstrapck/sample/bootstrapck-sample.html +127 -0
  117. data/app/assets/vendor/ckeditor/skins/bootstrapck/sample/css/bootstrapck-sample.css +1 -0
  118. data/app/assets/vendor/ckeditor/skins/bootstrapck/sample/js/analytics.js +4 -0
  119. data/app/assets/vendor/ckeditor/skins/bootstrapck/sample/js/jquery-1.11.0.min.js +189 -0
  120. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/browser-specific/gecko/editor_gecko.scss +25 -0
  121. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/browser-specific/ie/dialog_ie.scss +62 -0
  122. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/browser-specific/ie/editor_ie.scss +71 -0
  123. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/browser-specific/ie7/dialog_ie7.scss +68 -0
  124. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/browser-specific/ie7/editor_ie7.scss +213 -0
  125. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/browser-specific/ie8/dialog_ie8.scss +24 -0
  126. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/browser-specific/ie8/editor_ie8.scss +27 -0
  127. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/browser-specific/iequirks/dialog_iequirks.scss +21 -0
  128. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/browser-specific/iequirks/editor_iequirks.scss +79 -0
  129. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/browser-specific/opera/dialog_opera.scss +31 -0
  130. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/components/_colorpanel.scss +119 -0
  131. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/components/_elementspath.scss +66 -0
  132. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/components/_mainui.scss +189 -0
  133. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/components/_menu.scss +182 -0
  134. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/components/_panel.scss +199 -0
  135. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/components/_presets.scss +32 -0
  136. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/components/_reset.scss +107 -0
  137. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/components/_richcombo.scss +174 -0
  138. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/components/_toolbar.scss +317 -0
  139. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/components/editor.scss +66 -0
  140. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/config/_colors.scss +61 -0
  141. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/config/_config.scss +9 -0
  142. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/config/_defaults.scss +37 -0
  143. data/app/assets/vendor/ckeditor/skins/bootstrapck/scss/dialog/dialog.scss +822 -0
  144. data/app/assets/vendor/ckeditor/styles.js +111 -0
  145. data/app/controllers/geri/admin/admin_users_controller.rb +56 -0
  146. data/app/controllers/geri/admin/dashboard_controller.rb +8 -0
  147. data/app/controllers/geri/admin/editor_controller.rb +33 -0
  148. data/app/controllers/geri/admin/password_resets_controller.rb +21 -0
  149. data/app/controllers/geri/admin/sessions_controller.rb +24 -0
  150. data/app/controllers/geri/admin_controller.rb +19 -0
  151. data/app/controllers/geri/application_controller.rb +5 -0
  152. data/app/controllers/geri/pages_controller.rb +34 -0
  153. data/app/helpers/geri/admin/dashboard_helper.rb +4 -0
  154. data/app/helpers/geri/admin/editor_helper.rb +4 -0
  155. data/app/helpers/geri/admin/pages_helper.rb +45 -0
  156. data/app/helpers/geri/admin/partials_helper.rb +4 -0
  157. data/app/helpers/geri/admin/password_resets_helper.rb +4 -0
  158. data/app/helpers/geri/admin/sessions_helper.rb +4 -0
  159. data/app/helpers/geri/admin_helper.rb +24 -0
  160. data/app/helpers/geri/admin_users_helper.rb +4 -0
  161. data/app/helpers/geri/application_helper.rb +26 -0
  162. data/app/helpers/geri/meta_helper.rb +32 -0
  163. data/app/mailers/application_mailer.rb +4 -0
  164. data/app/mailers/geri/admin_user_mailer.rb +11 -0
  165. data/app/models/geri/admin_user.rb +14 -0
  166. data/app/models/geri/content.rb +6 -0
  167. data/app/models/geri/password_reset.rb +17 -0
  168. data/app/models/geri/session.rb +20 -0
  169. data/app/views/geri/admin/admin_users/_form.html.erb +5 -0
  170. data/app/views/geri/admin/admin_users/edit.html.erb +27 -0
  171. data/app/views/geri/admin/admin_users/index.html.erb +45 -0
  172. data/app/views/geri/admin/admin_users/new.html.erb +17 -0
  173. data/app/views/geri/admin/dashboard/index.html.erb +1 -0
  174. data/app/views/geri/admin/editor/template.html.erb +17 -0
  175. data/app/views/geri/admin/password_resets/new.html.erb +17 -0
  176. data/app/views/geri/admin/sessions/new.html.erb +23 -0
  177. data/app/views/geri/admin/shared/_aside.html.erb +16 -0
  178. data/app/views/geri/admin/shared/_header.html.erb +31 -0
  179. data/app/views/geri/admin/shared/_menu_item.html.erb +17 -0
  180. data/app/views/geri/admin_user_mailer/reset_password_email.text.erb +7 -0
  181. data/app/views/layouts/geri/admin.html.erb +24 -0
  182. data/app/views/layouts/geri/admin/sessions.html.erb +21 -0
  183. data/app/views/layouts/mailer.html.erb +5 -0
  184. data/app/views/layouts/mailer.text.erb +1 -0
  185. data/config/initializers/geri.rb +7 -0
  186. data/config/initializers/sorcery.rb +463 -0
  187. data/config/locales/devise.en.yml +62 -0
  188. data/config/locales/en.yml +13 -0
  189. data/config/routes.rb +23 -0
  190. data/db/migrate/20160409151523_create_geri_contents.rb +8 -0
  191. data/db/migrate/20160411205412_sorcery_core.rb +20 -0
  192. data/lib/generators/geri/install/USAGE +8 -0
  193. data/lib/generators/geri/install/install_generator.rb +54 -0
  194. data/lib/generators/geri/install/templates/bower.json +8 -0
  195. data/lib/generators/geri/install/templates/index.html.erb +46 -0
  196. data/lib/generators/geri/install/templates/initializer.rb +12 -0
  197. data/lib/generators/geri/install/templates/layout.html.erb +11 -0
  198. data/lib/generators/geri/install/templates/site.css.less +1 -0
  199. data/lib/generators/geri/install/templates/site.js +1 -0
  200. data/lib/geri.rb +7 -0
  201. data/lib/geri/cli.rb +6 -0
  202. data/lib/geri/cli/base.rb +23 -0
  203. data/lib/geri/cli/extension.rb +18 -0
  204. data/lib/geri/config.rb +29 -0
  205. data/lib/geri/config/menu_item.rb +35 -0
  206. data/lib/geri/engine.rb +34 -0
  207. data/lib/geri/tasks.rb +3 -0
  208. data/lib/geri/tasks/create_admin_user.rb +40 -0
  209. data/lib/geri/version.rb +3 -0
  210. data/lib/tasks/geri_tasks.rake +15 -0
  211. metadata +449 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: afe4c3c38c97222fc7f0ad758241d3686dee8ee1
4
+ data.tar.gz: 43935f0a966279c52f547458b93e44c762bbeb7b
5
+ SHA512:
6
+ metadata.gz: ca6bb66b6ecb6032a9bb02be772f00b577887a53fa53c2d2d033c8833e4965c8993be518c2693182f8b02a959e2a29f43876efb88ed0c78974502b2224294b50
7
+ data.tar.gz: b32ed03c47f5b9ca47218fdff083be047022e0c942ab5ba6b450ff6d01544ac5b1229f467198c1174c02bde367e346317ef86fe02c05650c25c56cf0a5fcbf94
@@ -0,0 +1,20 @@
1
+ Copyright 2016 fugufish
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,26 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Geri'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ Bundler::GemHelper.install_tasks
26
+
@@ -0,0 +1,33 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
3
+ //= require jquery
4
+ //= require jquery_ujs
5
+ //= require twitter/bootstrap
6
+
7
+ //= require ./admin/app
8
+
9
+ $(function () {
10
+ var area = $('.html-text-area')[0];
11
+ if (area) {
12
+ CodeMirror.fromTextArea($('.html-text-area')[0], {
13
+ lineNumbers: true,
14
+ mode: 'xml',
15
+ theme: 'twilight'
16
+ })
17
+ }
18
+
19
+ $('.page-with-children').click(function () {
20
+ if (!$(this).hasClass('active')) {
21
+ $(this).addClass('active');
22
+ $('i:first-child', this).removeClass('fa-chevron-right');
23
+ $('i:first-child', this).addClass('fa-chevron-down')
24
+ $('#' + $(this).attr('id').replace('-page', '') + '-children > td > div').slideDown();
25
+ console.log($('#' + $(this).attr('id').replace('-page', '') + '-children > td > div'))
26
+ } else {
27
+ $(this).removeClass('active');
28
+ $('i:first-child', this).removeClass('fa-chevron-down');
29
+ $('i:first-child', this).addClass('fa-chevron-right')
30
+ $('#' + $(this).attr('id').replace('-page', '') + '-children > td > div').slideUp();
31
+ }
32
+ })
33
+ });
@@ -0,0 +1,758 @@
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.3.3
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
+ //Fix for IE page transitions
144
+ $("body").removeClass("hold-transition");
145
+
146
+ //Extend options if external options exist
147
+ if (typeof AdminLTEOptions !== "undefined") {
148
+ $.extend(true,
149
+ $.AdminLTE.options,
150
+ AdminLTEOptions);
151
+ }
152
+
153
+ //Easy access to options
154
+ var o = $.AdminLTE.options;
155
+
156
+ //Set up the object
157
+ _init();
158
+
159
+ //Activate the layout maker
160
+ $.AdminLTE.layout.activate();
161
+
162
+ //Enable sidebar tree view controls
163
+ $.AdminLTE.tree('.sidebar');
164
+
165
+ //Enable control sidebar
166
+ if (o.enableControlSidebar) {
167
+ $.AdminLTE.controlSidebar.activate();
168
+ }
169
+
170
+ //Add slimscroll to navbar dropdown
171
+ if (o.navbarMenuSlimscroll && typeof $.fn.slimscroll != 'undefined') {
172
+ $(".navbar .menu").slimscroll({
173
+ height: o.navbarMenuHeight,
174
+ alwaysVisible: false,
175
+ size: o.navbarMenuSlimscrollWidth
176
+ }).css("width", "100%");
177
+ }
178
+
179
+ //Activate sidebar push menu
180
+ if (o.sidebarPushMenu) {
181
+ $.AdminLTE.pushMenu.activate(o.sidebarToggleSelector);
182
+ }
183
+
184
+ //Activate Bootstrap tooltip
185
+ if (o.enableBSToppltip) {
186
+ $('body').tooltip({
187
+ selector: o.BSTooltipSelector
188
+ });
189
+ }
190
+
191
+ //Activate box widget
192
+ if (o.enableBoxWidget) {
193
+ $.AdminLTE.boxWidget.activate();
194
+ }
195
+
196
+ //Activate fast click
197
+ if (o.enableFastclick && typeof FastClick != 'undefined') {
198
+ FastClick.attach(document.body);
199
+ }
200
+
201
+ //Activate direct chat widget
202
+ if (o.directChat.enable) {
203
+ $(document).on('click', o.directChat.contactToggleSelector, function () {
204
+ var box = $(this).parents('.direct-chat').first();
205
+ box.toggleClass('direct-chat-contacts-open');
206
+ });
207
+ }
208
+
209
+ /*
210
+ * INITIALIZE BUTTON TOGGLE
211
+ * ------------------------
212
+ */
213
+ $('.btn-group[data-toggle="btn-toggle"]').each(function () {
214
+ var group = $(this);
215
+ $(this).find(".btn").on('click', function (e) {
216
+ group.find(".btn.active").removeClass("active");
217
+ $(this).addClass("active");
218
+ e.preventDefault();
219
+ });
220
+
221
+ });
222
+ });
223
+
224
+ /* ----------------------------------
225
+ * - Initialize the AdminLTE Object -
226
+ * ----------------------------------
227
+ * All AdminLTE functions are implemented below.
228
+ */
229
+ function _init() {
230
+ 'use strict';
231
+ /* Layout
232
+ * ======
233
+ * Fixes the layout height in case min-height fails.
234
+ *
235
+ * @type Object
236
+ * @usage $.AdminLTE.layout.activate()
237
+ * $.AdminLTE.layout.fix()
238
+ * $.AdminLTE.layout.fixSidebar()
239
+ */
240
+ $.AdminLTE.layout = {
241
+ activate: function () {
242
+ var _this = this;
243
+ _this.fix();
244
+ _this.fixSidebar();
245
+ $(window, ".wrapper").resize(function () {
246
+ _this.fix();
247
+ _this.fixSidebar();
248
+ });
249
+ },
250
+ fix: function () {
251
+ //Get window height and the wrapper height
252
+ var neg = $('.main-header').outerHeight() + $('.main-footer').outerHeight();
253
+ var window_height = $(window).height();
254
+ var sidebar_height = $(".sidebar").height();
255
+ //Set the min-height of the content and sidebar based on the
256
+ //the height of the document.
257
+ if ($("body").hasClass("fixed")) {
258
+ $(".content-wrapper, .right-side").css('min-height', window_height - $('.main-footer').outerHeight());
259
+ } else {
260
+ var postSetWidth;
261
+ if (window_height >= sidebar_height) {
262
+ $(".content-wrapper, .right-side").css('min-height', window_height - neg);
263
+ postSetWidth = window_height - neg;
264
+ } else {
265
+ $(".content-wrapper, .right-side").css('min-height', sidebar_height);
266
+ postSetWidth = sidebar_height;
267
+ }
268
+
269
+ //Fix for the control sidebar height
270
+ var controlSidebar = $($.AdminLTE.options.controlSidebarOptions.selector);
271
+ if (typeof controlSidebar !== "undefined") {
272
+ if (controlSidebar.height() > postSetWidth)
273
+ $(".content-wrapper, .right-side").css('min-height', controlSidebar.height());
274
+ }
275
+
276
+ }
277
+ },
278
+ fixSidebar: function () {
279
+ //Make sure the body tag has the .fixed class
280
+ if (!$("body").hasClass("fixed")) {
281
+ if (typeof $.fn.slimScroll != 'undefined') {
282
+ $(".sidebar").slimScroll({destroy: true}).height("auto");
283
+ }
284
+ return;
285
+ } else if (typeof $.fn.slimScroll == 'undefined' && window.console) {
286
+ window.console.error("Error: the fixed layout requires the slimscroll plugin!");
287
+ }
288
+ //Enable slimscroll for fixed layout
289
+ if ($.AdminLTE.options.sidebarSlimScroll) {
290
+ if (typeof $.fn.slimScroll != 'undefined') {
291
+ //Destroy if it exists
292
+ $(".sidebar").slimScroll({destroy: true}).height("auto");
293
+ //Add slimscroll
294
+ $(".sidebar").slimscroll({
295
+ height: ($(window).height() - $(".main-header").height()) + "px",
296
+ color: "rgba(0,0,0,0.2)",
297
+ size: "3px"
298
+ });
299
+ }
300
+ }
301
+ }
302
+ };
303
+
304
+ /* PushMenu()
305
+ * ==========
306
+ * Adds the push menu functionality to the sidebar.
307
+ *
308
+ * @type Function
309
+ * @usage: $.AdminLTE.pushMenu("[data-toggle='offcanvas']")
310
+ */
311
+ $.AdminLTE.pushMenu = {
312
+ activate: function (toggleBtn) {
313
+ //Get the screen sizes
314
+ var screenSizes = $.AdminLTE.options.screenSizes;
315
+
316
+ //Enable sidebar toggle
317
+ $(document).on('click', toggleBtn, function (e) {
318
+ e.preventDefault();
319
+
320
+ //Enable sidebar push menu
321
+ if ($(window).width() > (screenSizes.sm - 1)) {
322
+ if ($("body").hasClass('sidebar-collapse')) {
323
+ $("body").removeClass('sidebar-collapse').trigger('expanded.pushMenu');
324
+ } else {
325
+ $("body").addClass('sidebar-collapse').trigger('collapsed.pushMenu');
326
+ }
327
+ }
328
+ //Handle sidebar push menu for small screens
329
+ else {
330
+ if ($("body").hasClass('sidebar-open')) {
331
+ $("body").removeClass('sidebar-open').removeClass('sidebar-collapse').trigger('collapsed.pushMenu');
332
+ } else {
333
+ $("body").addClass('sidebar-open').trigger('expanded.pushMenu');
334
+ }
335
+ }
336
+ });
337
+
338
+ $(".content-wrapper").click(function () {
339
+ //Enable hide menu when clicking on the content-wrapper on small screens
340
+ if ($(window).width() <= (screenSizes.sm - 1) && $("body").hasClass("sidebar-open")) {
341
+ $("body").removeClass('sidebar-open');
342
+ }
343
+ });
344
+
345
+ //Enable expand on hover for sidebar mini
346
+ if ($.AdminLTE.options.sidebarExpandOnHover
347
+ || ($('body').hasClass('fixed')
348
+ && $('body').hasClass('sidebar-mini'))) {
349
+ this.expandOnHover();
350
+ }
351
+ },
352
+ expandOnHover: function () {
353
+ var _this = this;
354
+ var screenWidth = $.AdminLTE.options.screenSizes.sm - 1;
355
+ //Expand sidebar on hover
356
+ $('.main-sidebar').hover(function () {
357
+ if ($('body').hasClass('sidebar-mini')
358
+ && $("body").hasClass('sidebar-collapse')
359
+ && $(window).width() > screenWidth) {
360
+ _this.expand();
361
+ }
362
+ }, function () {
363
+ if ($('body').hasClass('sidebar-mini')
364
+ && $('body').hasClass('sidebar-expanded-on-hover')
365
+ && $(window).width() > screenWidth) {
366
+ _this.collapse();
367
+ }
368
+ });
369
+ },
370
+ expand: function () {
371
+ $("body").removeClass('sidebar-collapse').addClass('sidebar-expanded-on-hover');
372
+ },
373
+ collapse: function () {
374
+ if ($('body').hasClass('sidebar-expanded-on-hover')) {
375
+ $('body').removeClass('sidebar-expanded-on-hover').addClass('sidebar-collapse');
376
+ }
377
+ }
378
+ };
379
+
380
+ /* Tree()
381
+ * ======
382
+ * Converts the sidebar into a multilevel
383
+ * tree view menu.
384
+ *
385
+ * @type Function
386
+ * @Usage: $.AdminLTE.tree('.sidebar')
387
+ */
388
+ $.AdminLTE.tree = function (menu) {
389
+ var _this = this;
390
+ var animationSpeed = $.AdminLTE.options.animationSpeed;
391
+ $(document).on('click', menu + ' li a', function (e) {
392
+ //Get the clicked link and the next element
393
+ var $this = $(this);
394
+ var checkElement = $this.next();
395
+
396
+ //Check if the next element is a menu and is visible
397
+ if ((checkElement.is('.treeview-menu')) && (checkElement.is(':visible')) && (!$('body').hasClass('sidebar-collapse'))) {
398
+ //Close the menu
399
+ checkElement.slideUp(animationSpeed, function () {
400
+ checkElement.removeClass('menu-open');
401
+ //Fix the layout in case the sidebar stretches over the height of the window
402
+ //_this.layout.fix();
403
+ });
404
+ checkElement.parent("li").removeClass("active");
405
+ }
406
+ //If the menu is not visible
407
+ else if ((checkElement.is('.treeview-menu')) && (!checkElement.is(':visible'))) {
408
+ //Get the parent menu
409
+ var parent = $this.parents('ul').first();
410
+ //Close all open menus within the parent
411
+ var ul = parent.find('ul:visible').slideUp(animationSpeed);
412
+ //Remove the menu-open class from the parent
413
+ ul.removeClass('menu-open');
414
+ //Get the parent li
415
+ var parent_li = $this.parent("li");
416
+
417
+ //Open the target menu and add the menu-open class
418
+ checkElement.slideDown(animationSpeed, function () {
419
+ //Add the class active to the parent li
420
+ checkElement.addClass('menu-open');
421
+ parent.find('li.active').removeClass('active');
422
+ parent_li.addClass('active');
423
+ //Fix the layout in case the sidebar stretches over the height of the window
424
+ _this.layout.fix();
425
+ });
426
+ }
427
+ //if this isn't a link, prevent the page from being redirected
428
+ if (checkElement.is('.treeview-menu')) {
429
+ e.preventDefault();
430
+ }
431
+ });
432
+ };
433
+
434
+ /* ControlSidebar
435
+ * ==============
436
+ * Adds functionality to the right sidebar
437
+ *
438
+ * @type Object
439
+ * @usage $.AdminLTE.controlSidebar.activate(options)
440
+ */
441
+ $.AdminLTE.controlSidebar = {
442
+ //instantiate the object
443
+ activate: function () {
444
+ //Get the object
445
+ var _this = this;
446
+ //Update options
447
+ var o = $.AdminLTE.options.controlSidebarOptions;
448
+ //Get the sidebar
449
+ var sidebar = $(o.selector);
450
+ //The toggle button
451
+ var btn = $(o.toggleBtnSelector);
452
+
453
+ //Listen to the click event
454
+ btn.on('click', function (e) {
455
+ e.preventDefault();
456
+ //If the sidebar is not open
457
+ if (!sidebar.hasClass('control-sidebar-open')
458
+ && !$('body').hasClass('control-sidebar-open')) {
459
+ //Open the sidebar
460
+ _this.open(sidebar, o.slide);
461
+ } else {
462
+ _this.close(sidebar, o.slide);
463
+ }
464
+ });
465
+
466
+ //If the body has a boxed layout, fix the sidebar bg position
467
+ var bg = $(".control-sidebar-bg");
468
+ _this._fix(bg);
469
+
470
+ //If the body has a fixed layout, make the control sidebar fixed
471
+ if ($('body').hasClass('fixed')) {
472
+ _this._fixForFixed(sidebar);
473
+ } else {
474
+ //If the content height is less than the sidebar's height, force max height
475
+ if ($('.content-wrapper, .right-side').height() < sidebar.height()) {
476
+ _this._fixForContent(sidebar);
477
+ }
478
+ }
479
+ },
480
+ //Open the control sidebar
481
+ open: function (sidebar, slide) {
482
+ //Slide over content
483
+ if (slide) {
484
+ sidebar.addClass('control-sidebar-open');
485
+ } else {
486
+ //Push the content by adding the open class to the body instead
487
+ //of the sidebar itself
488
+ $('body').addClass('control-sidebar-open');
489
+ }
490
+ },
491
+ //Close the control sidebar
492
+ close: function (sidebar, slide) {
493
+ if (slide) {
494
+ sidebar.removeClass('control-sidebar-open');
495
+ } else {
496
+ $('body').removeClass('control-sidebar-open');
497
+ }
498
+ },
499
+ _fix: function (sidebar) {
500
+ var _this = this;
501
+ if ($("body").hasClass('layout-boxed')) {
502
+ sidebar.css('position', 'absolute');
503
+ sidebar.height($(".wrapper").height());
504
+ $(window).resize(function () {
505
+ _this._fix(sidebar);
506
+ });
507
+ } else {
508
+ sidebar.css({
509
+ 'position': 'fixed',
510
+ 'height': 'auto'
511
+ });
512
+ }
513
+ },
514
+ _fixForFixed: function (sidebar) {
515
+ sidebar.css({
516
+ 'position': 'fixed',
517
+ 'max-height': '100%',
518
+ 'overflow': 'auto',
519
+ 'padding-bottom': '50px'
520
+ });
521
+ },
522
+ _fixForContent: function (sidebar) {
523
+ $(".content-wrapper, .right-side").css('min-height', sidebar.height());
524
+ }
525
+ };
526
+
527
+ /* BoxWidget
528
+ * =========
529
+ * BoxWidget is a plugin to handle collapsing and
530
+ * removing boxes from the screen.
531
+ *
532
+ * @type Object
533
+ * @usage $.AdminLTE.boxWidget.activate()
534
+ * Set all your options in the main $.AdminLTE.options object
535
+ */
536
+ $.AdminLTE.boxWidget = {
537
+ selectors: $.AdminLTE.options.boxWidgetOptions.boxWidgetSelectors,
538
+ icons: $.AdminLTE.options.boxWidgetOptions.boxWidgetIcons,
539
+ animationSpeed: $.AdminLTE.options.animationSpeed,
540
+ activate: function (_box) {
541
+ var _this = this;
542
+ if (!_box) {
543
+ _box = document; // activate all boxes per default
544
+ }
545
+ //Listen for collapse event triggers
546
+ $(_box).on('click', _this.selectors.collapse, function (e) {
547
+ e.preventDefault();
548
+ _this.collapse($(this));
549
+ });
550
+
551
+ //Listen for remove event triggers
552
+ $(_box).on('click', _this.selectors.remove, function (e) {
553
+ e.preventDefault();
554
+ _this.remove($(this));
555
+ });
556
+ },
557
+ collapse: function (element) {
558
+ var _this = this;
559
+ //Find the box parent
560
+ var box = element.parents(".box").first();
561
+ //Find the body and the footer
562
+ var box_content = box.find("> .box-body, > .box-footer, > form >.box-body, > form > .box-footer");
563
+ if (!box.hasClass("collapsed-box")) {
564
+ //Convert minus into plus
565
+ element.children(":first")
566
+ .removeClass(_this.icons.collapse)
567
+ .addClass(_this.icons.open);
568
+ //Hide the content
569
+ box_content.slideUp(_this.animationSpeed, function () {
570
+ box.addClass("collapsed-box");
571
+ });
572
+ } else {
573
+ //Convert plus into minus
574
+ element.children(":first")
575
+ .removeClass(_this.icons.open)
576
+ .addClass(_this.icons.collapse);
577
+ //Show the content
578
+ box_content.slideDown(_this.animationSpeed, function () {
579
+ box.removeClass("collapsed-box");
580
+ });
581
+ }
582
+ },
583
+ remove: function (element) {
584
+ //Find the box parent
585
+ var box = element.parents(".box").first();
586
+ box.slideUp(this.animationSpeed);
587
+ }
588
+ };
589
+ }
590
+
591
+ /* ------------------
592
+ * - Custom Plugins -
593
+ * ------------------
594
+ * All custom plugins are defined below.
595
+ */
596
+
597
+ /*
598
+ * BOX REFRESH BUTTON
599
+ * ------------------
600
+ * This is a custom plugin to use with the component BOX. It allows you to add
601
+ * a refresh button to the box. It converts the box's state to a loading state.
602
+ *
603
+ * @type plugin
604
+ * @usage $("#box-widget").boxRefresh( options );
605
+ */
606
+ (function ($) {
607
+
608
+ "use strict";
609
+
610
+ $.fn.boxRefresh = function (options) {
611
+
612
+ // Render options
613
+ var settings = $.extend({
614
+ //Refresh button selector
615
+ trigger: ".refresh-btn",
616
+ //File source to be loaded (e.g: ajax/src.php)
617
+ source: "",
618
+ //Callbacks
619
+ onLoadStart: function (box) {
620
+ return box;
621
+ }, //Right after the button has been clicked
622
+ onLoadDone: function (box) {
623
+ return box;
624
+ } //When the source has been loaded
625
+
626
+ }, options);
627
+
628
+ //The overlay
629
+ var overlay = $('<div class="overlay"><div class="fa fa-refresh fa-spin"></div></div>');
630
+
631
+ return this.each(function () {
632
+ //if a source is specified
633
+ if (settings.source === "") {
634
+ if (window.console) {
635
+ window.console.log("Please specify a source first - boxRefresh()");
636
+ }
637
+ return;
638
+ }
639
+ //the box
640
+ var box = $(this);
641
+ //the button
642
+ var rBtn = box.find(settings.trigger).first();
643
+
644
+ //On trigger click
645
+ rBtn.on('click', function (e) {
646
+ e.preventDefault();
647
+ //Add loading overlay
648
+ start(box);
649
+
650
+ //Perform ajax call
651
+ box.find(".box-body").load(settings.source, function () {
652
+ done(box);
653
+ });
654
+ });
655
+ });
656
+
657
+ function start(box) {
658
+ //Add overlay and loading img
659
+ box.append(overlay);
660
+
661
+ settings.onLoadStart.call(box);
662
+ }
663
+
664
+ function done(box) {
665
+ //Remove overlay and loading img
666
+ box.find(overlay).remove();
667
+
668
+ settings.onLoadDone.call(box);
669
+ }
670
+
671
+ };
672
+
673
+ })(jQuery);
674
+
675
+ /*
676
+ * EXPLICIT BOX CONTROLS
677
+ * -----------------------
678
+ * This is a custom plugin to use with the component BOX. It allows you to activate
679
+ * a box inserted in the DOM after the app.js was loaded, toggle and remove box.
680
+ *
681
+ * @type plugin
682
+ * @usage $("#box-widget").activateBox();
683
+ * @usage $("#box-widget").toggleBox();
684
+ * @usage $("#box-widget").removeBox();
685
+ */
686
+ (function ($) {
687
+
688
+ 'use strict';
689
+
690
+ $.fn.activateBox = function () {
691
+ $.AdminLTE.boxWidget.activate(this);
692
+ };
693
+
694
+ $.fn.toggleBox = function(){
695
+ var button = $($.AdminLTE.boxWidget.selectors.collapse, this);
696
+ $.AdminLTE.boxWidget.collapse(button);
697
+ };
698
+
699
+ $.fn.removeBox = function(){
700
+ var button = $($.AdminLTE.boxWidget.selectors.remove, this);
701
+ $.AdminLTE.boxWidget.remove(button);
702
+ };
703
+
704
+ })(jQuery);
705
+
706
+ /*
707
+ * TODO LIST CUSTOM PLUGIN
708
+ * -----------------------
709
+ * This plugin depends on iCheck plugin for checkbox and radio inputs
710
+ *
711
+ * @type plugin
712
+ * @usage $("#todo-widget").todolist( options );
713
+ */
714
+ (function ($) {
715
+
716
+ 'use strict';
717
+
718
+ $.fn.todolist = function (options) {
719
+ // Render options
720
+ var settings = $.extend({
721
+ //When the user checks the input
722
+ onCheck: function (ele) {
723
+ return ele;
724
+ },
725
+ //When the user unchecks the input
726
+ onUncheck: function (ele) {
727
+ return ele;
728
+ }
729
+ }, options);
730
+
731
+ return this.each(function () {
732
+
733
+ if (typeof $.fn.iCheck != 'undefined') {
734
+ $('input', this).on('ifChecked', function () {
735
+ var ele = $(this).parents("li").first();
736
+ ele.toggleClass("done");
737
+ settings.onCheck.call(ele);
738
+ });
739
+
740
+ $('input', this).on('ifUnchecked', function () {
741
+ var ele = $(this).parents("li").first();
742
+ ele.toggleClass("done");
743
+ settings.onUncheck.call(ele);
744
+ });
745
+ } else {
746
+ $('input', this).on('change', function () {
747
+ var ele = $(this).parents("li").first();
748
+ ele.toggleClass("done");
749
+ if ($('input', ele).is(":checked")) {
750
+ settings.onCheck.call(ele);
751
+ } else {
752
+ settings.onUncheck.call(ele);
753
+ }
754
+ });
755
+ }
756
+ });
757
+ };
758
+ }(jQuery));