|
|
@ -125,6 +125,9 @@ $(function () {
|
|
|
|
//Easy access to options
|
|
|
|
//Easy access to options
|
|
|
|
var o = $.AdminLTE.options;
|
|
|
|
var o = $.AdminLTE.options;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Set up the object
|
|
|
|
|
|
|
|
_init();
|
|
|
|
|
|
|
|
|
|
|
|
//Activate the layout maker
|
|
|
|
//Activate the layout maker
|
|
|
|
$.AdminLTE.layout.activate();
|
|
|
|
$.AdminLTE.layout.activate();
|
|
|
|
|
|
|
|
|
|
|
@ -183,218 +186,220 @@ $(function () {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/* ----------------------
|
|
|
|
/* ----------------------------------
|
|
|
|
* - AdminLTE Functions -
|
|
|
|
* - Initialize the AdminLTE Object -
|
|
|
|
* ----------------------
|
|
|
|
* ----------------------------------
|
|
|
|
* All AdminLTE functions are implemented below.
|
|
|
|
* All AdminLTE functions are implemented below.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
function _init() {
|
|
|
|
/* prepareLayout
|
|
|
|
|
|
|
|
* =============
|
|
|
|
/* Layout
|
|
|
|
* Fixes the layout height in case min-height fails.
|
|
|
|
* ======
|
|
|
|
*
|
|
|
|
* Fixes the layout height in case min-height fails.
|
|
|
|
* @type Object
|
|
|
|
*
|
|
|
|
* @usage $.AdminLTE.layout.activate()
|
|
|
|
* @type Object
|
|
|
|
* $.AdminLTE.layout.fix()
|
|
|
|
* @usage $.AdminLTE.layout.activate()
|
|
|
|
* $.AdminLTE.layout.fixSidebar()
|
|
|
|
* $.AdminLTE.layout.fix()
|
|
|
|
*/
|
|
|
|
* $.AdminLTE.layout.fixSidebar()
|
|
|
|
$.AdminLTE.layout = {
|
|
|
|
*/
|
|
|
|
activate: function () {
|
|
|
|
$.AdminLTE.layout = {
|
|
|
|
var _this = this;
|
|
|
|
activate: function () {
|
|
|
|
_this.fix();
|
|
|
|
var _this = this;
|
|
|
|
_this.fixSidebar();
|
|
|
|
|
|
|
|
$(window, ".wrapper").resize(function () {
|
|
|
|
|
|
|
|
_this.fix();
|
|
|
|
_this.fix();
|
|
|
|
_this.fixSidebar();
|
|
|
|
_this.fixSidebar();
|
|
|
|
});
|
|
|
|
$(window, ".wrapper").resize(function () {
|
|
|
|
},
|
|
|
|
_this.fix();
|
|
|
|
fix: function () {
|
|
|
|
_this.fixSidebar();
|
|
|
|
//Get window height and the wrapper height
|
|
|
|
});
|
|
|
|
var neg = $('.main-header').outerHeight() + $('.main-footer').outerHeight();
|
|
|
|
},
|
|
|
|
var window_height = $(window).height();
|
|
|
|
fix: function () {
|
|
|
|
var sidebar_height = $(".sidebar").height();
|
|
|
|
//Get window height and the wrapper height
|
|
|
|
//Set the min-height of the content and sidebar based on the
|
|
|
|
var neg = $('.main-header').outerHeight() + $('.main-footer').outerHeight();
|
|
|
|
//the height of the document.
|
|
|
|
var window_height = $(window).height();
|
|
|
|
if ($("body").hasClass("fixed")) {
|
|
|
|
var sidebar_height = $(".sidebar").height();
|
|
|
|
$(".content-wrapper, .right-side").css('min-height', window_height - $('.main-footer').outerHeight());
|
|
|
|
//Set the min-height of the content and sidebar based on the
|
|
|
|
} else {
|
|
|
|
//the height of the document.
|
|
|
|
if (window_height >= sidebar_height) {
|
|
|
|
if ($("body").hasClass("fixed")) {
|
|
|
|
$(".content-wrapper, .right-side").css('min-height', window_height - neg);
|
|
|
|
$(".content-wrapper, .right-side").css('min-height', window_height - $('.main-footer').outerHeight());
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$(".content-wrapper, .right-side").css('min-height', sidebar_height);
|
|
|
|
if (window_height >= sidebar_height) {
|
|
|
|
|
|
|
|
$(".content-wrapper, .right-side").css('min-height', window_height - neg);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$(".content-wrapper, .right-side").css('min-height', sidebar_height);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
fixSidebar: function () {
|
|
|
|
fixSidebar: function () {
|
|
|
|
//Make sure the body tag has the .fixed class
|
|
|
|
//Make sure the body tag has the .fixed class
|
|
|
|
if (!$("body").hasClass("fixed")) {
|
|
|
|
if (!$("body").hasClass("fixed")) {
|
|
|
|
if (typeof $.fn.slimScroll != 'undefined') {
|
|
|
|
if (typeof $.fn.slimScroll != 'undefined') {
|
|
|
|
$(".sidebar").slimScroll({destroy: true}).height("auto");
|
|
|
|
$(".sidebar").slimScroll({destroy: true}).height("auto");
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
} else if (typeof $.fn.slimScroll == 'undefined' && console) {
|
|
|
|
|
|
|
|
console.error("Error: the fixed layout requires the slimscroll plugin!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
//Enable slimscroll for fixed layout
|
|
|
|
} else if (typeof $.fn.slimScroll == 'undefined' && console) {
|
|
|
|
if ($.AdminLTE.options.sidebarSlimScroll) {
|
|
|
|
console.error("Error: the fixed layout requires the slimscroll plugin!");
|
|
|
|
if (typeof $.fn.slimScroll != 'undefined') {
|
|
|
|
}
|
|
|
|
//Distroy if it exists
|
|
|
|
//Enable slimscroll for fixed layout
|
|
|
|
$(".sidebar").slimScroll({destroy: true}).height("auto");
|
|
|
|
if ($.AdminLTE.options.sidebarSlimScroll) {
|
|
|
|
//Add slimscroll
|
|
|
|
if (typeof $.fn.slimScroll != 'undefined') {
|
|
|
|
$(".sidebar").slimscroll({
|
|
|
|
//Distroy if it exists
|
|
|
|
height: ($(window).height() - $(".main-header").height()) + "px",
|
|
|
|
$(".sidebar").slimScroll({destroy: true}).height("auto");
|
|
|
|
color: "rgba(0,0,0,0.2)",
|
|
|
|
//Add slimscroll
|
|
|
|
size: "3px"
|
|
|
|
$(".sidebar").slimscroll({
|
|
|
|
});
|
|
|
|
height: ($(window).height() - $(".main-header").height()) + "px",
|
|
|
|
}
|
|
|
|
color: "rgba(0,0,0,0.2)",
|
|
|
|
|
|
|
|
size: "3px"
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* PushMenu()
|
|
|
|
/* PushMenu()
|
|
|
|
* ==========
|
|
|
|
* ==========
|
|
|
|
* Adds the push menu functionality to the sidebar.
|
|
|
|
* Adds the push menu functionality to the sidebar.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @type Function
|
|
|
|
* @type Function
|
|
|
|
* @usage: $.AdminLTE.pushMenu("[data-toggle='offcanvas']")
|
|
|
|
* @usage: $.AdminLTE.pushMenu("[data-toggle='offcanvas']")
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
$.AdminLTE.pushMenu = function (toggleBtn) {
|
|
|
|
$.AdminLTE.pushMenu = function (toggleBtn) {
|
|
|
|
//Get the screen sizes
|
|
|
|
//Get the screen sizes
|
|
|
|
var screenSizes = this.options.screenSizes;
|
|
|
|
var screenSizes = this.options.screenSizes;
|
|
|
|
|
|
|
|
|
|
|
|
//Enable sidebar toggle
|
|
|
|
//Enable sidebar toggle
|
|
|
|
$(toggleBtn).click(function (e) {
|
|
|
|
$(toggleBtn).click(function (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
|
|
//Enable sidebar push menu
|
|
|
|
//Enable sidebar push menu
|
|
|
|
if ($(window).width() > (screenSizes.sm - 1)) {
|
|
|
|
if ($(window).width() > (screenSizes.sm - 1)) {
|
|
|
|
$("body").toggleClass('sidebar-collapse');
|
|
|
|
$("body").toggleClass('sidebar-collapse');
|
|
|
|
}
|
|
|
|
|
|
|
|
//Handle sidebar push menu for small screens
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
if ($("body").hasClass('sidebar-open')) {
|
|
|
|
|
|
|
|
$("body").removeClass('sidebar-open');
|
|
|
|
|
|
|
|
$("body").removeClass('sidebar-collapse')
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$("body").addClass('sidebar-open');
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//Handle sidebar push menu for small screens
|
|
|
|
});
|
|
|
|
else {
|
|
|
|
|
|
|
|
if ($("body").hasClass('sidebar-open')) {
|
|
|
|
$(".content-wrapper").click(function () {
|
|
|
|
$("body").removeClass('sidebar-open');
|
|
|
|
//Enable hide menu when clicking on the content-wrapper on small screens
|
|
|
|
$("body").removeClass('sidebar-collapse')
|
|
|
|
if ($(window).width() <= (screenSizes.sm - 1) && $("body").hasClass("sidebar-open")) {
|
|
|
|
} else {
|
|
|
|
$("body").removeClass('sidebar-open');
|
|
|
|
$("body").addClass('sidebar-open');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
$(".content-wrapper").click(function () {
|
|
|
|
|
|
|
|
//Enable hide menu when clicking on the content-wrapper on small screens
|
|
|
|
|
|
|
|
if ($(window).width() <= (screenSizes.sm - 1) && $("body").hasClass("sidebar-open")) {
|
|
|
|
|
|
|
|
$("body").removeClass('sidebar-open');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/* Tree()
|
|
|
|
};
|
|
|
|
* ======
|
|
|
|
|
|
|
|
* Converts the sidebar into a multilevel
|
|
|
|
|
|
|
|
* tree view menu.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @type Function
|
|
|
|
|
|
|
|
* @Usage: $.AdminLTE.tree('.sidebar')
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
$.AdminLTE.tree = function (menu) {
|
|
|
|
|
|
|
|
var _this = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("li a", $(menu)).click(function (e) {
|
|
|
|
|
|
|
|
//Get the clicked link and the next element
|
|
|
|
|
|
|
|
var $this = $(this);
|
|
|
|
|
|
|
|
var checkElement = $this.next();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Check if the next element is a menu and is visible
|
|
|
|
|
|
|
|
if ((checkElement.is('.treeview-menu')) && (checkElement.is(':visible'))) {
|
|
|
|
|
|
|
|
//Close the menu
|
|
|
|
|
|
|
|
checkElement.slideUp('normal', function () {
|
|
|
|
|
|
|
|
checkElement.removeClass('menu-open');
|
|
|
|
|
|
|
|
//Fix the layout in case the sidebar stretches over the height of the window
|
|
|
|
|
|
|
|
//_this.layout.fix();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
checkElement.parent("li").removeClass("active");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//If the menu is not visible
|
|
|
|
|
|
|
|
else if ((checkElement.is('.treeview-menu')) && (!checkElement.is(':visible'))) {
|
|
|
|
|
|
|
|
//Get the parent menu
|
|
|
|
|
|
|
|
var parent = $this.parents('ul').first();
|
|
|
|
|
|
|
|
//Close all open menus within the parent
|
|
|
|
|
|
|
|
var ul = parent.find('ul:visible').slideUp('normal');
|
|
|
|
|
|
|
|
//Remove the menu-open class from the parent
|
|
|
|
|
|
|
|
ul.removeClass('menu-open');
|
|
|
|
|
|
|
|
//Get the parent li
|
|
|
|
|
|
|
|
var parent_li = $this.parent("li");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Open the target menu and add the menu-open class
|
|
|
|
|
|
|
|
checkElement.slideDown('normal', function () {
|
|
|
|
|
|
|
|
//Add the class active to the parent li
|
|
|
|
|
|
|
|
checkElement.addClass('menu-open');
|
|
|
|
|
|
|
|
parent.find('li.active').removeClass('active');
|
|
|
|
|
|
|
|
parent_li.addClass('active');
|
|
|
|
|
|
|
|
//Fix the layout in case the sidebar stretches over the height of the window
|
|
|
|
|
|
|
|
_this.layout.fix();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//if this isn't a link, prevent the page from being redirected
|
|
|
|
|
|
|
|
if (checkElement.is('.treeview-menu')) {
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* BoxWidget
|
|
|
|
/* Tree()
|
|
|
|
* =========
|
|
|
|
* ======
|
|
|
|
* BoxWidget is plugin to handle collapsing and
|
|
|
|
* Converts the sidebar into a multilevel
|
|
|
|
* removing boxes from the screen.
|
|
|
|
* tree view menu.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @type Object
|
|
|
|
* @type Function
|
|
|
|
* @usage $.AdminLTE.boxWidget.activate()
|
|
|
|
* @Usage: $.AdminLTE.tree('.sidebar')
|
|
|
|
* Set all of your option in the main $.AdminLTE.options object
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
$.AdminLTE.tree = function (menu) {
|
|
|
|
$.AdminLTE.boxWidget = {
|
|
|
|
|
|
|
|
activate: function () {
|
|
|
|
|
|
|
|
var o = $.AdminLTE.options;
|
|
|
|
|
|
|
|
var _this = this;
|
|
|
|
var _this = this;
|
|
|
|
//Listen for collapse event triggers
|
|
|
|
|
|
|
|
$(o.boxWidgetOptions.boxWidgetSelectors.collapse).click(function (e) {
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
_this.collapse($(this));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Listen for remove event triggers
|
|
|
|
$("li a", $(menu)).click(function (e) {
|
|
|
|
$(o.boxWidgetOptions.boxWidgetSelectors.remove).click(function (e) {
|
|
|
|
//Get the clicked link and the next element
|
|
|
|
e.preventDefault();
|
|
|
|
var $this = $(this);
|
|
|
|
_this.remove($(this));
|
|
|
|
var checkElement = $this.next();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Check if the next element is a menu and is visible
|
|
|
|
|
|
|
|
if ((checkElement.is('.treeview-menu')) && (checkElement.is(':visible'))) {
|
|
|
|
|
|
|
|
//Close the menu
|
|
|
|
|
|
|
|
checkElement.slideUp('normal', function () {
|
|
|
|
|
|
|
|
checkElement.removeClass('menu-open');
|
|
|
|
|
|
|
|
//Fix the layout in case the sidebar stretches over the height of the window
|
|
|
|
|
|
|
|
//_this.layout.fix();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
checkElement.parent("li").removeClass("active");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//If the menu is not visible
|
|
|
|
|
|
|
|
else if ((checkElement.is('.treeview-menu')) && (!checkElement.is(':visible'))) {
|
|
|
|
|
|
|
|
//Get the parent menu
|
|
|
|
|
|
|
|
var parent = $this.parents('ul').first();
|
|
|
|
|
|
|
|
//Close all open menus within the parent
|
|
|
|
|
|
|
|
var ul = parent.find('ul:visible').slideUp('normal');
|
|
|
|
|
|
|
|
//Remove the menu-open class from the parent
|
|
|
|
|
|
|
|
ul.removeClass('menu-open');
|
|
|
|
|
|
|
|
//Get the parent li
|
|
|
|
|
|
|
|
var parent_li = $this.parent("li");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Open the target menu and add the menu-open class
|
|
|
|
|
|
|
|
checkElement.slideDown('normal', function () {
|
|
|
|
|
|
|
|
//Add the class active to the parent li
|
|
|
|
|
|
|
|
checkElement.addClass('menu-open');
|
|
|
|
|
|
|
|
parent.find('li.active').removeClass('active');
|
|
|
|
|
|
|
|
parent_li.addClass('active');
|
|
|
|
|
|
|
|
//Fix the layout in case the sidebar stretches over the height of the window
|
|
|
|
|
|
|
|
_this.layout.fix();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//if this isn't a link, prevent the page from being redirected
|
|
|
|
|
|
|
|
if (checkElement.is('.treeview-menu')) {
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
};
|
|
|
|
collapse: function (element) {
|
|
|
|
|
|
|
|
//Find the box parent
|
|
|
|
/* BoxWidget
|
|
|
|
var box = element.parents(".box").first();
|
|
|
|
* =========
|
|
|
|
//Find the body and the footer
|
|
|
|
* BoxWidget is plugin to handle collapsing and
|
|
|
|
var bf = box.find(".box-body, .box-footer");
|
|
|
|
* removing boxes from the screen.
|
|
|
|
if (!box.hasClass("collapsed-box")) {
|
|
|
|
*
|
|
|
|
//Convert minus into plus
|
|
|
|
* @type Object
|
|
|
|
element.children(".fa-minus").removeClass("fa-minus").addClass("fa-plus");
|
|
|
|
* @usage $.AdminLTE.boxWidget.activate()
|
|
|
|
bf.slideUp(300, function () {
|
|
|
|
* Set all of your option in the main $.AdminLTE.options object
|
|
|
|
box.addClass("collapsed-box");
|
|
|
|
*/
|
|
|
|
|
|
|
|
$.AdminLTE.boxWidget = {
|
|
|
|
|
|
|
|
activate: function () {
|
|
|
|
|
|
|
|
var o = $.AdminLTE.options;
|
|
|
|
|
|
|
|
var _this = this;
|
|
|
|
|
|
|
|
//Listen for collapse event triggers
|
|
|
|
|
|
|
|
$(o.boxWidgetOptions.boxWidgetSelectors.collapse).click(function (e) {
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
_this.collapse($(this));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
|
|
|
|
//Convert plus into minus
|
|
|
|
//Listen for remove event triggers
|
|
|
|
element.children(".fa-plus").removeClass("fa-plus").addClass("fa-minus");
|
|
|
|
$(o.boxWidgetOptions.boxWidgetSelectors.remove).click(function (e) {
|
|
|
|
bf.slideDown(300, function () {
|
|
|
|
e.preventDefault();
|
|
|
|
box.removeClass("collapsed-box");
|
|
|
|
_this.remove($(this));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
collapse: function (element) {
|
|
|
|
remove: function (element) {
|
|
|
|
//Find the box parent
|
|
|
|
//Find the box parent
|
|
|
|
var box = element.parents(".box").first();
|
|
|
|
var box = element.parents(".box").first();
|
|
|
|
//Find the body and the footer
|
|
|
|
box.slideUp();
|
|
|
|
var bf = box.find(".box-body, .box-footer");
|
|
|
|
},
|
|
|
|
if (!box.hasClass("collapsed-box")) {
|
|
|
|
options: $.AdminLTE.options.boxWidgetOptions
|
|
|
|
//Convert minus into plus
|
|
|
|
};
|
|
|
|
element.children(".fa-minus").removeClass("fa-minus").addClass("fa-plus");
|
|
|
|
|
|
|
|
bf.slideUp(300, function () {
|
|
|
|
|
|
|
|
box.addClass("collapsed-box");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
//Convert plus into minus
|
|
|
|
|
|
|
|
element.children(".fa-plus").removeClass("fa-plus").addClass("fa-minus");
|
|
|
|
|
|
|
|
bf.slideDown(300, function () {
|
|
|
|
|
|
|
|
box.removeClass("collapsed-box");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
remove: function (element) {
|
|
|
|
|
|
|
|
//Find the box parent
|
|
|
|
|
|
|
|
var box = element.parents(".box").first();
|
|
|
|
|
|
|
|
box.slideUp();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
options: $.AdminLTE.options.boxWidgetOptions
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ------------------
|
|
|
|
/* ------------------
|
|
|
|
* - Custom Plugins -
|
|
|
|
* - Custom Plugins -
|
|
|
|