add admin files
This commit is contained in:
502
public/assets/admin/js/bootstrap-checkbox-radio-switch.js
vendored
Normal file
502
public/assets/admin/js/bootstrap-checkbox-radio-switch.js
vendored
Normal file
@@ -0,0 +1,502 @@
|
||||
!function ($) {
|
||||
|
||||
/* CHECKBOX PUBLIC CLASS DEFINITION
|
||||
* ============================== */
|
||||
|
||||
var Checkbox = function (element, options) {
|
||||
this.init(element, options);
|
||||
}
|
||||
|
||||
Checkbox.prototype = {
|
||||
|
||||
constructor: Checkbox
|
||||
|
||||
, init: function (element, options) {
|
||||
var $el = this.$element = $(element)
|
||||
|
||||
this.options = $.extend({}, $.fn.checkbox.defaults, options);
|
||||
$el.before(this.options.template);
|
||||
this.setState();
|
||||
}
|
||||
|
||||
, setState: function () {
|
||||
var $el = this.$element
|
||||
, $parent = $el.closest('.checkbox');
|
||||
|
||||
$el.prop('disabled') && $parent.addClass('disabled');
|
||||
$el.prop('checked') && $parent.addClass('checked');
|
||||
}
|
||||
|
||||
, toggle: function () {
|
||||
var ch = 'checked'
|
||||
, $el = this.$element
|
||||
, $parent = $el.closest('.checkbox')
|
||||
, checked = $el.prop(ch)
|
||||
, e = $.Event('toggle')
|
||||
|
||||
if ($el.prop('disabled') == false) {
|
||||
$parent.toggleClass(ch) && checked ? $el.removeAttr(ch) : $el.prop(ch, ch);
|
||||
$el.trigger(e).trigger('change');
|
||||
}
|
||||
}
|
||||
|
||||
, setCheck: function (option) {
|
||||
var d = 'disabled'
|
||||
, ch = 'checked'
|
||||
, $el = this.$element
|
||||
, $parent = $el.closest('.checkbox')
|
||||
, checkAction = option == 'check' ? true : false
|
||||
, e = $.Event(option)
|
||||
|
||||
$parent[checkAction ? 'addClass' : 'removeClass' ](ch) && checkAction ? $el.prop(ch, ch) : $el.removeAttr(ch);
|
||||
$el.trigger(e).trigger('change');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* CHECKBOX PLUGIN DEFINITION
|
||||
* ======================== */
|
||||
|
||||
var old = $.fn.checkbox
|
||||
|
||||
$.fn.checkbox = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
, data = $this.data('checkbox')
|
||||
, options = $.extend({}, $.fn.checkbox.defaults, $this.data(), typeof option == 'object' && option);
|
||||
if (!data) $this.data('checkbox', (data = new Checkbox(this, options)));
|
||||
if (option == 'toggle') data.toggle()
|
||||
if (option == 'check' || option == 'uncheck') data.setCheck(option)
|
||||
else if (option) data.setState();
|
||||
});
|
||||
}
|
||||
|
||||
$.fn.checkbox.defaults = {
|
||||
template: '<span class="icons"><span class="first-icon fa fa-square-o"></span><span class="second-icon fa fa-check-square-o"></span></span>'
|
||||
}
|
||||
|
||||
|
||||
/* CHECKBOX NO CONFLICT
|
||||
* ================== */
|
||||
|
||||
$.fn.checkbox.noConflict = function () {
|
||||
$.fn.checkbox = old;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/* CHECKBOX DATA-API
|
||||
* =============== */
|
||||
|
||||
$(document).on('click.checkbox.data-api', '[data-toggle^=checkbox], .checkbox', function (e) {
|
||||
var $checkbox = $(e.target);
|
||||
if (e.target.tagName != "A") {
|
||||
e && e.preventDefault() && e.stopPropagation();
|
||||
if (!$checkbox.hasClass('checkbox')) $checkbox = $checkbox.closest('.checkbox');
|
||||
$checkbox.find(':checkbox').checkbox('toggle');
|
||||
}
|
||||
});
|
||||
|
||||
$(function () {
|
||||
$('[data-toggle="checkbox"]').each(function () {
|
||||
var $checkbox = $(this);
|
||||
$checkbox.checkbox();
|
||||
});
|
||||
});
|
||||
|
||||
}(window.jQuery);
|
||||
|
||||
|
||||
|
||||
/* =============================================================
|
||||
* flatui-radio v0.0.3
|
||||
* ============================================================ */
|
||||
|
||||
!function ($) {
|
||||
|
||||
/* RADIO PUBLIC CLASS DEFINITION
|
||||
* ============================== */
|
||||
|
||||
var Radio = function (element, options) {
|
||||
this.init(element, options);
|
||||
}
|
||||
|
||||
Radio.prototype = {
|
||||
|
||||
constructor: Radio
|
||||
|
||||
, init: function (element, options) {
|
||||
var $el = this.$element = $(element)
|
||||
|
||||
this.options = $.extend({}, $.fn.radio.defaults, options);
|
||||
$el.before(this.options.template);
|
||||
this.setState();
|
||||
}
|
||||
|
||||
, setState: function () {
|
||||
var $el = this.$element
|
||||
, $parent = $el.closest('.radio');
|
||||
|
||||
$el.prop('disabled') && $parent.addClass('disabled');
|
||||
$el.prop('checked') && $parent.addClass('checked');
|
||||
}
|
||||
|
||||
, toggle: function () {
|
||||
var d = 'disabled'
|
||||
, ch = 'checked'
|
||||
, $el = this.$element
|
||||
, checked = $el.prop(ch)
|
||||
, $parent = $el.closest('.radio')
|
||||
, $parentWrap = $el.closest('form').length ? $el.closest('form') : $el.closest('body')
|
||||
, $elemGroup = $parentWrap.find(':radio[name="' + $el.attr('name') + '"]')
|
||||
, e = $.Event('toggle')
|
||||
|
||||
if ($el.prop(d) == false) {
|
||||
$elemGroup.not($el).each(function () {
|
||||
var $el = $(this)
|
||||
, $parent = $(this).closest('.radio');
|
||||
|
||||
if ($el.prop(d) == false) {
|
||||
$parent.removeClass(ch) && $el.removeAttr(ch).trigger('change');
|
||||
}
|
||||
});
|
||||
|
||||
if (checked == false) $parent.addClass(ch) && $el.prop(ch, true);
|
||||
$el.trigger(e);
|
||||
|
||||
if (checked !== $el.prop(ch)) {
|
||||
$el.trigger('change');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
, setCheck: function (option) {
|
||||
var ch = 'checked'
|
||||
, $el = this.$element
|
||||
, $parent = $el.closest('.radio')
|
||||
, checkAction = option == 'check' ? true : false
|
||||
, checked = $el.prop(ch)
|
||||
, $parentWrap = $el.closest('form').length ? $el.closest('form') : $el.closest('body')
|
||||
, $elemGroup = $parentWrap.find(':radio[name="' + $el['attr']('name') + '"]')
|
||||
, e = $.Event(option)
|
||||
|
||||
$elemGroup.not($el).each(function () {
|
||||
var $el = $(this)
|
||||
, $parent = $(this).closest('.radio');
|
||||
|
||||
$parent.removeClass(ch) && $el.removeAttr(ch);
|
||||
});
|
||||
|
||||
$parent[checkAction ? 'addClass' : 'removeClass'](ch) && checkAction ? $el.prop(ch, ch) : $el.removeAttr(ch);
|
||||
$el.trigger(e);
|
||||
|
||||
if (checked !== $el.prop(ch)) {
|
||||
$el.trigger('change');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* RADIO PLUGIN DEFINITION
|
||||
* ======================== */
|
||||
|
||||
var old = $.fn.radio
|
||||
|
||||
$.fn.radio = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
, data = $this.data('radio')
|
||||
, options = $.extend({}, $.fn.radio.defaults, $this.data(), typeof option == 'object' && option);
|
||||
if (!data) $this.data('radio', (data = new Radio(this, options)));
|
||||
if (option == 'toggle') data.toggle()
|
||||
if (option == 'check' || option == 'uncheck') data.setCheck(option)
|
||||
else if (option) data.setState();
|
||||
});
|
||||
}
|
||||
|
||||
$.fn.radio.defaults = {
|
||||
template: '<span class="icons"><span class="first-icon fa fa-circle-o"></span><span class="second-icon fa fa-dot-circle-o"></span></span>'
|
||||
}
|
||||
|
||||
|
||||
/* RADIO NO CONFLICT
|
||||
* ================== */
|
||||
|
||||
$.fn.radio.noConflict = function () {
|
||||
$.fn.radio = old;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/* RADIO DATA-API
|
||||
* =============== */
|
||||
|
||||
$(document).on('click.radio.data-api', '[data-toggle^=radio], .radio', function (e) {
|
||||
var $radio = $(e.target);
|
||||
e && e.preventDefault() && e.stopPropagation();
|
||||
if (!$radio.hasClass('radio')) $radio = $radio.closest('.radio');
|
||||
$radio.find(':radio').radio('toggle');
|
||||
});
|
||||
|
||||
$(function () {
|
||||
$('[data-toggle="radio"]').each(function () {
|
||||
var $radio = $(this);
|
||||
$radio.radio();
|
||||
});
|
||||
});
|
||||
|
||||
}(window.jQuery);
|
||||
|
||||
|
||||
|
||||
/* ============================================================
|
||||
* bootstrapSwitch v1.3 by Larentis Mattia @spiritualGuru
|
||||
* http://www.larentis.eu/switch/
|
||||
* ============================================================
|
||||
* Licensed under the Apache License, Version 2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* ============================================================ */
|
||||
|
||||
!function ($) {
|
||||
"use strict";
|
||||
|
||||
$.fn['bootstrapSwitch'] = function (method) {
|
||||
var methods = {
|
||||
init: function () {
|
||||
return this.each(function () {
|
||||
var $element = $(this)
|
||||
, $div
|
||||
, $switchLeft
|
||||
, $switchRight
|
||||
, $label
|
||||
, myClasses = ""
|
||||
, classes = $element.attr('class')
|
||||
, color
|
||||
, moving
|
||||
, onLabel = "ON"
|
||||
, offLabel = "OFF"
|
||||
, icon = false;
|
||||
|
||||
$.each(['switch-mini', 'switch-small', 'switch-large'], function (i, el) {
|
||||
if (classes.indexOf(el) >= 0)
|
||||
myClasses = el;
|
||||
});
|
||||
|
||||
$element.addClass('has-switch');
|
||||
|
||||
if ($element.data('on') !== undefined)
|
||||
color = "switch-" + $element.data('on');
|
||||
|
||||
if ($element.data('on-label') !== undefined)
|
||||
onLabel = $element.data('on-label');
|
||||
|
||||
if ($element.data('off-label') !== undefined)
|
||||
offLabel = $element.data('off-label');
|
||||
|
||||
if ($element.data('icon') !== undefined)
|
||||
icon = $element.data('icon');
|
||||
|
||||
$switchLeft = $('<span>')
|
||||
.addClass("switch-left")
|
||||
.addClass(myClasses)
|
||||
.addClass(color)
|
||||
.html(onLabel);
|
||||
|
||||
color = '';
|
||||
if ($element.data('off') !== undefined)
|
||||
color = "switch-" + $element.data('off');
|
||||
|
||||
$switchRight = $('<span>')
|
||||
.addClass("switch-right")
|
||||
.addClass(myClasses)
|
||||
.addClass(color)
|
||||
.html(offLabel);
|
||||
|
||||
$label = $('<label>')
|
||||
.html(" ")
|
||||
.addClass(myClasses)
|
||||
.attr('for', $element.find('input').attr('id'));
|
||||
|
||||
if (icon) {
|
||||
$label.html('<i class="' + icon + '"></i>');
|
||||
}
|
||||
|
||||
$div = $element.find(':checkbox').wrap($('<div>')).parent().data('animated', false);
|
||||
|
||||
if ($element.data('animated') !== false)
|
||||
$div.addClass('switch-animate').data('animated', true);
|
||||
|
||||
$div
|
||||
.append($switchLeft)
|
||||
.append($label)
|
||||
.append($switchRight);
|
||||
|
||||
$element.find('>div').addClass(
|
||||
$element.find('input').is(':checked') ? 'switch-on' : 'switch-off'
|
||||
);
|
||||
|
||||
if ($element.find('input').is(':disabled'))
|
||||
$(this).addClass('deactivate');
|
||||
|
||||
var changeStatus = function ($this) {
|
||||
$this.siblings('label').trigger('mousedown').trigger('mouseup').trigger('click');
|
||||
};
|
||||
|
||||
$element.on('keydown', function (e) {
|
||||
if (e.keyCode === 32) {
|
||||
e.stopImmediatePropagation();
|
||||
e.preventDefault();
|
||||
changeStatus($(e.target).find('span:first'));
|
||||
}
|
||||
});
|
||||
|
||||
$switchLeft.on('click', function (e) {
|
||||
changeStatus($(this));
|
||||
});
|
||||
|
||||
$switchRight.on('click', function (e) {
|
||||
changeStatus($(this));
|
||||
});
|
||||
|
||||
$element.find('input').on('change', function (e) {
|
||||
var $this = $(this)
|
||||
, $element = $this.parent()
|
||||
, thisState = $this.is(':checked')
|
||||
, state = $element.is('.switch-off');
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$element.css('left', '');
|
||||
|
||||
if (state === thisState) {
|
||||
|
||||
if (thisState)
|
||||
$element.removeClass('switch-off').addClass('switch-on');
|
||||
else $element.removeClass('switch-on').addClass('switch-off');
|
||||
|
||||
if ($element.data('animated') !== false)
|
||||
$element.addClass("switch-animate");
|
||||
|
||||
$element.parent().trigger('switch-change', {'el': $this, 'value': thisState})
|
||||
}
|
||||
});
|
||||
|
||||
$element.find('label').on('mousedown touchstart', function (e) {
|
||||
var $this = $(this);
|
||||
moving = false;
|
||||
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
|
||||
$this.closest('div').removeClass('switch-animate');
|
||||
|
||||
if ($this.closest('.has-switch').is('.deactivate'))
|
||||
$this.unbind('click');
|
||||
else {
|
||||
$this.on('mousemove touchmove', function (e) {
|
||||
var $element = $(this).closest('.switch')
|
||||
, relativeX = (e.pageX || e.originalEvent.targetTouches[0].pageX) - $element.offset().left
|
||||
, percent = (relativeX / $element.width()) * 100
|
||||
, left = 25
|
||||
, right = 75;
|
||||
|
||||
moving = true;
|
||||
|
||||
if (percent < left)
|
||||
percent = left;
|
||||
else if (percent > right)
|
||||
percent = right;
|
||||
|
||||
$element.find('>div').css('left', (percent - right) + "%")
|
||||
});
|
||||
|
||||
$this.on('click touchend', function (e) {
|
||||
var $this = $(this)
|
||||
, $target = $(e.target)
|
||||
, $myCheckBox = $target.siblings('input');
|
||||
|
||||
e.stopImmediatePropagation();
|
||||
e.preventDefault();
|
||||
|
||||
$this.unbind('mouseleave');
|
||||
|
||||
if (moving)
|
||||
$myCheckBox.prop('checked', !(parseInt($this.parent().css('left')) < -25));
|
||||
else $myCheckBox.prop("checked", !$myCheckBox.is(":checked"));
|
||||
|
||||
moving = false;
|
||||
$myCheckBox.trigger('change');
|
||||
});
|
||||
|
||||
$this.on('mouseleave', function (e) {
|
||||
var $this = $(this)
|
||||
, $myCheckBox = $this.siblings('input');
|
||||
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
|
||||
$this.unbind('mouseleave');
|
||||
$this.trigger('mouseup');
|
||||
|
||||
$myCheckBox.prop('checked', !(parseInt($this.parent().css('left')) < -25)).trigger('change');
|
||||
});
|
||||
|
||||
$this.on('mouseup', function (e) {
|
||||
e.stopImmediatePropagation();
|
||||
e.preventDefault();
|
||||
|
||||
$(this).unbind('mousemove');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
},
|
||||
toggleActivation: function () {
|
||||
$(this).toggleClass('deactivate');
|
||||
},
|
||||
isActive: function () {
|
||||
return !$(this).hasClass('deactivate');
|
||||
},
|
||||
setActive: function (active) {
|
||||
if (active)
|
||||
$(this).removeClass('deactivate');
|
||||
else $(this).addClass('deactivate');
|
||||
},
|
||||
toggleState: function (skipOnChange) {
|
||||
var $input = $(this).find('input:checkbox');
|
||||
$input.prop('checked', !$input.is(':checked')).trigger('change', skipOnChange);
|
||||
},
|
||||
setState: function (value, skipOnChange) {
|
||||
$(this).find('input:checkbox').prop('checked', value).trigger('change', skipOnChange);
|
||||
},
|
||||
status: function () {
|
||||
return $(this).find('input:checkbox').is(':checked');
|
||||
},
|
||||
destroy: function () {
|
||||
var $div = $(this).find('div')
|
||||
, $checkbox;
|
||||
|
||||
$div.find(':not(input:checkbox)').remove();
|
||||
|
||||
$checkbox = $div.children();
|
||||
$checkbox.unwrap().unwrap();
|
||||
|
||||
$checkbox.unbind('change');
|
||||
|
||||
return $checkbox;
|
||||
}
|
||||
};
|
||||
|
||||
if (methods[method])
|
||||
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
else if (typeof method === 'object' || !method)
|
||||
return methods.init.apply(this, arguments);
|
||||
else
|
||||
$.error('Method ' + method + ' does not exist!');
|
||||
};
|
||||
}(jQuery);
|
||||
|
||||
|
||||
404
public/assets/admin/js/bootstrap-notify.js
vendored
Executable file
404
public/assets/admin/js/bootstrap-notify.js
vendored
Executable file
@@ -0,0 +1,404 @@
|
||||
/*
|
||||
|
||||
|
||||
|
||||
Creative Tim Modifications
|
||||
|
||||
Lines: 239, 240 was changed from top: 5px to top: 50% and we added margin-top: -13px. In this way the close button will be aligned vertically
|
||||
Line:242 - modified when the icon is set, we add the class "alert-with-icon", so there will be enough space for the icon.
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Project: Bootstrap Notify = v3.1.5
|
||||
* Description: Turns standard Bootstrap alerts into "Growl-like" notifications.
|
||||
* Author: Mouse0270 aka Robert McIntosh
|
||||
* License: MIT License
|
||||
* Website: https://github.com/mouse0270/bootstrap-growl
|
||||
*/
|
||||
|
||||
/* global define:false, require: false, jQuery:false */
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
// Create the defaults once
|
||||
var defaults = {
|
||||
element: 'body',
|
||||
position: null,
|
||||
type: "info",
|
||||
allow_dismiss: true,
|
||||
allow_duplicates: true,
|
||||
newest_on_top: false,
|
||||
showProgressbar: false,
|
||||
placement: {
|
||||
from: "top",
|
||||
align: "right"
|
||||
},
|
||||
offset: 20,
|
||||
spacing: 10,
|
||||
z_index: 1031,
|
||||
delay: 5000,
|
||||
timer: 1000,
|
||||
url_target: '_blank',
|
||||
mouse_over: null,
|
||||
animate: {
|
||||
enter: 'animated fadeInDown',
|
||||
exit: 'animated fadeOutUp'
|
||||
},
|
||||
onShow: null,
|
||||
onShown: null,
|
||||
onClose: null,
|
||||
onClosed: null,
|
||||
icon_type: 'class',
|
||||
template: '<div data-notify="container" class="col-xs-11 col-sm-4 alert alert-{0}" role="alert"><button type="button" aria-hidden="true" class="close" data-notify="dismiss">×</button><span data-notify="icon"></span> <span data-notify="title">{1}</span> <span data-notify="message">{2}</span><div class="progress" data-notify="progressbar"><div class="progress-bar progress-bar-{0}" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div></div><a href="{3}" target="{4}" data-notify="url"></a></div>'
|
||||
};
|
||||
|
||||
String.format = function () {
|
||||
var str = arguments[0];
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
str = str.replace(RegExp("\\{" + (i - 1) + "\\}", "gm"), arguments[i]);
|
||||
}
|
||||
return str;
|
||||
};
|
||||
|
||||
function isDuplicateNotification(notification) {
|
||||
var isDupe = false;
|
||||
|
||||
$('[data-notify="container"]').each(function (i, el) {
|
||||
var $el = $(el);
|
||||
var title = $el.find('[data-notify="title"]').text().trim();
|
||||
var message = $el.find('[data-notify="message"]').html().trim();
|
||||
|
||||
// The input string might be different than the actual parsed HTML string!
|
||||
// (<br> vs <br /> for example)
|
||||
// So we have to force-parse this as HTML here!
|
||||
var isSameTitle = title === $("<div>" + notification.settings.content.title + "</div>").html().trim();
|
||||
var isSameMsg = message === $("<div>" + notification.settings.content.message + "</div>").html().trim();
|
||||
var isSameType = $el.hasClass('alert-' + notification.settings.type);
|
||||
|
||||
if (isSameTitle && isSameMsg && isSameType) {
|
||||
//we found the dupe. Set the var and stop checking.
|
||||
isDupe = true;
|
||||
}
|
||||
return !isDupe;
|
||||
});
|
||||
|
||||
return isDupe;
|
||||
}
|
||||
|
||||
function Notify(element, content, options) {
|
||||
// Setup Content of Notify
|
||||
var contentObj = {
|
||||
content: {
|
||||
message: typeof content === 'object' ? content.message : content,
|
||||
title: content.title ? content.title : '',
|
||||
icon: content.icon ? content.icon : '',
|
||||
url: content.url ? content.url : '#',
|
||||
target: content.target ? content.target : '-'
|
||||
}
|
||||
};
|
||||
|
||||
options = $.extend(true, {}, contentObj, options);
|
||||
this.settings = $.extend(true, {}, defaults, options);
|
||||
this._defaults = defaults;
|
||||
if (this.settings.content.target === "-") {
|
||||
this.settings.content.target = this.settings.url_target;
|
||||
}
|
||||
this.animations = {
|
||||
start: 'webkitAnimationStart oanimationstart MSAnimationStart animationstart',
|
||||
end: 'webkitAnimationEnd oanimationend MSAnimationEnd animationend'
|
||||
};
|
||||
|
||||
if (typeof this.settings.offset === 'number') {
|
||||
this.settings.offset = {
|
||||
x: this.settings.offset,
|
||||
y: this.settings.offset
|
||||
};
|
||||
}
|
||||
|
||||
//if duplicate messages are not allowed, then only continue if this new message is not a duplicate of one that it already showing
|
||||
if (this.settings.allow_duplicates || (!this.settings.allow_duplicates && !isDuplicateNotification(this))) {
|
||||
this.init();
|
||||
}
|
||||
}
|
||||
|
||||
$.extend(Notify.prototype, {
|
||||
init: function () {
|
||||
var self = this;
|
||||
|
||||
this.buildNotify();
|
||||
if (this.settings.content.icon) {
|
||||
this.setIcon();
|
||||
}
|
||||
if (this.settings.content.url != "#") {
|
||||
this.styleURL();
|
||||
}
|
||||
this.styleDismiss();
|
||||
this.placement();
|
||||
this.bind();
|
||||
|
||||
this.notify = {
|
||||
$ele: this.$ele,
|
||||
update: function (command, update) {
|
||||
var commands = {};
|
||||
if (typeof command === "string") {
|
||||
commands[command] = update;
|
||||
} else {
|
||||
commands = command;
|
||||
}
|
||||
for (var cmd in commands) {
|
||||
switch (cmd) {
|
||||
case "type":
|
||||
this.$ele.removeClass('alert-' + self.settings.type);
|
||||
this.$ele.find('[data-notify="progressbar"] > .progress-bar').removeClass('progress-bar-' + self.settings.type);
|
||||
self.settings.type = commands[cmd];
|
||||
this.$ele.addClass('alert-' + commands[cmd]).find('[data-notify="progressbar"] > .progress-bar').addClass('progress-bar-' + commands[cmd]);
|
||||
break;
|
||||
case "icon":
|
||||
var $icon = this.$ele.find('[data-notify="icon"]');
|
||||
if (self.settings.icon_type.toLowerCase() === 'class') {
|
||||
$icon.removeClass(self.settings.content.icon).addClass(commands[cmd]);
|
||||
} else {
|
||||
if (!$icon.is('img')) {
|
||||
$icon.find('img');
|
||||
}
|
||||
$icon.attr('src', commands[cmd]);
|
||||
}
|
||||
break;
|
||||
case "progress":
|
||||
var newDelay = self.settings.delay - (self.settings.delay * (commands[cmd] / 100));
|
||||
this.$ele.data('notify-delay', newDelay);
|
||||
this.$ele.find('[data-notify="progressbar"] > div').attr('aria-valuenow', commands[cmd]).css('width', commands[cmd] + '%');
|
||||
break;
|
||||
case "url":
|
||||
this.$ele.find('[data-notify="url"]').attr('href', commands[cmd]);
|
||||
break;
|
||||
case "target":
|
||||
this.$ele.find('[data-notify="url"]').attr('target', commands[cmd]);
|
||||
break;
|
||||
default:
|
||||
this.$ele.find('[data-notify="' + cmd + '"]').html(commands[cmd]);
|
||||
}
|
||||
}
|
||||
var posX = this.$ele.outerHeight() + parseInt(self.settings.spacing) + parseInt(self.settings.offset.y);
|
||||
self.reposition(posX);
|
||||
},
|
||||
close: function () {
|
||||
self.close();
|
||||
}
|
||||
};
|
||||
|
||||
},
|
||||
buildNotify: function () {
|
||||
var content = this.settings.content;
|
||||
this.$ele = $(String.format(this.settings.template, this.settings.type, content.title, content.message, content.url, content.target));
|
||||
this.$ele.attr('data-notify-position', this.settings.placement.from + '-' + this.settings.placement.align);
|
||||
if (!this.settings.allow_dismiss) {
|
||||
this.$ele.find('[data-notify="dismiss"]').css('display', 'none');
|
||||
}
|
||||
if ((this.settings.delay <= 0 && !this.settings.showProgressbar) || !this.settings.showProgressbar) {
|
||||
this.$ele.find('[data-notify="progressbar"]').remove();
|
||||
}
|
||||
},
|
||||
setIcon: function () {
|
||||
|
||||
this.$ele.addClass('alert-with-icon');
|
||||
|
||||
if (this.settings.icon_type.toLowerCase() === 'class') {
|
||||
this.$ele.find('[data-notify="icon"]').addClass(this.settings.content.icon);
|
||||
} else {
|
||||
if (this.$ele.find('[data-notify="icon"]').is('img')) {
|
||||
this.$ele.find('[data-notify="icon"]').attr('src', this.settings.content.icon);
|
||||
} else {
|
||||
this.$ele.find('[data-notify="icon"]').append('<img src="' + this.settings.content.icon + '" alt="Notify Icon" />');
|
||||
}
|
||||
}
|
||||
},
|
||||
styleDismiss: function () {
|
||||
this.$ele.find('[data-notify="dismiss"]').css({
|
||||
position: 'absolute',
|
||||
right: '10px',
|
||||
top: '50%',
|
||||
marginTop: '-13px',
|
||||
zIndex: this.settings.z_index + 2
|
||||
});
|
||||
},
|
||||
styleURL: function () {
|
||||
this.$ele.find('[data-notify="url"]').css({
|
||||
backgroundImage: 'url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)',
|
||||
height: '100%',
|
||||
left: 0,
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
width: '100%',
|
||||
zIndex: this.settings.z_index + 1
|
||||
});
|
||||
},
|
||||
placement: function () {
|
||||
var self = this,
|
||||
offsetAmt = this.settings.offset.y,
|
||||
css = {
|
||||
display: 'inline-block',
|
||||
margin: '0px auto',
|
||||
position: this.settings.position ? this.settings.position : (this.settings.element === 'body' ? 'fixed' : 'absolute'),
|
||||
transition: 'all .5s ease-in-out',
|
||||
zIndex: this.settings.z_index
|
||||
},
|
||||
hasAnimation = false,
|
||||
settings = this.settings;
|
||||
|
||||
$('[data-notify-position="' + this.settings.placement.from + '-' + this.settings.placement.align + '"]:not([data-closing="true"])').each(function () {
|
||||
offsetAmt = Math.max(offsetAmt, parseInt($(this).css(settings.placement.from)) + parseInt($(this).outerHeight()) + parseInt(settings.spacing));
|
||||
});
|
||||
if (this.settings.newest_on_top === true) {
|
||||
offsetAmt = this.settings.offset.y;
|
||||
}
|
||||
css[this.settings.placement.from] = offsetAmt + 'px';
|
||||
|
||||
switch (this.settings.placement.align) {
|
||||
case "left":
|
||||
case "right":
|
||||
css[this.settings.placement.align] = this.settings.offset.x + 'px';
|
||||
break;
|
||||
case "center":
|
||||
css.left = 0;
|
||||
css.right = 0;
|
||||
break;
|
||||
}
|
||||
this.$ele.css(css).addClass(this.settings.animate.enter);
|
||||
$.each(Array('webkit-', 'moz-', 'o-', 'ms-', ''), function (index, prefix) {
|
||||
self.$ele[0].style[prefix + 'AnimationIterationCount'] = 1;
|
||||
});
|
||||
|
||||
$(this.settings.element).append(this.$ele);
|
||||
|
||||
if (this.settings.newest_on_top === true) {
|
||||
offsetAmt = (parseInt(offsetAmt) + parseInt(this.settings.spacing)) + this.$ele.outerHeight();
|
||||
this.reposition(offsetAmt);
|
||||
}
|
||||
|
||||
if ($.isFunction(self.settings.onShow)) {
|
||||
self.settings.onShow.call(this.$ele);
|
||||
}
|
||||
|
||||
this.$ele.one(this.animations.start, function () {
|
||||
hasAnimation = true;
|
||||
}).one(this.animations.end, function () {
|
||||
if ($.isFunction(self.settings.onShown)) {
|
||||
self.settings.onShown.call(this);
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(function () {
|
||||
if (!hasAnimation) {
|
||||
if ($.isFunction(self.settings.onShown)) {
|
||||
self.settings.onShown.call(this);
|
||||
}
|
||||
}
|
||||
}, 600);
|
||||
},
|
||||
bind: function () {
|
||||
var self = this;
|
||||
|
||||
this.$ele.find('[data-notify="dismiss"]').on('click', function () {
|
||||
self.close();
|
||||
});
|
||||
|
||||
this.$ele.mouseover(function () {
|
||||
$(this).data('data-hover', "true");
|
||||
}).mouseout(function () {
|
||||
$(this).data('data-hover', "false");
|
||||
});
|
||||
this.$ele.data('data-hover', "false");
|
||||
|
||||
if (this.settings.delay > 0) {
|
||||
self.$ele.data('notify-delay', self.settings.delay);
|
||||
var timer = setInterval(function () {
|
||||
var delay = parseInt(self.$ele.data('notify-delay')) - self.settings.timer;
|
||||
if ((self.$ele.data('data-hover') === 'false' && self.settings.mouse_over === "pause") || self.settings.mouse_over != "pause") {
|
||||
var percent = ((self.settings.delay - delay) / self.settings.delay) * 100;
|
||||
self.$ele.data('notify-delay', delay);
|
||||
self.$ele.find('[data-notify="progressbar"] > div').attr('aria-valuenow', percent).css('width', percent + '%');
|
||||
}
|
||||
if (delay <= -(self.settings.timer)) {
|
||||
clearInterval(timer);
|
||||
self.close();
|
||||
}
|
||||
}, self.settings.timer);
|
||||
}
|
||||
},
|
||||
close: function () {
|
||||
var self = this,
|
||||
posX = parseInt(this.$ele.css(this.settings.placement.from)),
|
||||
hasAnimation = false;
|
||||
|
||||
this.$ele.data('closing', 'true').addClass(this.settings.animate.exit);
|
||||
self.reposition(posX);
|
||||
|
||||
if ($.isFunction(self.settings.onClose)) {
|
||||
self.settings.onClose.call(this.$ele);
|
||||
}
|
||||
|
||||
this.$ele.one(this.animations.start, function () {
|
||||
hasAnimation = true;
|
||||
}).one(this.animations.end, function () {
|
||||
$(this).remove();
|
||||
if ($.isFunction(self.settings.onClosed)) {
|
||||
self.settings.onClosed.call(this);
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(function () {
|
||||
if (!hasAnimation) {
|
||||
self.$ele.remove();
|
||||
if (self.settings.onClosed) {
|
||||
self.settings.onClosed(self.$ele);
|
||||
}
|
||||
}
|
||||
}, 600);
|
||||
},
|
||||
reposition: function (posX) {
|
||||
var self = this,
|
||||
notifies = '[data-notify-position="' + this.settings.placement.from + '-' + this.settings.placement.align + '"]:not([data-closing="true"])',
|
||||
$elements = this.$ele.nextAll(notifies);
|
||||
if (this.settings.newest_on_top === true) {
|
||||
$elements = this.$ele.prevAll(notifies);
|
||||
}
|
||||
$elements.each(function () {
|
||||
$(this).css(self.settings.placement.from, posX);
|
||||
posX = (parseInt(posX) + parseInt(self.settings.spacing)) + $(this).outerHeight();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$.notify = function (content, options) {
|
||||
var plugin = new Notify(this, content, options);
|
||||
return plugin.notify;
|
||||
};
|
||||
$.notifyDefaults = function (options) {
|
||||
defaults = $.extend(true, {}, defaults, options);
|
||||
return defaults;
|
||||
};
|
||||
$.notifyClose = function (command) {
|
||||
if (typeof command === "undefined" || command === "all") {
|
||||
$('[data-notify]').find('[data-notify="dismiss"]').trigger('click');
|
||||
} else {
|
||||
$('[data-notify-position="' + command + '"]').find('[data-notify="dismiss"]').trigger('click');
|
||||
}
|
||||
};
|
||||
|
||||
}));
|
||||
438
public/assets/admin/js/bootstrap-select.js
vendored
Normal file
438
public/assets/admin/js/bootstrap-select.js
vendored
Normal file
@@ -0,0 +1,438 @@
|
||||
!function($) {
|
||||
var Selectpicker = function(element, options, e) {
|
||||
if (e ) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
this.$element = $(element);
|
||||
this.$newElement = null;
|
||||
this.button = null;
|
||||
|
||||
//Merge defaults, options and data-attributes to make our options
|
||||
this.options = $.extend({}, $.fn.selectpicker.defaults, this.$element.data(), typeof options == 'object' && options);
|
||||
|
||||
//If we have no title yet, check the attribute 'title' (this is missed by jq as its not a data-attribute
|
||||
if(this.options.title==null)
|
||||
this.options.title = this.$element.attr('title');
|
||||
|
||||
//Expose public methods
|
||||
this.val = Selectpicker.prototype.val;
|
||||
this.render = Selectpicker.prototype.render;
|
||||
this.init();
|
||||
};
|
||||
|
||||
Selectpicker.prototype = {
|
||||
|
||||
constructor: Selectpicker,
|
||||
|
||||
init: function (e) {
|
||||
var _this = this;
|
||||
this.$element.hide();
|
||||
this.multiple = this.$element.prop('multiple');
|
||||
|
||||
|
||||
var classList = this.$element.attr('class') !== undefined ? this.$element.attr('class').split(/\s+/) : '';
|
||||
var id = this.$element.attr('id');
|
||||
this.$element.after( this.createView() );
|
||||
this.$newElement = this.$element.next('.select');
|
||||
var select = this.$newElement;
|
||||
var menu = this.$newElement.find('.dropdown-menu');
|
||||
var menuArrow = this.$newElement.find('.dropdown-arrow');
|
||||
var menuA = menu.find('li > a');
|
||||
var liHeight = select.addClass('open').find('.dropdown-menu li > a').outerHeight();
|
||||
select.removeClass('open');
|
||||
var divHeight = menu.find('li .divider').outerHeight(true);
|
||||
var selectOffset_top = this.$newElement.offset().top;
|
||||
var size = 0;
|
||||
var menuHeight = 0;
|
||||
var selectHeight = this.$newElement.outerHeight();
|
||||
this.button = this.$newElement.find('> button');
|
||||
if (id !== undefined) {
|
||||
this.button.attr('id', id);
|
||||
$('label[for="' + id + '"]').click(function(){ select.find('button#'+id).focus(); })
|
||||
}
|
||||
for (var i = 0; i < classList.length; i++) {
|
||||
if(classList[i] != 'selectpicker') {
|
||||
this.$newElement.addClass(classList[i]);
|
||||
}
|
||||
}
|
||||
//If we are multiple, then add the show-tick class by default
|
||||
if(this.multiple) {
|
||||
this.$newElement.addClass('select-multiple');
|
||||
}
|
||||
this.button.addClass(this.options.style);
|
||||
menu.addClass(this.options.menuStyle);
|
||||
menuArrow.addClass(function() {
|
||||
if (_this.options.menuStyle) {
|
||||
return _this.options.menuStyle.replace('dropdown-', 'dropdown-arrow-');
|
||||
}
|
||||
});
|
||||
this.checkDisabled();
|
||||
this.checkTabIndex();
|
||||
this.clickListener();
|
||||
var menuPadding = parseInt(menu.css('padding-top')) + parseInt(menu.css('padding-bottom')) + parseInt(menu.css('border-top-width')) + parseInt(menu.css('border-bottom-width'));
|
||||
if (this.options.size == 'auto') {
|
||||
|
||||
// Creative Tim Changes: We changed the regular function made in bootstrap-select with this function so the getSize() will not be triggered one million times per second while you scroll.
|
||||
|
||||
var getSize = debounce(function() {
|
||||
var selectOffset_top_scroll = selectOffset_top - $(window).scrollTop();
|
||||
var windowHeight = $(window).innerHeight();
|
||||
var menuExtras = menuPadding + parseInt(menu.css('margin-top')) + parseInt(menu.css('margin-bottom')) + 2;
|
||||
var selectOffset_bot = windowHeight - selectOffset_top_scroll - selectHeight - menuExtras;
|
||||
menuHeight = selectOffset_bot;
|
||||
if (select.hasClass('dropup')) {
|
||||
menuHeight = selectOffset_top_scroll - menuExtras;
|
||||
}
|
||||
//limit menuHeight to 300px to have a smooth transition with cubic bezier on dropdown
|
||||
if(menuHeight >= 300){
|
||||
menuHeight = 300;
|
||||
}
|
||||
|
||||
menu.css({'max-height' : menuHeight + 'px', 'overflow-y' : 'auto', 'min-height' : liHeight * 3 + 'px'});
|
||||
|
||||
}, 50);
|
||||
|
||||
getSize;
|
||||
$(window).on('scroll', getSize);
|
||||
$(window).on('resize', getSize);
|
||||
|
||||
if (window.MutationObserver) {
|
||||
new MutationObserver(getSize).observe(this.$element.get(0), {
|
||||
childList: true
|
||||
});
|
||||
} else {
|
||||
this.$element.bind('DOMNodeInserted', getSize);
|
||||
}
|
||||
} else if (this.options.size && this.options.size != 'auto' && menu.find('li').length > this.options.size) {
|
||||
var optIndex = menu.find("li > *").filter(':not(.divider)').slice(0,this.options.size).last().parent().index();
|
||||
var divLength = menu.find("li").slice(0,optIndex + 1).find('.divider').length;
|
||||
menuHeight = liHeight*this.options.size + divLength*divHeight + menuPadding;
|
||||
menu.css({'max-height' : menuHeight + 'px', 'overflow-y' : 'scroll'});
|
||||
//console.log('sunt in if');
|
||||
}
|
||||
|
||||
// Listen for updates to the DOM and re render... (Use Mutation Observer when availiable)
|
||||
if (window.MutationObserver) {
|
||||
new MutationObserver($.proxy(this.reloadLi, this)).observe(this.$element.get(0), {
|
||||
childList: true
|
||||
});
|
||||
} else {
|
||||
this.$element.bind('DOMNodeInserted', $.proxy(this.reloadLi, this));
|
||||
}
|
||||
|
||||
this.render();
|
||||
},
|
||||
|
||||
createDropdown: function() {
|
||||
var drop =
|
||||
"<div class='btn-group select'>" +
|
||||
"<button class='btn dropdown-toggle clearfix' data-toggle='dropdown'>" +
|
||||
"<span class='filter-option'></span> " +
|
||||
"<span class='caret'></span>" +
|
||||
"</button>" +
|
||||
"<span class='dropdown-arrow'></span>" +
|
||||
"<ul class='dropdown-menu' role='menu'>" +
|
||||
"</ul>" +
|
||||
"</div>";
|
||||
|
||||
return $(drop);
|
||||
},
|
||||
|
||||
|
||||
createView: function() {
|
||||
var $drop = this.createDropdown();
|
||||
var $li = this.createLi();
|
||||
$drop.find('ul').append($li);
|
||||
return $drop;
|
||||
},
|
||||
|
||||
reloadLi: function() {
|
||||
//Remove all children.
|
||||
this.destroyLi();
|
||||
//Re build
|
||||
$li = this.createLi();
|
||||
this.$newElement.find('ul').append( $li );
|
||||
//render view
|
||||
this.render();
|
||||
},
|
||||
|
||||
destroyLi:function() {
|
||||
this.$newElement.find('li').remove();
|
||||
},
|
||||
|
||||
createLi: function() {
|
||||
|
||||
var _this = this;
|
||||
var _li = [];
|
||||
var _liA = [];
|
||||
var _liHtml = '';
|
||||
|
||||
this.$element.find('option').each(function(){
|
||||
_li.push($(this).text());
|
||||
});
|
||||
|
||||
this.$element.find('option').each(function(index) {
|
||||
//Get the class and text for the option
|
||||
var optionClass = $(this).attr("class") !== undefined ? $(this).attr("class") : '';
|
||||
var text = $(this).text();
|
||||
var subtext = $(this).data('subtext') !== undefined ? '<small class="muted">'+$(this).data('subtext')+'</small>' : '';
|
||||
|
||||
//Append any subtext to the main text.
|
||||
text+=subtext;
|
||||
|
||||
if ($(this).parent().is('optgroup') && $(this).data('divider') != true) {
|
||||
if ($(this).index() == 0) {
|
||||
//Get the opt group label
|
||||
var label = $(this).parent().attr('label');
|
||||
var labelSubtext = $(this).parent().data('subtext') !== undefined ? '<small class="muted">'+$(this).parent().data('subtext')+'</small>' : '';
|
||||
label += labelSubtext;
|
||||
|
||||
if ($(this)[0].index != 0) {
|
||||
_liA.push(
|
||||
'<div class="divider"></div>'+
|
||||
'<dt>'+label+'</dt>'+
|
||||
_this.createA(text, "opt " + optionClass )
|
||||
);
|
||||
} else {
|
||||
_liA.push(
|
||||
'<dt>'+label+'</dt>'+
|
||||
_this.createA(text, "opt " + optionClass ));
|
||||
}
|
||||
} else {
|
||||
_liA.push( _this.createA(text, "opt " + optionClass ) );
|
||||
}
|
||||
} else if ($(this).data('divider') == true) {
|
||||
_liA.push('<div class="divider"></div>');
|
||||
} else if ($(this).data('hidden') == true) {
|
||||
_liA.push('');
|
||||
} else {
|
||||
_liA.push( _this.createA(text, optionClass ) );
|
||||
}
|
||||
});
|
||||
|
||||
if (_li.length > 0) {
|
||||
for (var i = 0; i < _li.length; i++) {
|
||||
var $option = this.$element.find('option').eq(i);
|
||||
_liHtml += "<li rel=" + i + ">" + _liA[i] + "</li>";
|
||||
}
|
||||
}
|
||||
|
||||
//If we dont have a selected item, and we dont have a title, select the first element so something is set in the button
|
||||
if(this.$element.find('option:selected').length==0 && !_this.options.title) {
|
||||
this.$element.find('option').eq(0).prop('selected', true).attr('selected', 'selected');
|
||||
}
|
||||
|
||||
return $(_liHtml);
|
||||
},
|
||||
|
||||
createA:function(test, classes) {
|
||||
return '<a tabindex="-1" href="#" class="'+classes+'">' +
|
||||
'<span class="">' + test + '</span>' +
|
||||
'</a>';
|
||||
|
||||
},
|
||||
|
||||
render:function() {
|
||||
var _this = this;
|
||||
|
||||
//Set width of select
|
||||
if (this.options.width == 'auto') {
|
||||
var ulWidth = this.$newElement.find('.dropdown-menu').css('width');
|
||||
this.$newElement.css('width',ulWidth);
|
||||
} else if (this.options.width && this.options.width != 'auto') {
|
||||
this.$newElement.css('width',this.options.width);
|
||||
}
|
||||
|
||||
//Update the LI to match the SELECT
|
||||
this.$element.find('option').each(function(index) {
|
||||
_this.setDisabled(index, $(this).is(':disabled') || $(this).parent().is(':disabled') );
|
||||
_this.setSelected(index, $(this).is(':selected') );
|
||||
});
|
||||
|
||||
|
||||
|
||||
var selectedItems = this.$element.find('option:selected').map(function(index,value) {
|
||||
if($(this).attr('title')!=undefined) {
|
||||
return $(this).attr('title');
|
||||
} else {
|
||||
return $(this).text();
|
||||
}
|
||||
}).toArray();
|
||||
|
||||
//Convert all the values into a comma delimited string
|
||||
var title = selectedItems.join(", ");
|
||||
|
||||
//If this is multi select, and the selectText type is count, the show 1 of 2 selected etc..
|
||||
if(_this.multiple && _this.options.selectedTextFormat.indexOf('count') > -1) {
|
||||
var max = _this.options.selectedTextFormat.split(">");
|
||||
if( (max.length>1 && selectedItems.length > max[1]) || (max.length==1 && selectedItems.length>=2)) {
|
||||
title = selectedItems.length +' of ' + this.$element.find('option').length + ' selected';
|
||||
}
|
||||
}
|
||||
|
||||
//If we dont have a title, then use the default, or if nothing is set at all, use the not selected text
|
||||
if(!title) {
|
||||
title = _this.options.title != undefined ? _this.options.title : _this.options.noneSelectedText;
|
||||
}
|
||||
|
||||
this.$element.next('.select').find('.filter-option').html( title );
|
||||
},
|
||||
|
||||
|
||||
|
||||
setSelected:function(index, selected) {
|
||||
if(selected) {
|
||||
this.$newElement.find('li').eq(index).addClass('selected');
|
||||
} else {
|
||||
this.$newElement.find('li').eq(index).removeClass('selected');
|
||||
}
|
||||
},
|
||||
|
||||
setDisabled:function(index, disabled) {
|
||||
if(disabled) {
|
||||
this.$newElement.find('li').eq(index).addClass('disabled');
|
||||
} else {
|
||||
this.$newElement.find('li').eq(index).removeClass('disabled');
|
||||
}
|
||||
},
|
||||
|
||||
checkDisabled: function() {
|
||||
if (this.$element.is(':disabled')) {
|
||||
this.button.addClass('disabled');
|
||||
this.button.click(function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
checkTabIndex: function() {
|
||||
if (this.$element.is('[tabindex]')) {
|
||||
var tabindex = this.$element.attr("tabindex");
|
||||
this.button.attr('tabindex', tabindex);
|
||||
}
|
||||
},
|
||||
|
||||
clickListener: function() {
|
||||
var _this = this;
|
||||
|
||||
$('body').on('touchstart.dropdown', '.dropdown-menu', function (e) { e.stopPropagation(); });
|
||||
|
||||
|
||||
|
||||
this.$newElement.on('click', 'li a', function(e){
|
||||
var clickedIndex = $(this).parent().index(),
|
||||
$this = $(this).parent(),
|
||||
$select = $this.parents('.select');
|
||||
|
||||
|
||||
//Dont close on multi choice menu
|
||||
if(_this.multiple) {
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
//Dont run if we have been disabled
|
||||
if ($select.prev('select').not(':disabled') && !$(this).parent().hasClass('disabled')){
|
||||
//Deselect all others if not multi select box
|
||||
if (!_this.multiple) {
|
||||
$select.prev('select').find('option').removeAttr('selected');
|
||||
$select.prev('select').find('option').eq(clickedIndex).prop('selected', true).attr('selected', 'selected');
|
||||
}
|
||||
//Else toggle the one we have chosen if we are multi selet.
|
||||
else {
|
||||
var selected = $select.prev('select').find('option').eq(clickedIndex).prop('selected');
|
||||
|
||||
if(selected) {
|
||||
$select.prev('select').find('option').eq(clickedIndex).removeAttr('selected');
|
||||
} else {
|
||||
$select.prev('select').find('option').eq(clickedIndex).prop('selected', true).attr('selected', 'selected');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$select.find('.filter-option').html($this.text());
|
||||
$select.find('button').focus();
|
||||
|
||||
// Trigger select 'change'
|
||||
$select.prev('select').trigger('change');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
this.$newElement.on('click', 'li.disabled a, li dt, li .divider', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
$select = $(this).parent().parents('.select');
|
||||
$select.find('button').focus();
|
||||
});
|
||||
|
||||
this.$element.on('change', function(e) {
|
||||
_this.render();
|
||||
});
|
||||
},
|
||||
|
||||
val:function(value) {
|
||||
|
||||
if(value!=undefined) {
|
||||
this.$element.val( value );
|
||||
|
||||
this.$element.trigger('change');
|
||||
return this.$element;
|
||||
} else {
|
||||
return this.$element.val();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$.fn.selectpicker = function(option, event) {
|
||||
//get the args of the outer function..
|
||||
var args = arguments;
|
||||
var value;
|
||||
var chain = this.each(function () {
|
||||
var $this = $(this),
|
||||
data = $this.data('selectpicker'),
|
||||
options = typeof option == 'object' && option;
|
||||
|
||||
if (!data) {
|
||||
$this.data('selectpicker', (data = new Selectpicker(this, options, event)));
|
||||
} else {
|
||||
for(var i in option) {
|
||||
data[i]=option[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof option == 'string') {
|
||||
//Copy the value of option, as once we shift the arguments
|
||||
//it also shifts the value of option.
|
||||
property = option;
|
||||
if(data[property] instanceof Function) {
|
||||
[].shift.apply(args);
|
||||
value = data[property].apply(data, args);
|
||||
} else {
|
||||
value = data[property];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if(value!=undefined) {
|
||||
return value;
|
||||
} else {
|
||||
return chain;
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.selectpicker.defaults = {
|
||||
style: null,
|
||||
size: 'auto',
|
||||
title: null,
|
||||
selectedTextFormat : 'values',
|
||||
noneSelectedText : 'Nothing selected',
|
||||
width: null,
|
||||
menuStyle: null,
|
||||
toggleSize: null
|
||||
}
|
||||
|
||||
}(window.jQuery);
|
||||
7
public/assets/admin/js/bootstrap.min.js
vendored
Normal file
7
public/assets/admin/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
9
public/assets/admin/js/chartist.min.js
vendored
Executable file
9
public/assets/admin/js/chartist.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
152
public/assets/admin/js/demo.js
Executable file
152
public/assets/admin/js/demo.js
Executable file
@@ -0,0 +1,152 @@
|
||||
type = ['','info','success','warning','danger'];
|
||||
|
||||
|
||||
demo = {
|
||||
initPickColor: function(){
|
||||
$('.pick-class-label').click(function(){
|
||||
var new_class = $(this).attr('new-class');
|
||||
var old_class = $('#display-buttons').attr('data-class');
|
||||
var display_div = $('#display-buttons');
|
||||
if(display_div.length) {
|
||||
var display_buttons = display_div.find('.btn');
|
||||
display_buttons.removeClass(old_class);
|
||||
display_buttons.addClass(new_class);
|
||||
display_div.attr('data-class', new_class);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
initChartist: function(){
|
||||
|
||||
var dataSales = {
|
||||
labels: ['9:00AM', '12:00AM', '3:00PM', '6:00PM', '9:00PM', '12:00PM', '3:00AM', '6:00AM'],
|
||||
series: [
|
||||
[287, 385, 490, 492, 554, 586, 698, 695, 752, 788, 846, 944],
|
||||
[67, 152, 143, 240, 287, 335, 435, 437, 539, 542, 544, 647],
|
||||
[23, 113, 67, 108, 190, 239, 307, 308, 439, 410, 410, 509]
|
||||
]
|
||||
};
|
||||
|
||||
var optionsSales = {
|
||||
lineSmooth: false,
|
||||
low: 0,
|
||||
high: 800,
|
||||
showArea: true,
|
||||
height: "245px",
|
||||
axisX: {
|
||||
showGrid: false,
|
||||
},
|
||||
lineSmooth: Chartist.Interpolation.simple({
|
||||
divisor: 3
|
||||
}),
|
||||
showLine: false,
|
||||
showPoint: false,
|
||||
};
|
||||
|
||||
var responsiveSales = [
|
||||
['screen and (max-width: 640px)', {
|
||||
axisX: {
|
||||
labelInterpolationFnc: function (value) {
|
||||
return value[0];
|
||||
}
|
||||
}
|
||||
}]
|
||||
];
|
||||
|
||||
Chartist.Line('#chartHours', dataSales, optionsSales, responsiveSales);
|
||||
|
||||
|
||||
var data = {
|
||||
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
||||
series: [
|
||||
[542, 443, 320, 780, 553, 453, 326, 434, 568, 610, 756, 895],
|
||||
[412, 243, 280, 580, 453, 353, 300, 364, 368, 410, 636, 695]
|
||||
]
|
||||
};
|
||||
|
||||
var options = {
|
||||
seriesBarDistance: 10,
|
||||
axisX: {
|
||||
showGrid: false
|
||||
},
|
||||
height: "245px"
|
||||
};
|
||||
|
||||
var responsiveOptions = [
|
||||
['screen and (max-width: 640px)', {
|
||||
seriesBarDistance: 5,
|
||||
axisX: {
|
||||
labelInterpolationFnc: function (value) {
|
||||
return value[0];
|
||||
}
|
||||
}
|
||||
}]
|
||||
];
|
||||
|
||||
Chartist.Bar('#chartActivity', data, options, responsiveOptions);
|
||||
|
||||
var dataPreferences = {
|
||||
series: [
|
||||
[25, 30, 20, 25]
|
||||
]
|
||||
};
|
||||
|
||||
var optionsPreferences = {
|
||||
donut: true,
|
||||
donutWidth: 40,
|
||||
startAngle: 0,
|
||||
total: 100,
|
||||
showLabel: false,
|
||||
axisX: {
|
||||
showGrid: false
|
||||
}
|
||||
};
|
||||
|
||||
Chartist.Pie('#chartPreferences', dataPreferences, optionsPreferences);
|
||||
|
||||
Chartist.Pie('#chartPreferences', {
|
||||
labels: ['62%','32%','6%'],
|
||||
series: [62, 32, 6]
|
||||
});
|
||||
},
|
||||
|
||||
initGoogleMaps: function(){
|
||||
var myLatlng = new google.maps.LatLng(40.748817, -73.985428);
|
||||
var mapOptions = {
|
||||
zoom: 13,
|
||||
center: myLatlng,
|
||||
scrollwheel: false, //we disable de scroll over the map, it is a really annoing when you scroll through page
|
||||
styles: [{"featureType":"water","stylers":[{"saturation":43},{"lightness":-11},{"hue":"#0088ff"}]},{"featureType":"road","elementType":"geometry.fill","stylers":[{"hue":"#ff0000"},{"saturation":-100},{"lightness":99}]},{"featureType":"road","elementType":"geometry.stroke","stylers":[{"color":"#808080"},{"lightness":54}]},{"featureType":"landscape.man_made","elementType":"geometry.fill","stylers":[{"color":"#ece2d9"}]},{"featureType":"poi.park","elementType":"geometry.fill","stylers":[{"color":"#ccdca1"}]},{"featureType":"road","elementType":"labels.text.fill","stylers":[{"color":"#767676"}]},{"featureType":"road","elementType":"labels.text.stroke","stylers":[{"color":"#ffffff"}]},{"featureType":"poi","stylers":[{"visibility":"off"}]},{"featureType":"landscape.natural","elementType":"geometry.fill","stylers":[{"visibility":"on"},{"color":"#b8cb93"}]},{"featureType":"poi.park","stylers":[{"visibility":"on"}]},{"featureType":"poi.sports_complex","stylers":[{"visibility":"on"}]},{"featureType":"poi.medical","stylers":[{"visibility":"on"}]},{"featureType":"poi.business","stylers":[{"visibility":"simplified"}]}]
|
||||
|
||||
}
|
||||
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
|
||||
|
||||
var marker = new google.maps.Marker({
|
||||
position: myLatlng,
|
||||
title:"Hello World!"
|
||||
});
|
||||
|
||||
// To add the marker to the map, call setMap();
|
||||
marker.setMap(map);
|
||||
},
|
||||
|
||||
showNotification: function(from, align){
|
||||
color = Math.floor((Math.random() * 4) + 1);
|
||||
|
||||
$.notify({
|
||||
icon: "pe-7s-gift",
|
||||
message: "Welcome to <b>Light Bootstrap Dashboard</b> - a beautiful freebie for every web developer."
|
||||
|
||||
},{
|
||||
type: type[color],
|
||||
timer: 4000,
|
||||
placement: {
|
||||
from: from,
|
||||
align: align
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
9789
public/assets/admin/js/jquery-1.10.2.js
vendored
Normal file
9789
public/assets/admin/js/jquery-1.10.2.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
175
public/assets/admin/js/light-bootstrap-dashboard.js
Normal file
175
public/assets/admin/js/light-bootstrap-dashboard.js
Normal file
@@ -0,0 +1,175 @@
|
||||
/*!
|
||||
|
||||
=========================================================
|
||||
* Light Bootstrap Dashboard - v1.3.1.0
|
||||
=========================================================
|
||||
|
||||
* Product Page: http://www.creative-tim.com/product/light-bootstrap-dashboard
|
||||
* Copyright 2017 Creative Tim (http://www.creative-tim.com)
|
||||
* Licensed under MIT (https://github.com/creativetimofficial/light-bootstrap-dashboard/blob/master/LICENSE.md)
|
||||
|
||||
=========================================================
|
||||
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
*/
|
||||
|
||||
var searchVisible = 0;
|
||||
var transparent = true;
|
||||
|
||||
var transparentDemo = true;
|
||||
var fixedTop = false;
|
||||
|
||||
var navbar_initialized = false;
|
||||
|
||||
$(document).ready(function(){
|
||||
window_width = $(window).width();
|
||||
|
||||
// check if there is an image set for the sidebar's background
|
||||
lbd.checkSidebarImage();
|
||||
|
||||
// Init navigation toggle for small screens
|
||||
if(window_width <= 991){
|
||||
lbd.initRightMenu();
|
||||
}
|
||||
|
||||
// Activate the tooltips
|
||||
$('[rel="tooltip"]').tooltip();
|
||||
|
||||
// Activate the switches with icons
|
||||
if($('.switch').length != 0){
|
||||
$('.switch')['bootstrapSwitch']();
|
||||
}
|
||||
// Activate regular switches
|
||||
if($("[data-toggle='switch']").length != 0){
|
||||
$("[data-toggle='switch']").wrap('<div class="switch" />').parent().bootstrapSwitch();
|
||||
}
|
||||
|
||||
$('.form-control').on("focus", function(){
|
||||
$(this).parent('.input-group').addClass("input-group-focus");
|
||||
}).on("blur", function(){
|
||||
$(this).parent(".input-group").removeClass("input-group-focus");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// activate collapse right menu when the windows is resized
|
||||
$(window).resize(function(){
|
||||
if($(window).width() <= 991){
|
||||
lbd.initRightMenu();
|
||||
}
|
||||
});
|
||||
|
||||
lbd = {
|
||||
misc:{
|
||||
navbar_menu_visible: 0
|
||||
},
|
||||
|
||||
checkSidebarImage: function(){
|
||||
$sidebar = $('.sidebar');
|
||||
image_src = $sidebar.data('image');
|
||||
|
||||
if(image_src !== undefined){
|
||||
sidebar_container = '<div class="sidebar-background" style="background-image: url(' + image_src + ') "/>'
|
||||
$sidebar.append(sidebar_container);
|
||||
}
|
||||
},
|
||||
initRightMenu: function(){
|
||||
if(!navbar_initialized){
|
||||
$navbar = $('nav').find('.navbar-collapse').first().clone(true);
|
||||
|
||||
$sidebar = $('.sidebar');
|
||||
sidebar_color = $sidebar.data('color');
|
||||
|
||||
$logo = $sidebar.find('.logo').first();
|
||||
logo_content = $logo[0].outerHTML;
|
||||
|
||||
ul_content = '';
|
||||
|
||||
$navbar.attr('data-color',sidebar_color);
|
||||
|
||||
// add the content from the sidebar to the right menu
|
||||
content_buff = $sidebar.find('.nav').html();
|
||||
ul_content = ul_content + content_buff;
|
||||
|
||||
//add the content from the regular header to the right menu
|
||||
$navbar.children('ul').each(function(){
|
||||
content_buff = $(this).html();
|
||||
ul_content = ul_content + content_buff;
|
||||
});
|
||||
|
||||
ul_content = '<ul class="nav navbar-nav">' + ul_content + '</ul>';
|
||||
|
||||
navbar_content = logo_content + ul_content;
|
||||
|
||||
$navbar.html(navbar_content);
|
||||
|
||||
$('body').append($navbar);
|
||||
|
||||
background_image = $sidebar.data('image');
|
||||
if(background_image != undefined){
|
||||
$navbar.css('background',"url('" + background_image + "')")
|
||||
.removeAttr('data-nav-image')
|
||||
.addClass('has-image');
|
||||
}
|
||||
|
||||
|
||||
$toggle = $('.navbar-toggle');
|
||||
|
||||
$navbar.find('a').removeClass('btn btn-round btn-default');
|
||||
$navbar.find('button').removeClass('btn-round btn-fill btn-info btn-primary btn-success btn-danger btn-warning btn-neutral');
|
||||
$navbar.find('button').addClass('btn-simple btn-block');
|
||||
|
||||
$toggle.click(function (){
|
||||
if(lbd.misc.navbar_menu_visible == 1) {
|
||||
$('html').removeClass('nav-open');
|
||||
lbd.misc.navbar_menu_visible = 0;
|
||||
$('#bodyClick').remove();
|
||||
setTimeout(function(){
|
||||
$toggle.removeClass('toggled');
|
||||
}, 400);
|
||||
|
||||
} else {
|
||||
setTimeout(function(){
|
||||
$toggle.addClass('toggled');
|
||||
}, 430);
|
||||
|
||||
div = '<div id="bodyClick"></div>';
|
||||
$(div).appendTo("body").click(function() {
|
||||
$('html').removeClass('nav-open');
|
||||
lbd.misc.navbar_menu_visible = 0;
|
||||
$('#bodyClick').remove();
|
||||
setTimeout(function(){
|
||||
$toggle.removeClass('toggled');
|
||||
}, 400);
|
||||
});
|
||||
|
||||
$('html').addClass('nav-open');
|
||||
lbd.misc.navbar_menu_visible = 1;
|
||||
|
||||
}
|
||||
});
|
||||
navbar_initialized = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Returns a function, that, as long as it continues to be invoked, will not
|
||||
// be triggered. The function will be called after it stops being called for
|
||||
// N milliseconds. If `immediate` is passed, trigger the function on the
|
||||
// leading edge, instead of the trailing.
|
||||
|
||||
function debounce(func, wait, immediate) {
|
||||
var timeout;
|
||||
return function() {
|
||||
var context = this, args = arguments;
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(function() {
|
||||
timeout = null;
|
||||
if (!immediate) func.apply(context, args);
|
||||
}, wait);
|
||||
if (immediate && !timeout) func.apply(context, args);
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user