From b5d80605b8be7a66253a65bbb722ac376ac0b1a1 Mon Sep 17 00:00:00 2001 From: amosfolz <33728190+amosfolz@users.noreply.github.com> Date: Sun, 14 Jul 2019 13:57:29 -0400 Subject: [PATCH] Fix AdmiteLTE.js --- .../core/assets/userfrosting/js/AdminLTE.js | 300 +++++++++--------- 1 file changed, 151 insertions(+), 149 deletions(-) diff --git a/app/sprinkles/core/assets/userfrosting/js/AdminLTE.js b/app/sprinkles/core/assets/userfrosting/js/AdminLTE.js index ed630625c..1dbdd9f55 100644 --- a/app/sprinkles/core/assets/userfrosting/js/AdminLTE.js +++ b/app/sprinkles/core/assets/userfrosting/js/AdminLTE.js @@ -623,152 +623,154 @@ function _init() { */ (function($) { - "use strict"; - - $.fn.boxRefresh = function(options) { - - // Render options - var settings = $.extend({ - //Refresh button selector - trigger: ".refresh-btn", - //File source to be loaded (e.g: ajax/src.php) - source: "", - //Callbacks - onLoadStart: function(box) { - return box; - }, //Right after the button has been clicked - onLoadDone: function(box) { - return box; - } //When the source has been loaded - - }, options); - - //The overlay - var overlay = $('
'); - - return this.each(function() { - //if a source is specified - if (settings.source === "") { - if (window.console) { - window.console.log("Please specify a source first - boxRefresh()"); - } - return; - } - //the box - var box = $(this); - //the button - var rBtn = box.find(settings.trigger).first(); - - //On trigger click - rBtn.on('click', function(e) { - e.preventDefault(); - //Add loading overlay - start(box); - - //Perform ajax call - box.find(".box-body").load(settings.source, function() { - done(box); - }); - - function start(box) { - //Add overlay and loading img - box.append(overlay); - - settings.onLoadStart.call(box); - } - - function done(box) { - //Remove overlay and loading img - box.find(overlay).remove(); - - settings.onLoadDone.call(box); - } - - }; - - })(jQuery); - - /* - * EXPLICIT BOX CONTROLS - * ----------------------- - * This is a custom plugin to use with the component BOX. It allows you to activate - * a box inserted in the DOM after the app.js was loaded, toggle and remove box. - * - * @type plugin - * @usage $("#box-widget").activateBox(); - * @usage $("#box-widget").toggleBox(); - * @usage $("#box-widget").removeBox(); - */ - (function($) { - - 'use strict'; - - $.fn.activateBox = function() { - $.AdminLTE.boxWidget.activate(this); - }; - - $.fn.toggleBox = function() { - var button = $($.AdminLTE.boxWidget.selectors.collapse, this); - $.AdminLTE.boxWidget.collapse(button); - }; - - $.fn.removeBox = function() { - var button = $($.AdminLTE.boxWidget.selectors.remove, this); - $.AdminLTE.boxWidget.remove(button); - }; - - })(jQuery); - - /* - * TODO LIST CUSTOM PLUGIN - * ----------------------- - * This plugin depends on iCheck plugin for checkbox and radio inputs - * - * @type plugin - * @usage $("#todo-widget").todolist( options ); - */ - (function($) { - - 'use strict'; - - $.fn.todolist = function(options) { - // Render options - var settings = $.extend({ - //When the user checks the input - onCheck: function(ele) { - return ele; - }, - //When the user unchecks the input - onUncheck: function(ele) { - return ele; - } - }, options); - - return this.each(function() { - - if (typeof $.fn.iCheck != 'undefined') { - $('input', this).on('ifChecked', function() { - var ele = $(this).parents("li").first(); - ele.toggleClass("done"); - settings.onCheck.call(ele); - }); - - $('input', this).on('ifUnchecked', function() { - var ele = $(this).parents("li").first(); - ele.toggleClass("done"); - settings.onUncheck.call(ele); - }); - } else { - $('input', this).on('change', function() { - var ele = $(this).parents("li").first(); - ele.toggleClass("done"); - if ($('input', ele).is(":checked")) { - settings.onCheck.call(ele); - } else { - settings.onUncheck.call(ele); - } - }); - } - }); - }; - }(jQuery)); \ No newline at end of file + "use strict"; + + $.fn.boxRefresh = function(options) { + + // Render options + var settings = $.extend({ + //Refresh button selector + trigger: ".refresh-btn", + //File source to be loaded (e.g: ajax/src.php) + source: "", + //Callbacks + onLoadStart: function(box) { + return box; + }, //Right after the button has been clicked + onLoadDone: function(box) { + return box; + } //When the source has been loaded + + }, options); + + //The overlay + var overlay = $(' '); + + return this.each(function() { + //if a source is specified + if (settings.source === "") { + if (window.console) { + window.console.log("Please specify a source first - boxRefresh()"); + } + return; + } + //the box + var box = $(this); + //the button + var rBtn = box.find(settings.trigger).first(); + + //On trigger click + rBtn.on('click', function(e) { + e.preventDefault(); + //Add loading overlay + start(box); + + //Perform ajax call + box.find(".box-body").load(settings.source, function() { + done(box); + }); + }); + }); + + function start(box) { + //Add overlay and loading img + box.append(overlay); + + settings.onLoadStart.call(box); + } + + function done(box) { + //Remove overlay and loading img + box.find(overlay).remove(); + + settings.onLoadDone.call(box); + } + + }; + +})(jQuery); + +/* + * EXPLICIT BOX CONTROLS + * ----------------------- + * This is a custom plugin to use with the component BOX. It allows you to activate + * a box inserted in the DOM after the app.js was loaded, toggle and remove box. + * + * @type plugin + * @usage $("#box-widget").activateBox(); + * @usage $("#box-widget").toggleBox(); + * @usage $("#box-widget").removeBox(); + */ +(function($) { + + 'use strict'; + + $.fn.activateBox = function() { + $.AdminLTE.boxWidget.activate(this); + }; + + $.fn.toggleBox = function() { + var button = $($.AdminLTE.boxWidget.selectors.collapse, this); + $.AdminLTE.boxWidget.collapse(button); + }; + + $.fn.removeBox = function() { + var button = $($.AdminLTE.boxWidget.selectors.remove, this); + $.AdminLTE.boxWidget.remove(button); + }; + +})(jQuery); + +/* + * TODO LIST CUSTOM PLUGIN + * ----------------------- + * This plugin depends on iCheck plugin for checkbox and radio inputs + * + * @type plugin + * @usage $("#todo-widget").todolist( options ); + */ +(function($) { + + 'use strict'; + + $.fn.todolist = function(options) { + // Render options + var settings = $.extend({ + //When the user checks the input + onCheck: function(ele) { + return ele; + }, + //When the user unchecks the input + onUncheck: function(ele) { + return ele; + } + }, options); + + return this.each(function() { + + if (typeof $.fn.iCheck != 'undefined') { + $('input', this).on('ifChecked', function() { + var ele = $(this).parents("li").first(); + ele.toggleClass("done"); + settings.onCheck.call(ele); + }); + + $('input', this).on('ifUnchecked', function() { + var ele = $(this).parents("li").first(); + ele.toggleClass("done"); + settings.onUncheck.call(ele); + }); + } else { + $('input', this).on('change', function() { + var ele = $(this).parents("li").first(); + ele.toggleClass("done"); + if ($('input', ele).is(":checked")) { + settings.onCheck.call(ele); + } else { + settings.onUncheck.call(ele); + } + }); + } + }); + }; +}(jQuery)); \ No newline at end of file