mirror of
https://github.com/janickiy/yii2-nomer
synced 2025-03-09 15:39:59 +00:00
add files to project
This commit is contained in:
commit
5cac498444
3729 changed files with 836998 additions and 0 deletions
17
web/metronic/global/plugins/bootstrap-confirmation/README.md
Normal file
17
web/metronic/global/plugins/bootstrap-confirmation/README.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Bootstrap-Confirmation
|
||||
|
||||
[](http://mistic100.github.io/Bootstrap-Confirmation)
|
||||
|
||||
Bootstrap plugin for on-place confirm boxes using Popover.
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
http://mistic100.github.io/Bootstrap-Confirmation
|
||||
|
||||
|
||||
## Changes from original one
|
||||
|
||||
- Bootstrap 3 compatible
|
||||
- Fix double event fires
|
||||
- Automatic handle of links (without need of custom callback)
|
255
web/metronic/global/plugins/bootstrap-confirmation/bootstrap-confirmation.js
vendored
Normal file
255
web/metronic/global/plugins/bootstrap-confirmation/bootstrap-confirmation.js
vendored
Normal file
|
@ -0,0 +1,255 @@
|
|||
/*!
|
||||
* Bootstrap Confirmation
|
||||
* Copyright 2013 Nimit Suwannagate <ethaizone@hotmail.com>
|
||||
* Copyright 2014-2016 Damien "Mistic" Sorel <http://www.strangeplanet.fr>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License")
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
// Confirmation extends popover.js
|
||||
if (!$.fn.popover) throw new Error('Confirmation requires popover.js');
|
||||
|
||||
// CONFIRMATION PUBLIC CLASS DEFINITION
|
||||
// ===============================
|
||||
var Confirmation = function (element, options) {
|
||||
options.trigger = 'click';
|
||||
|
||||
this.init('confirmation', element, options);
|
||||
|
||||
// keep trace of selectors
|
||||
this.options._isDelegate = false;
|
||||
if (options.selector) { // container of buttons
|
||||
this.options._selector = this._options._selector = options._root_selector +' '+ options.selector;
|
||||
}
|
||||
else if (options._selector) { // children of container
|
||||
this.options._selector = options._selector;
|
||||
this.options._isDelegate = true;
|
||||
}
|
||||
else { // standalone
|
||||
this.options._selector = options._root_selector;
|
||||
}
|
||||
|
||||
var that = this;
|
||||
|
||||
if (!this.options.selector) {
|
||||
// store copied attributes
|
||||
this.options._attributes = {};
|
||||
if (this.options.copyAttributes) {
|
||||
if (typeof this.options.copyAttributes === 'string') {
|
||||
this.options.copyAttributes = this.options.copyAttributes.split(' ');
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.options.copyAttributes = [];
|
||||
}
|
||||
|
||||
this.options.copyAttributes.forEach(function(attr) {
|
||||
this.options._attributes[attr] = this.$element.attr(attr);
|
||||
}, this);
|
||||
|
||||
// cancel original event
|
||||
this.$element.on(that.options.trigger, function(e, ack) {
|
||||
if (!ack) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
});
|
||||
|
||||
// manage singleton
|
||||
this.$element.on('show.bs.confirmation', function(e) {
|
||||
if (that.options.singleton) {
|
||||
// close all other popover already initialized
|
||||
$(that.options._selector).not($(this)).filter(function() {
|
||||
return $(this).data('bs.confirmation') !== undefined;
|
||||
}).confirmation('hide');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!this.options._isDelegate) {
|
||||
// manage popout
|
||||
this.eventBody = false;
|
||||
this.uid = this.$element[0].id || this.getUID('group_');
|
||||
|
||||
this.$element.on('shown.bs.confirmation', function(e) {
|
||||
if (that.options.popout && !that.eventBody) {
|
||||
var $this = $(this);
|
||||
that.eventBody = $('body').on('click.bs.confirmation.'+that.uid, function(e) {
|
||||
if ($(that.options._selector).is(e.target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// close all popover already initialized
|
||||
$(that.options._selector).filter(function() {
|
||||
return $(this).data('bs.confirmation') !== undefined;
|
||||
}).confirmation('hide');
|
||||
|
||||
$('body').off('click.bs.'+that.uid);
|
||||
that.eventBody = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Confirmation.DEFAULTS = $.extend({}, $.fn.popover.Constructor.DEFAULTS, {
|
||||
placement: 'top',
|
||||
title: 'Are you sure?',
|
||||
html: true,
|
||||
popout: false,
|
||||
singleton: false,
|
||||
copyAttributes: 'href target',
|
||||
onConfirm: $.noop,
|
||||
onCancel: $.noop,
|
||||
btnOkClass: 'btn-xs btn-primary',
|
||||
btnOkIcon: 'glyphicon glyphicon-ok',
|
||||
btnOkLabel: 'Yes',
|
||||
btnCancelClass: 'btn-xs btn-default',
|
||||
btnCancelIcon: 'glyphicon glyphicon-remove',
|
||||
btnCancelLabel: 'No',
|
||||
template:
|
||||
'<div class="popover confirmation">' +
|
||||
'<div class="arrow"></div>' +
|
||||
'<h3 class="popover-title"></h3>' +
|
||||
'<div class="popover-content text-center">'+
|
||||
'<div class="btn-group">'+
|
||||
'<a class="btn" data-apply="confirmation"></a>'+
|
||||
'<a class="btn" data-dismiss="confirmation"></a>'+
|
||||
'</div>'+
|
||||
'</div>'+
|
||||
'</div>'
|
||||
});
|
||||
|
||||
Confirmation.prototype = $.extend({}, $.fn.popover.Constructor.prototype);
|
||||
|
||||
Confirmation.prototype.constructor = Confirmation;
|
||||
|
||||
Confirmation.prototype.getDefaults = function () {
|
||||
return Confirmation.DEFAULTS;
|
||||
};
|
||||
|
||||
Confirmation.prototype.setContent = function () {
|
||||
var that = this,
|
||||
$tip = this.tip(),
|
||||
o = this.options;
|
||||
|
||||
$tip.find('.popover-title')[o.html ? 'html' : 'text'](this.getTitle());
|
||||
|
||||
// configure 'ok' button
|
||||
$tip.find('[data-apply="confirmation"]')
|
||||
.addClass(o.btnOkClass)
|
||||
.html(o.btnOkLabel)
|
||||
.attr(this.options._attributes)
|
||||
.prepend($('<i></i>').addClass(o.btnOkIcon), ' ')
|
||||
.off('click')
|
||||
.one('click', function(e) {
|
||||
that.getOnConfirm.call(that).call(that.$element);
|
||||
that.$element.trigger('confirmed.bs.confirmation');
|
||||
that.$element.trigger(that.options.trigger, [true]);
|
||||
that.$element.confirmation('hide');
|
||||
});
|
||||
|
||||
// configure 'cancel' button
|
||||
$tip.find('[data-dismiss="confirmation"]')
|
||||
.addClass(o.btnCancelClass)
|
||||
.html(o.btnCancelLabel)
|
||||
.prepend($('<i></i>').addClass(o.btnCancelIcon), ' ')
|
||||
.off('click')
|
||||
.one('click', function(e) {
|
||||
that.getOnCancel.call(that).call(that.$element);
|
||||
if (that.inState) that.inState.click = false; // Bootstrap 3.3.5
|
||||
that.$element.trigger('canceled.bs.confirmation');
|
||||
that.$element.confirmation('hide');
|
||||
});
|
||||
|
||||
$tip.removeClass('fade top bottom left right in');
|
||||
|
||||
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
|
||||
// this manually by checking the contents.
|
||||
if (!$tip.find('.popover-title').html()) {
|
||||
$tip.find('.popover-title').hide();
|
||||
}
|
||||
};
|
||||
|
||||
Confirmation.prototype.getOnConfirm = function() {
|
||||
if (this.$element.attr('data-on-confirm')) {
|
||||
return getFunctionFromString(this.$element.attr('data-on-confirm'));
|
||||
}
|
||||
else {
|
||||
return this.options.onConfirm;
|
||||
}
|
||||
};
|
||||
|
||||
Confirmation.prototype.getOnCancel = function() {
|
||||
if (this.$element.attr('data-on-cancel')) {
|
||||
return getFunctionFromString(this.$element.attr('data-on-cancel'));
|
||||
}
|
||||
else {
|
||||
return this.options.onCancel;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Generates an anonymous function from a function name
|
||||
* function name may contain dots (.) to navigate through objects
|
||||
* root context is window
|
||||
*/
|
||||
function getFunctionFromString(functionName) {
|
||||
var context = window,
|
||||
namespaces = functionName.split('.'),
|
||||
func = namespaces.pop();
|
||||
|
||||
for (var i=0, l=namespaces.length; i<l; i++) {
|
||||
context = context[namespaces[i]];
|
||||
}
|
||||
|
||||
return function() {
|
||||
context[func].call(this);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// CONFIRMATION PLUGIN DEFINITION
|
||||
// =========================
|
||||
|
||||
var old = $.fn.confirmation;
|
||||
|
||||
$.fn.confirmation = function (option) {
|
||||
var options = (typeof option == 'object' && option) || {};
|
||||
options._root_selector = this.selector;
|
||||
|
||||
return this.each(function () {
|
||||
var $this = $(this),
|
||||
data = $this.data('bs.confirmation');
|
||||
|
||||
if (!data && option == 'destroy') {
|
||||
return;
|
||||
}
|
||||
if (!data) {
|
||||
$this.data('bs.confirmation', (data = new Confirmation(this, options)));
|
||||
}
|
||||
if (typeof option == 'string') {
|
||||
data[option]();
|
||||
|
||||
if (option == 'hide' && data.inState) { //data.inState doesn't exist in Bootstrap < 3.3.5
|
||||
data.inState.click = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.confirmation.Constructor = Confirmation;
|
||||
|
||||
|
||||
// CONFIRMATION NO CONFLICT
|
||||
// ===================
|
||||
|
||||
$.fn.confirmation.noConflict = function () {
|
||||
$.fn.confirmation = old;
|
||||
return this;
|
||||
};
|
||||
|
||||
}(jQuery));
|
7
web/metronic/global/plugins/bootstrap-confirmation/bootstrap-confirmation.min.js
vendored
Normal file
7
web/metronic/global/plugins/bootstrap-confirmation/bootstrap-confirmation.min.js
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
/*!
|
||||
* Bootstrap Confirmation 2.2.0
|
||||
* Copyright 2013 Nimit Suwannagate <ethaizone@hotmail.com>
|
||||
* Copyright 2014-2016 Damien "Mistic" Sorel <http://www.strangeplanet.fr>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License")
|
||||
*/
|
||||
!function(a){"use strict";function b(a){for(var b=window,c=a.split("."),d=c.pop(),e=0,f=c.length;f>e;e++)b=b[c[e]];return function(){b[d].call(this)}}if(!a.fn.popover)throw new Error("Confirmation requires popover.js");var c=function(b,c){c.trigger="click",this.init("confirmation",b,c),this.options._isDelegate=!1,c.selector?this.options._selector=this._options._selector=c._root_selector+" "+c.selector:c._selector?(this.options._selector=c._selector,this.options._isDelegate=!0):this.options._selector=c._root_selector;var d=this;this.options.selector||(this.options._attributes={},this.options.copyAttributes?"string"==typeof this.options.copyAttributes&&(this.options.copyAttributes=this.options.copyAttributes.split(" ")):this.options.copyAttributes=[],this.options.copyAttributes.forEach(function(a){this.options._attributes[a]=this.$element.attr(a)},this),this.$element.on(d.options.trigger,function(a,b){b||(a.preventDefault(),a.stopPropagation(),a.stopImmediatePropagation())}),this.$element.on("show.bs.confirmation",function(b){d.options.singleton&&a(d.options._selector).not(a(this)).filter(function(){return void 0!==a(this).data("bs.confirmation")}).confirmation("hide")})),this.options._isDelegate||(this.eventBody=!1,this.uid=this.$element[0].id||this.getUID("group_"),this.$element.on("shown.bs.confirmation",function(b){if(d.options.popout&&!d.eventBody){a(this);d.eventBody=a("body").on("click.bs.confirmation."+d.uid,function(b){a(d.options._selector).is(b.target)||(a(d.options._selector).filter(function(){return void 0!==a(this).data("bs.confirmation")}).confirmation("hide"),a("body").off("click.bs."+d.uid),d.eventBody=!1)})}}))};c.DEFAULTS=a.extend({},a.fn.popover.Constructor.DEFAULTS,{placement:"top",title:"Are you sure?",html:!0,popout:!1,singleton:!1,copyAttributes:"href target",onConfirm:a.noop,onCancel:a.noop,btnOkClass:"btn-xs btn-primary",btnOkIcon:"glyphicon glyphicon-ok",btnOkLabel:"Yes",btnCancelClass:"btn-xs btn-default",btnCancelIcon:"glyphicon glyphicon-remove",btnCancelLabel:"No",template:'<div class="popover confirmation"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content text-center"><div class="btn-group"><a class="btn" data-apply="confirmation"></a><a class="btn" data-dismiss="confirmation"></a></div></div></div>'}),c.prototype=a.extend({},a.fn.popover.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var b=this,c=this.tip(),d=this.options;c.find(".popover-title")[d.html?"html":"text"](this.getTitle()),c.find('[data-apply="confirmation"]').addClass(d.btnOkClass).html(d.btnOkLabel).attr(this.options._attributes).prepend(a("<i></i>").addClass(d.btnOkIcon)," ").off("click").one("click",function(a){b.getOnConfirm.call(b).call(b.$element),b.$element.trigger("confirmed.bs.confirmation"),b.$element.trigger(b.options.trigger,[!0]),b.$element.confirmation("hide")}),c.find('[data-dismiss="confirmation"]').addClass(d.btnCancelClass).html(d.btnCancelLabel).prepend(a("<i></i>").addClass(d.btnCancelIcon)," ").off("click").one("click",function(a){b.getOnCancel.call(b).call(b.$element),b.inState&&(b.inState.click=!1),b.$element.trigger("canceled.bs.confirmation"),b.$element.confirmation("hide")}),c.removeClass("fade top bottom left right in"),c.find(".popover-title").html()||c.find(".popover-title").hide()},c.prototype.getOnConfirm=function(){return this.$element.attr("data-on-confirm")?b(this.$element.attr("data-on-confirm")):this.options.onConfirm},c.prototype.getOnCancel=function(){return this.$element.attr("data-on-cancel")?b(this.$element.attr("data-on-cancel")):this.options.onCancel};var d=a.fn.confirmation;a.fn.confirmation=function(b){var d="object"==typeof b&&b||{};return d._root_selector=this.selector,this.each(function(){var e=a(this),f=e.data("bs.confirmation");(f||"destroy"!=b)&&(f||e.data("bs.confirmation",f=new c(this,d)),"string"==typeof b&&f[b]())})},a.fn.confirmation.Constructor=c,a.fn.confirmation.noConflict=function(){return a.fn.confirmation=d,this}}(jQuery);
|
Loading…
Add table
Add a link
Reference in a new issue