use creative-tim paper
This commit is contained in:
@@ -1,502 +0,0 @@
|
||||
!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);
|
||||
|
||||
|
||||
248
public/assets/admin/js/bootstrap-checkbox-radio.js
vendored
Normal file
248
public/assets/admin/js/bootstrap-checkbox-radio.js
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
!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 fa-base"></span><span class="second-icon fa fa-check-square fa-base"></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 () {
|
||||
$('input[type="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 fa-base"></span><span class="second-icon fa fa-dot-circle-o fa-base"></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 () {
|
||||
$('input[type="radio"]').each(function () {
|
||||
var $radio = $(this);
|
||||
$radio.radio();
|
||||
});
|
||||
});
|
||||
|
||||
}(window.jQuery);
|
||||
438
public/assets/admin/js/bootstrap-select.js
vendored
438
public/assets/admin/js/bootstrap-select.js
vendored
@@ -1,438 +0,0 @@
|
||||
!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);
|
||||
@@ -1,10 +1,10 @@
|
||||
type = ['','info','success','warning','danger'];
|
||||
|
||||
|
||||
|
||||
demo = {
|
||||
initPickColor: function(){
|
||||
$('.pick-class-label').click(function(){
|
||||
var new_class = $(this).attr('new-class');
|
||||
var new_class = $(this).attr('new-class');
|
||||
var old_class = $('#display-buttons').attr('data-class');
|
||||
var display_div = $('#display-buttons');
|
||||
if(display_div.length) {
|
||||
@@ -15,22 +15,22 @@ demo = {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
initChartist: function(){
|
||||
|
||||
|
||||
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]
|
||||
[287, 385, 490, 562, 594, 626, 698, 895, 952],
|
||||
[67, 152, 193, 240, 387, 435, 535, 642, 744],
|
||||
[23, 113, 67, 108, 190, 239, 307, 410, 410]
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
var optionsSales = {
|
||||
lineSmooth: false,
|
||||
low: 0,
|
||||
high: 800,
|
||||
high: 1000,
|
||||
showArea: true,
|
||||
height: "245px",
|
||||
axisX: {
|
||||
@@ -39,10 +39,10 @@ demo = {
|
||||
lineSmooth: Chartist.Interpolation.simple({
|
||||
divisor: 3
|
||||
}),
|
||||
showLine: false,
|
||||
showLine: true,
|
||||
showPoint: false,
|
||||
};
|
||||
|
||||
|
||||
var responsiveSales = [
|
||||
['screen and (max-width: 640px)', {
|
||||
axisX: {
|
||||
@@ -52,18 +52,18 @@ demo = {
|
||||
}
|
||||
}]
|
||||
];
|
||||
|
||||
|
||||
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]
|
||||
[542, 543, 520, 680, 653, 753, 326, 434, 568, 610, 756, 895],
|
||||
[230, 293, 380, 480, 503, 553, 600, 664, 698, 710, 736, 795]
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
var options = {
|
||||
seriesBarDistance: 10,
|
||||
axisX: {
|
||||
@@ -71,7 +71,7 @@ demo = {
|
||||
},
|
||||
height: "245px"
|
||||
};
|
||||
|
||||
|
||||
var responsiveOptions = [
|
||||
['screen and (max-width: 640px)', {
|
||||
seriesBarDistance: 5,
|
||||
@@ -82,15 +82,15 @@ demo = {
|
||||
}
|
||||
}]
|
||||
];
|
||||
|
||||
Chartist.Bar('#chartActivity', data, options, responsiveOptions);
|
||||
|
||||
|
||||
Chartist.Line('#chartActivity', data, options, responsiveOptions);
|
||||
|
||||
var dataPreferences = {
|
||||
series: [
|
||||
[25, 30, 20, 25]
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
var optionsPreferences = {
|
||||
donut: true,
|
||||
donutWidth: 40,
|
||||
@@ -101,15 +101,15 @@ demo = {
|
||||
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 = {
|
||||
@@ -117,26 +117,26 @@ demo = {
|
||||
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."
|
||||
|
||||
icon: "ti-gift",
|
||||
message: "Welcome to <b>Paper Dashboard</b> - a beautiful freebie for every web developer."
|
||||
|
||||
},{
|
||||
type: type[color],
|
||||
timer: 4000,
|
||||
@@ -145,8 +145,171 @@ demo = {
|
||||
align: align
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
initDocumentationCharts: function(){
|
||||
// init single simple line chart
|
||||
var dataPerformance = {
|
||||
labels: ['6pm','9pm','11pm', '2am', '4am', '8am', '2pm', '5pm', '8pm', '11pm', '4am'],
|
||||
series: [
|
||||
[1, 6, 8, 7, 4, 7, 8, 12, 16, 17, 14, 13]
|
||||
]
|
||||
};
|
||||
|
||||
var optionsPerformance = {
|
||||
showPoint: false,
|
||||
lineSmooth: true,
|
||||
height: "200px",
|
||||
axisX: {
|
||||
showGrid: false,
|
||||
showLabel: true
|
||||
},
|
||||
axisY: {
|
||||
offset: 40,
|
||||
},
|
||||
low: 0,
|
||||
high: 16,
|
||||
height: "250px"
|
||||
};
|
||||
|
||||
Chartist.Line('#chartPerformance', dataPerformance, optionsPerformance);
|
||||
|
||||
// init single line with points chart
|
||||
var dataStock = {
|
||||
labels: ['\'07','\'08','\'09', '\'10', '\'11', '\'12', '\'13', '\'14', '\'15'],
|
||||
series: [
|
||||
[22.20, 34.90, 42.28, 51.93, 62.21, 80.23, 62.21, 82.12, 102.50, 107.23]
|
||||
]
|
||||
};
|
||||
|
||||
var optionsStock = {
|
||||
lineSmooth: false,
|
||||
height: "200px",
|
||||
axisY: {
|
||||
offset: 40,
|
||||
labelInterpolationFnc: function(value) {
|
||||
return '$' + value;
|
||||
}
|
||||
|
||||
},
|
||||
low: 10,
|
||||
height: "250px",
|
||||
high: 110,
|
||||
classNames: {
|
||||
point: 'ct-point ct-green',
|
||||
line: 'ct-line ct-green'
|
||||
}
|
||||
};
|
||||
|
||||
Chartist.Line('#chartStock', dataStock, optionsStock);
|
||||
|
||||
// init multiple lines chart
|
||||
var dataSales = {
|
||||
labels: ['9:00AM', '12:00AM', '3:00PM', '6:00PM', '9:00PM', '12:00PM', '3:00AM', '6:00AM'],
|
||||
series: [
|
||||
[287, 385, 490, 562, 594, 626, 698, 895, 952],
|
||||
[67, 152, 193, 240, 387, 435, 535, 642, 744],
|
||||
[23, 113, 67, 108, 190, 239, 307, 410, 410]
|
||||
]
|
||||
};
|
||||
|
||||
var optionsSales = {
|
||||
lineSmooth: false,
|
||||
low: 0,
|
||||
high: 1000,
|
||||
showArea: true,
|
||||
height: "245px",
|
||||
axisX: {
|
||||
showGrid: false,
|
||||
},
|
||||
lineSmooth: Chartist.Interpolation.simple({
|
||||
divisor: 3
|
||||
}),
|
||||
showLine: true,
|
||||
showPoint: false,
|
||||
};
|
||||
|
||||
var responsiveSales = [
|
||||
['screen and (max-width: 640px)', {
|
||||
axisX: {
|
||||
labelInterpolationFnc: function (value) {
|
||||
return value[0];
|
||||
}
|
||||
}
|
||||
}]
|
||||
];
|
||||
|
||||
Chartist.Line('#chartHours', dataSales, optionsSales, responsiveSales);
|
||||
|
||||
// pie chart
|
||||
Chartist.Pie('#chartPreferences', {
|
||||
labels: ['62%','32%','6%'],
|
||||
series: [62, 32, 6]
|
||||
});
|
||||
|
||||
// bar chart
|
||||
var dataViews = {
|
||||
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]
|
||||
]
|
||||
};
|
||||
|
||||
var optionsViews = {
|
||||
seriesBarDistance: 10,
|
||||
classNames: {
|
||||
bar: 'ct-bar'
|
||||
},
|
||||
axisX: {
|
||||
showGrid: false,
|
||||
|
||||
},
|
||||
height: "250px"
|
||||
|
||||
};
|
||||
|
||||
var responsiveOptionsViews = [
|
||||
['screen and (max-width: 640px)', {
|
||||
seriesBarDistance: 5,
|
||||
axisX: {
|
||||
labelInterpolationFnc: function (value) {
|
||||
return value[0];
|
||||
}
|
||||
}
|
||||
}]
|
||||
];
|
||||
|
||||
Chartist.Bar('#chartViews', dataViews, optionsViews, responsiveOptionsViews);
|
||||
|
||||
// multiple bars chart
|
||||
var data = {
|
||||
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
||||
series: [
|
||||
[542, 543, 520, 680, 653, 753, 326, 434, 568, 610, 756, 895],
|
||||
[230, 293, 380, 480, 503, 553, 600, 664, 698, 710, 736, 795]
|
||||
]
|
||||
};
|
||||
|
||||
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.Line('#chartActivity', data, options, responsiveOptions);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
/*!
|
||||
|
||||
=========================================================
|
||||
* 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);
|
||||
};
|
||||
};
|
||||
157
public/assets/admin/js/paper-dashboard.js
Normal file
157
public/assets/admin/js/paper-dashboard.js
Normal file
@@ -0,0 +1,157 @@
|
||||
/*!
|
||||
|
||||
=========================================================
|
||||
* Paper Dashboard - v1.1.2
|
||||
=========================================================
|
||||
|
||||
* Product Page: http://www.creative-tim.com/product/paper-dashboard
|
||||
* Copyright 2017 Creative Tim (http://www.creative-tim.com)
|
||||
* Licensed under MIT (https://github.com/creativetimofficial/paper-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 fixedTop = false;
|
||||
var transparent = true;
|
||||
var navbar_initialized = false;
|
||||
|
||||
$(document).ready(function(){
|
||||
window_width = $(window).width();
|
||||
|
||||
// Init navigation toggle for small screens
|
||||
if(window_width <= 991){
|
||||
pd.initRightMenu();
|
||||
}
|
||||
|
||||
// Activate the tooltips
|
||||
$('[rel="tooltip"]').tooltip();
|
||||
|
||||
});
|
||||
|
||||
// activate collapse right menu when the windows is resized
|
||||
$(window).resize(function(){
|
||||
if($(window).width() <= 991){
|
||||
pd.initRightMenu();
|
||||
}
|
||||
});
|
||||
|
||||
pd = {
|
||||
misc:{
|
||||
navbar_menu_visible: 0
|
||||
},
|
||||
checkScrollForTransparentNavbar: debounce(function() {
|
||||
if($(document).scrollTop() > 381 ) {
|
||||
if(transparent) {
|
||||
transparent = false;
|
||||
$('.navbar-color-on-scroll').removeClass('navbar-transparent');
|
||||
$('.navbar-title').removeClass('hidden');
|
||||
}
|
||||
} else {
|
||||
if( !transparent ) {
|
||||
transparent = true;
|
||||
$('.navbar-color-on-scroll').addClass('navbar-transparent');
|
||||
$('.navbar-title').addClass('hidden');
|
||||
}
|
||||
}
|
||||
}),
|
||||
initRightMenu: function(){
|
||||
if(!navbar_initialized){
|
||||
$off_canvas_sidebar = $('nav').find('.navbar-collapse').first().clone(true);
|
||||
|
||||
$sidebar = $('.sidebar');
|
||||
sidebar_bg_color = $sidebar.data('background-color');
|
||||
sidebar_active_color = $sidebar.data('active-color');
|
||||
|
||||
$logo = $sidebar.find('.logo').first();
|
||||
logo_content = $logo[0].outerHTML;
|
||||
|
||||
ul_content = '';
|
||||
|
||||
// set the bg color and active color from the default sidebar to the off canvas sidebar;
|
||||
$off_canvas_sidebar.attr('data-background-color',sidebar_bg_color);
|
||||
$off_canvas_sidebar.attr('data-active-color',sidebar_active_color);
|
||||
|
||||
$off_canvas_sidebar.addClass('off-canvas-sidebar');
|
||||
|
||||
//add the content from the regular header to the right menu
|
||||
$off_canvas_sidebar.children('ul').each(function(){
|
||||
content_buff = $(this).html();
|
||||
ul_content = ul_content + content_buff;
|
||||
});
|
||||
|
||||
// add the content from the sidebar to the right menu
|
||||
content_buff = $sidebar.find('.nav').html();
|
||||
ul_content = ul_content + '<li class="divider"></li>'+ content_buff;
|
||||
|
||||
ul_content = '<ul class="nav navbar-nav">' + ul_content + '</ul>';
|
||||
|
||||
navbar_content = logo_content + ul_content;
|
||||
navbar_content = '<div class="sidebar-wrapper">' + navbar_content + '</div>';
|
||||
|
||||
$off_canvas_sidebar.html(navbar_content);
|
||||
|
||||
$('body').append($off_canvas_sidebar);
|
||||
|
||||
$toggle = $('.navbar-toggle');
|
||||
|
||||
$off_canvas_sidebar.find('a').removeClass('btn btn-round btn-default');
|
||||
$off_canvas_sidebar.find('button').removeClass('btn-round btn-fill btn-info btn-primary btn-success btn-danger btn-warning btn-neutral');
|
||||
$off_canvas_sidebar.find('button').addClass('btn-simple btn-block');
|
||||
|
||||
$toggle.click(function (){
|
||||
if(pd.misc.navbar_menu_visible == 1) {
|
||||
$('html').removeClass('nav-open');
|
||||
pd.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');
|
||||
pd.misc.navbar_menu_visible = 0;
|
||||
$('#bodyClick').remove();
|
||||
setTimeout(function(){
|
||||
$toggle.removeClass('toggled');
|
||||
}, 400);
|
||||
});
|
||||
|
||||
$('html').addClass('nav-open');
|
||||
pd.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