Compare commits
No commits in common. "49b59650a1fc2af3a78aa201805481bfd4364c62" and "275f2b6c18030277ce3f3c29c00f0c61fd1b4dd0" have entirely different histories.
49b59650a1
...
275f2b6c18
9 changed files with 366 additions and 1405 deletions
|
@ -102,11 +102,8 @@ function handle_search($request) {
|
||||||
Tpl :: assign('nbs_by_page', $nbs_by_page);
|
Tpl :: assign('nbs_by_page', $nbs_by_page);
|
||||||
Tpl :: assign('status_list', $status_list);
|
Tpl :: assign('status_list', $status_list);
|
||||||
|
|
||||||
Tpl :: add_css_file(
|
|
||||||
'lib/bootstrap5-dialog/css/bootstrap-dialog.min.css',
|
|
||||||
);
|
|
||||||
Tpl :: add_js_file(
|
Tpl :: add_js_file(
|
||||||
'lib/bootstrap5-dialog/js/bootstrap-dialog.min.js',
|
'lib/bootstrap4dialog/bootstrap4dialog.min.js',
|
||||||
'js/myconfirm.js',
|
'js/myconfirm.js',
|
||||||
'js/search.js'
|
'js/search.js'
|
||||||
);
|
);
|
||||||
|
@ -128,11 +125,8 @@ function handle_show($request) {
|
||||||
Tpl :: assign('item', $item);
|
Tpl :: assign('item', $item);
|
||||||
|
|
||||||
// Dialog
|
// Dialog
|
||||||
Tpl :: add_css_file(
|
|
||||||
'lib/bootstrap5-dialog/css/bootstrap-dialog.min.css',
|
|
||||||
);
|
|
||||||
Tpl :: add_js_file(
|
Tpl :: add_js_file(
|
||||||
'lib/bootstrap5-dialog/js/bootstrap-dialog.min.js',
|
'lib/bootstrap4dialog/bootstrap4dialog.min.js',
|
||||||
'js/myconfirm.js',
|
'js/myconfirm.js',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ namespace EesyPHP;
|
||||||
*
|
*
|
||||||
* @author Benjamin Renard <brenard@easter-eggs.com>
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||||
* @property-read string|null $current_url;
|
* @property-read string|null $current_url;
|
||||||
* @property-read string|null $current_full_url;
|
|
||||||
* @property-read array|null $handler;
|
* @property-read array|null $handler;
|
||||||
* @property-read bool $authenticated;
|
* @property-read bool $authenticated;
|
||||||
* @property-read bool $api_mode;
|
* @property-read bool $api_mode;
|
||||||
|
@ -76,8 +75,6 @@ class UrlRequest {
|
||||||
public function __get($key) {
|
public function __get($key) {
|
||||||
if ($key == 'current_url')
|
if ($key == 'current_url')
|
||||||
return $this -> current_url;
|
return $this -> current_url;
|
||||||
if ($key == 'current_full_url')
|
|
||||||
return Url::add_url_parameters($this -> current_url, $_GET, false);
|
|
||||||
if ($key == 'handler')
|
if ($key == 'handler')
|
||||||
return $this -> handler;
|
return $this -> handler;
|
||||||
if ($key == 'authenticated')
|
if ($key == 'authenticated')
|
||||||
|
|
|
@ -1,43 +1,36 @@
|
||||||
var myconfirm = function(opts) {
|
var myconfirm = function(opts) {
|
||||||
var confirm = false;
|
var confirm = false;
|
||||||
var dialog = BootstrapDialog.show({
|
var dialog = Bootstrap4Dialog.show({
|
||||||
title: opts.title || _('Confirmation'),
|
title: opts.title || _('Confirmation'),
|
||||||
message: opts.question || _('Do you confirm?'),
|
message: opts.question || _('Do you confirm?'),
|
||||||
autodestroy: true,
|
autodestroy: true,
|
||||||
cssClass: opts.css_class || null,
|
type: opts.type || Bootstrap4Dialog.TYPE_LIGHT,
|
||||||
type: opts.type || BootstrapDialog.TYPE_LIGHT,
|
scrollable: opts.scrollable || false,
|
||||||
draggable: opts.draggable || false,
|
|
||||||
data: {
|
|
||||||
oncancel: opts.oncancel,
|
|
||||||
onconfirm: opts.onconfirm,
|
|
||||||
data: opts.data,
|
|
||||||
confirm: false,
|
|
||||||
},
|
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
label: opts.cancel_label || _('Cancel'),
|
label: opts.cancel_label || _('Cancel'),
|
||||||
action: function(dialog) {
|
action: function(dialog) {
|
||||||
dialog.close();
|
dialog.modal('hide');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: opts.confirm_label || _('Validate'),
|
label: opts.confirm_label || _('Validate'),
|
||||||
cssClass: 'btn-danger',
|
cssClass: 'btn-danger',
|
||||||
action: function(dialog) {
|
action: function(dialog) {
|
||||||
dialog.setData('confirm',true);
|
confirm = true;
|
||||||
dialog.close();
|
dialog.modal('hide');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
onhidden: function(dialog) {
|
close: function() {
|
||||||
if (dialog.getData('confirm')) {
|
if (confirm) {
|
||||||
if (jQuery.type(dialog.getData('onconfirm')) == 'function') {
|
if (jQuery.type(opts.onconfirm) == 'function') {
|
||||||
dialog.getData('onconfirm')(dialog.getData('data'));
|
opts.onconfirm(opts.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (jQuery.type(dialog.getData('oncancel')) == 'function') {
|
if (jQuery.type(opts.oncancel) == 'function') {
|
||||||
dialog.getData('oncancel')(dialog.getData('data'));
|
opts.oncancel(opts.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,30 +40,25 @@ var myconfirm = function(opts) {
|
||||||
|
|
||||||
var myalert = function(msg, title, opts) {
|
var myalert = function(msg, title, opts) {
|
||||||
if (!opts) opts={};
|
if (!opts) opts={};
|
||||||
var dialog = BootstrapDialog.show({
|
var dialog = Bootstrap4Dialog.show({
|
||||||
title: title || opts.title || _('Error'),
|
title: title || opts.title || _('Error'),
|
||||||
message: msg,
|
message: msg,
|
||||||
autodestroy: true,
|
autodestroy: true,
|
||||||
type: opts.type || BootstrapDialog.TYPE_DANGER,
|
type: opts.type || Bootstrap4Dialog.TYPE_DANGER,
|
||||||
size: opts.size || BootstrapDialog.SIZE_MEDIUM,
|
size: opts.size || Bootstrap4Dialog.SIZE_MEDIUM,
|
||||||
draggable: opts.draggable || false,
|
scrollable: opts.scrollable || false,
|
||||||
cssClass: opts.css_class || null,
|
|
||||||
data: {
|
|
||||||
onclose: opts.onclose,
|
|
||||||
data: opts.data,
|
|
||||||
},
|
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
label: opts.btnLabel || _('OK'),
|
label: opts.btnLabel || _('OK'),
|
||||||
cssClass: opts.btnCssClass ||'btn-primary',
|
cssClass: opts.btnCssClass ||'btn-primary',
|
||||||
action: function(dialog) {
|
action: function(dialog) {
|
||||||
dialog.close();
|
dialog.modal('hide');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
onhidden: function(dialog) {
|
close: function() {
|
||||||
if (jQuery.type(dialog.getData('onclose')) == 'function') {
|
if ($.type(opts.onclose) == 'function') {
|
||||||
dialog.getData('onclose')(dialog.getData('data'));
|
opts.onclose(opts.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -86,27 +74,25 @@ var myprompt = function(opts) {
|
||||||
var onSubmitBtnClick = function(dialog) {
|
var onSubmitBtnClick = function(dialog) {
|
||||||
submited = true;
|
submited = true;
|
||||||
var val = dialog.getModalBody().find('input').val();
|
var val = dialog.getModalBody().find('input').val();
|
||||||
if (jQuery.type(dialog.getData('onsubmit')) == 'function') {
|
if (jQuery.type(opts.onsubmit) == 'function') {
|
||||||
if (!dialog.getData('onsubmit')(val, dialog.getData('data'))) {
|
if (!opts.onsubmit(val, opts.data)) {
|
||||||
if (jQuery.type(dialog.getData('onerror')) == 'function') {
|
if (jQuery.type(opts.onerror) == 'function') {
|
||||||
dialog.getData('onerror')(val, dialog.getData('data'));
|
opts.onerror(val, opts.data);
|
||||||
}
|
}
|
||||||
if (!dialog.getData('closeonerror')) {
|
if (!opts.closeonerror) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dialog.close();
|
dialog.modal('hide');
|
||||||
};
|
};
|
||||||
|
|
||||||
var dialog = BootstrapDialog.show({
|
var dialog = Bootstrap4Dialog.show({
|
||||||
title: opts.title || _('Question'),
|
title: opts.title || _('Question'),
|
||||||
message: "<label for='myprompt_input'>"+(opts.label || _("Please enter your answer below:"))+"</label><input type='text' class='form-control' id='myprompt_input'/>",
|
message: "<label for='myprompt_input'>"+(opts.label || _("Please enter your answer below:"))+"</label><input type='text' class='form-control' id='myprompt_input'/>",
|
||||||
autodestroy: true,
|
autodestroy: true,
|
||||||
type: opts.type || BootstrapDialog.TYPE_INFO,
|
type: opts.type || Bootstrap4Dialog.TYPE_INFO,
|
||||||
size: opts.size || BootstrapDialog.SIZE_MEDIUM,
|
size: opts.size || Bootstrap4Dialog.SIZE_MEDIUM,
|
||||||
cssClass: opts.css_class || null,
|
|
||||||
draggable: opts.draggable || false,
|
|
||||||
data: {
|
data: {
|
||||||
oncancel: opts.oncancel,
|
oncancel: opts.oncancel,
|
||||||
onsubmit: opts.onsubmit,
|
onsubmit: opts.onsubmit,
|
||||||
|
@ -121,7 +107,7 @@ var myprompt = function(opts) {
|
||||||
{
|
{
|
||||||
label: opts.cancel_label || _('Cancel'),
|
label: opts.cancel_label || _('Cancel'),
|
||||||
action: function(dialog) {
|
action: function(dialog) {
|
||||||
dialog.close();
|
dialog.modal('hide');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -130,20 +116,20 @@ var myprompt = function(opts) {
|
||||||
action: onSubmitBtnClick
|
action: onSubmitBtnClick
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
onshown: function(dialog) {
|
open: function() {
|
||||||
var input = dialog.getModalBody().find('input');
|
var input = dialog.getModalBody().find('input');
|
||||||
input.on('keyup', function (e) {
|
input.on('keyup', function (e) {
|
||||||
if (e.keyCode == 13) {
|
if (e.keyCode == 13) {
|
||||||
dialog.getData('onSubmitBtnClick')(dialog);
|
opts.onSubmitBtnClick(dialog);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (dialog.getData('default_answer')) {
|
if (opts.default_answer) {
|
||||||
input.val(dialog.getData('default_answer'));
|
input.val(opts.default_answer);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onhidden: function(dialog) {
|
close: function() {
|
||||||
if (!submited && jQuery.type(dialog.getData('oncancel')) == 'function') {
|
if (!submited && jQuery.type(opts.oncancel) == 'function') {
|
||||||
dialog.getData('oncancel')(dialog.getData('data'));
|
opts.oncancel(opts.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -153,19 +139,17 @@ var myloadingalert = function(opts) {
|
||||||
if (!opts) opts={};
|
if (!opts) opts={};
|
||||||
var opened = false;
|
var opened = false;
|
||||||
var closed = false;
|
var closed = false;
|
||||||
var dialog = BootstrapDialog.show({
|
var dialog = Bootstrap4Dialog.show({
|
||||||
title: opts.title || _('Please wait'),
|
title: opts.title || _('Please wait'),
|
||||||
message: opts.message || _('Please wait while your request is being processed.'),
|
message: opts.message || _('Please wait while your request is being processed.'),
|
||||||
autodestroy: true,
|
autodestroy: true,
|
||||||
type: opts.type || BootstrapDialog.TYPE_INFO,
|
type: opts.type || Bootstrap4Dialog.TYPE_INFO,
|
||||||
size: opts.size || BootstrapDialog.SIZE_NORMAL,
|
size: opts.size || Bootstrap4Dialog.SIZE_NORMAL,
|
||||||
cssClass: opts.css_class || null,
|
|
||||||
centered: opts.centered || true,
|
centered: opts.centered || true,
|
||||||
closable: opts.closable || false,
|
closable: opts.closable || false,
|
||||||
draggable: opts.draggable || false,
|
open: function () {
|
||||||
onshown: function (dialog) {
|
|
||||||
if (closed)
|
if (closed)
|
||||||
dialog.close();
|
dialog.modal('hide');
|
||||||
opened = true;
|
opened = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -173,7 +157,7 @@ var myloadingalert = function(opts) {
|
||||||
'modal': dialog,
|
'modal': dialog,
|
||||||
'close': function() {
|
'close': function() {
|
||||||
if (opened)
|
if (opened)
|
||||||
dialog.close();
|
dialog.modal('hide');
|
||||||
closed = true;
|
closed = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
320
static/lib/bootstrap4dialog/bootstrap4dialog.js
vendored
Normal file
320
static/lib/bootstrap4dialog/bootstrap4dialog.js
vendored
Normal file
|
@ -0,0 +1,320 @@
|
||||||
|
/**
|
||||||
|
* Bootstrap Modal for Bootstrap 4.*
|
||||||
|
*
|
||||||
|
* @author GR <admin@admin.ge>, https://github.com/SUXUMI
|
||||||
|
* @source https://github.com/SUXUMI/bootstrab4dialog
|
||||||
|
* @description Bootstrap Modal for Bootstrap 4.*
|
||||||
|
* @license MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function (root, factory) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// https://github.com/umdjs/umd
|
||||||
|
if (typeof module !== "undefined" && module.exports) {
|
||||||
|
module.exports = factory(require("jquery"), require("bootstrap"));
|
||||||
|
}
|
||||||
|
else if (typeof define === "function" && define.amd) {
|
||||||
|
define("bootstrap4dialog", ["jquery", "bootstrap"], function ($) {
|
||||||
|
return factory($);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
root.Bootstrap4Dialog = factory(root.jQuery);
|
||||||
|
}
|
||||||
|
})(this ? this : window, function ($) {
|
||||||
|
/**
|
||||||
|
* Set default global options
|
||||||
|
*
|
||||||
|
* @param {} options
|
||||||
|
*/
|
||||||
|
var Bootstrap4Dialog = function (options) {
|
||||||
|
$.extend(true, this.defaultOptions, options);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constants
|
||||||
|
*/
|
||||||
|
Bootstrap4Dialog.TYPE_PRIMARY = "primary";
|
||||||
|
Bootstrap4Dialog.TYPE_SECONDARY = "secondary";
|
||||||
|
Bootstrap4Dialog.TYPE_SUCCESS = "success";
|
||||||
|
Bootstrap4Dialog.TYPE_DANGER = "danger";
|
||||||
|
Bootstrap4Dialog.TYPE_WARNING = "warning";
|
||||||
|
Bootstrap4Dialog.TYPE_INFO = "info";
|
||||||
|
Bootstrap4Dialog.TYPE_LIGHT = "light";
|
||||||
|
Bootstrap4Dialog.TYPE_DARK = "dark";
|
||||||
|
|
||||||
|
Bootstrap4Dialog.SIZE_SMALL = "modal-sm";
|
||||||
|
Bootstrap4Dialog.SIZE_MEDIUM = "";
|
||||||
|
Bootstrap4Dialog.SIZE_LARGE = "modal-lg";
|
||||||
|
Bootstrap4Dialog.SIZE_EXTRA_LARGE = "modal-xl";
|
||||||
|
|
||||||
|
Bootstrap4Dialog.BACKDROP_YES = "true";
|
||||||
|
Bootstrap4Dialog.BACKDROP_NO = "";
|
||||||
|
Bootstrap4Dialog.BACKDROP_STATIC = "static";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default options
|
||||||
|
*/
|
||||||
|
Bootstrap4Dialog.defaultOptions = {
|
||||||
|
title: '',
|
||||||
|
message: '',
|
||||||
|
type: Bootstrap4Dialog.TYPE_PRIMARY,
|
||||||
|
size: Bootstrap4Dialog.SIZE_MEDIUM,
|
||||||
|
keyboard: true,
|
||||||
|
focus: true,
|
||||||
|
scrollable: false, // modal-dialog-scrollable
|
||||||
|
centered: false, // modal-dialog-centered
|
||||||
|
backdrop: Bootstrap4Dialog.BACKDROP_YES,
|
||||||
|
duration: 0, // SECONDS - how long the dialog should be displayed
|
||||||
|
autodestroy: true,
|
||||||
|
|
||||||
|
open: null,
|
||||||
|
close: null,
|
||||||
|
buttons: [],
|
||||||
|
|
||||||
|
// draggable: false,
|
||||||
|
// animate: true,
|
||||||
|
// tabindex: -1,
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepares the dialog
|
||||||
|
*
|
||||||
|
* @param {type} options
|
||||||
|
* @returns the created dialog instance
|
||||||
|
*/
|
||||||
|
Bootstrap4Dialog.dialog = function(options) {
|
||||||
|
var dialog;
|
||||||
|
|
||||||
|
var _options = $.extend(false, this.defaultOptions, options);
|
||||||
|
|
||||||
|
_options['show'] = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!_options['title'] && !_options['message'] && (!_options['buttons'] || !_options['buttons'].length)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var id = _options['id'] || 'modalWindow_' + uniqid();
|
||||||
|
|
||||||
|
var html =
|
||||||
|
'<div id="' + id + '" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">'
|
||||||
|
+ '<div class="modal-dialog" role="document">'
|
||||||
|
+ '<div class="modal-content">';
|
||||||
|
|
||||||
|
if (_options['title']) {
|
||||||
|
html +=
|
||||||
|
|
||||||
|
'<div class="modal-header rounded">'
|
||||||
|
+ '<h6 class="modal-title"></h6>'
|
||||||
|
+ '<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>'
|
||||||
|
+ '</div>'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_options['message']) {
|
||||||
|
html +=
|
||||||
|
|
||||||
|
'<div class="modal-body">'
|
||||||
|
+ '</div>'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_options['buttons'] && _options['buttons'].length) {
|
||||||
|
html +=
|
||||||
|
'<div class="modal-footer text-center">'
|
||||||
|
//+ '<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>'
|
||||||
|
//+ '<button type="button" class="btn btn-primary">Save changes</button>'
|
||||||
|
+ '</div>'
|
||||||
|
}
|
||||||
|
|
||||||
|
+ '</div>'
|
||||||
|
+ '</div>'
|
||||||
|
+ '</div>'
|
||||||
|
;
|
||||||
|
|
||||||
|
$('body').append( html );
|
||||||
|
|
||||||
|
var _modal_container = $('#' + id);
|
||||||
|
|
||||||
|
// append title
|
||||||
|
if (_options['title'] && _options['title'].length) {
|
||||||
|
_modal_container.find('.modal-title').html( _options['title'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// append message
|
||||||
|
if (_options['message'] && _options['message'].length) {
|
||||||
|
_modal_container.find('.modal-body').html( _options['message'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_options['title'] && !_options['message'] && (!_options['buttons'] || !_options['buttons'].length)) {
|
||||||
|
_modal_container.find('.modal-header').css({'border-bottom':'0px'});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_options['title'] && !_options['message'] && _options['buttons'] && _options['buttons'].length) {
|
||||||
|
_modal_container.find('.modal-footer').css({'border-top':'0px'});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_options['size'] && _options['size'].length) {
|
||||||
|
_modal_container.find('.modal-dialog').addClass(_options.size);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_options['centered']) {
|
||||||
|
_modal_container.find('.modal-dialog').addClass('modal-dialog-centered');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_options['scrollable']) {
|
||||||
|
_modal_container.find('.modal-dialog').addClass('modal-dialog-scrollable');
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(true) {
|
||||||
|
case _options['type'] == 'primary':
|
||||||
|
_modal_container.find('.modal-header').addClass('bg-primary').find('.modal-title').addClass('text-white');
|
||||||
|
_modal_container.find('.modal-body').addClass('text-primary');
|
||||||
|
break;
|
||||||
|
case _options['type'] == 'secondary':
|
||||||
|
_modal_container.find('.modal-header').addClass('bg-secondary').find('.modal-title').addClass('text-white');
|
||||||
|
_modal_container.find('.modal-body').addClass('text-secondary');
|
||||||
|
break;
|
||||||
|
case _options['type'] == 'success':
|
||||||
|
_modal_container.find('.modal-header').addClass('bg-success').find('.modal-title').addClass('text-white');
|
||||||
|
_modal_container.find('.modal-body').addClass('text-success');
|
||||||
|
break;
|
||||||
|
case _options['type'] == 'danger':
|
||||||
|
_modal_container.find('.modal-header').addClass('bg-danger').find('.modal-title').addClass('text-white');
|
||||||
|
_modal_container.find('.modal-body').addClass('text-danger');
|
||||||
|
break;
|
||||||
|
case _options['type'] == 'warning':
|
||||||
|
_modal_container.find('.modal-header').addClass('bg-warning');
|
||||||
|
_modal_container.find('.modal-body').addClass('text-warning');
|
||||||
|
break;
|
||||||
|
case _options['type'] == 'info':
|
||||||
|
_modal_container.find('.modal-header').addClass('bg-info').find('.modal-title').addClass('text-white');
|
||||||
|
_modal_container.find('.modal-body').addClass('text-info');
|
||||||
|
break;
|
||||||
|
case _options['type'] == 'light':
|
||||||
|
_modal_container.find('.modal-header').addClass('bg-light').find('.modal-title').addClass('text-black');
|
||||||
|
_modal_container.find('.modal-body').addClass('text-black');
|
||||||
|
break;
|
||||||
|
case _options['type'] == 'dark':
|
||||||
|
_modal_container.find('.modal-header').addClass('bg-dark').find('.modal-title').addClass('text-white');
|
||||||
|
_modal_container.find('.modal-body').addClass('text-dark');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog = _modal_container.modal(_options);
|
||||||
|
|
||||||
|
// try set buttons
|
||||||
|
try {
|
||||||
|
// fooder
|
||||||
|
var _footer = _modal_container.find('.modal-footer');
|
||||||
|
|
||||||
|
for(i in _options['buttons']) {
|
||||||
|
var _button = _options['buttons'][i];
|
||||||
|
|
||||||
|
// append the button
|
||||||
|
_footer.append('<button class="btn" />');
|
||||||
|
|
||||||
|
var _element_button = _footer.find('button').eq(i);
|
||||||
|
|
||||||
|
if (_button['id']) { _element_button.attr('id', _button['id']); }
|
||||||
|
if (_button['label']) { _element_button.html(_button['label']); }
|
||||||
|
if (_button['cssClass']) { _element_button.addClass(_button['cssClass']); }
|
||||||
|
|
||||||
|
// https://dzone.com/articles/why-does-javascript-loop-only-use-last-value
|
||||||
|
// https://stackoverflow.com/a/17750253/1565790
|
||||||
|
if (typeof(_button['action']) == 'function') {
|
||||||
|
(function(button, f, dialog) {
|
||||||
|
button.bind('click', function() { f(dialog, button); });
|
||||||
|
})(_element_button, _button['action'], dialog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(e) {console.log(e.message);}
|
||||||
|
|
||||||
|
// set handlers
|
||||||
|
if (typeof(_options['open']) == 'function') {
|
||||||
|
dialog.on('shown.bs.modal', _options['open']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof(_options['close']) == 'function') {
|
||||||
|
dialog.on('hidden.bs.modal', _options['close']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_options['autodestroy']) {
|
||||||
|
dialog.on('hidden.bs.modal', function() { destroy(dialog) });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_options['duration']) {
|
||||||
|
dialog.on('shown.bs.modal', function() {
|
||||||
|
setTimeout(function() {
|
||||||
|
dialog.modal('hide');
|
||||||
|
}, parseFloat(_options['duration']) * 1000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return dialog;
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
console.warn(e.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays prepared dialog
|
||||||
|
*
|
||||||
|
* @param {type} options
|
||||||
|
* @returns the created dialog instance
|
||||||
|
*/
|
||||||
|
Bootstrap4Dialog.show = function(options) {
|
||||||
|
try {
|
||||||
|
return this.dialog(options).modal('show');
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
console.warn(e.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes dialog DOM instance
|
||||||
|
*
|
||||||
|
* @param object dialog
|
||||||
|
*/
|
||||||
|
var destroy = function(dialog) {
|
||||||
|
try {
|
||||||
|
setTimeout(function() {
|
||||||
|
dialog.remove();
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
console.warn(e.message);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates uniqid
|
||||||
|
*
|
||||||
|
* @source - https://github.com/makeable/uuid-v4.js/blob/master/uuid-v4.js
|
||||||
|
*/
|
||||||
|
var uniqid = function () {
|
||||||
|
var dec2hex = [];
|
||||||
|
|
||||||
|
for (var i = 0; i <= 15; i++) {
|
||||||
|
dec2hex[i] = i.toString(16);
|
||||||
|
}
|
||||||
|
|
||||||
|
var uuid = "";
|
||||||
|
for (var i = 1; i <= 36; i++) {
|
||||||
|
if (i === 9 || i === 14 || i === 19 || i === 24) {
|
||||||
|
uuid += "-";
|
||||||
|
} else if (i === 15) {
|
||||||
|
uuid += 4;
|
||||||
|
} else if (i === 20) {
|
||||||
|
uuid += dec2hex[(Math.random() * 4) | (0 + 8)];
|
||||||
|
} else {
|
||||||
|
uuid += dec2hex[(Math.random() * 16) | 0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return uuid;
|
||||||
|
};
|
||||||
|
|
||||||
|
return Bootstrap4Dialog;
|
||||||
|
});
|
1
static/lib/bootstrap4dialog/bootstrap4dialog.min.js
vendored
Normal file
1
static/lib/bootstrap4dialog/bootstrap4dialog.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
!function(a,d){"use strict";"undefined"!=typeof module&&module.exports?module.exports=d(require("jquery"),require("bootstrap")):"function"==typeof define&&define.amd?define("bootstrap4dialog",["jquery","bootstrap"],function(a){return d(a)}):a.Bootstrap4Dialog=d(a.jQuery)}(this?this:window,function(a){var d=function(d){a.extend(!0,this.defaultOptions,d)};d.TYPE_PRIMARY="primary",d.TYPE_SECONDARY="secondary",d.TYPE_SUCCESS="success",d.TYPE_DANGER="danger",d.TYPE_WARNING="warning",d.TYPE_INFO="info",d.TYPE_LIGHT="light",d.TYPE_DARK="dark",d.SIZE_SMALL="modal-sm",d.SIZE_MEDIUM="",d.SIZE_LARGE="modal-lg",d.SIZE_EXTRA_LARGE="modal-xl",d.BACKDROP_YES="true",d.BACKDROP_NO="",d.BACKDROP_STATIC="static",d.defaultOptions={title:"",message:"",type:d.TYPE_PRIMARY,size:d.SIZE_MEDIUM,keyboard:!0,focus:!0,scrollable:!1,centered:!1,backdrop:d.BACKDROP_YES,duration:0,autodestroy:!0,open:null,close:null,buttons:[]},d.dialog=function(d){var o,s=a.extend(!1,this.defaultOptions,d);s.show=!1;try{if(!(s.title||s.message||s.buttons&&s.buttons.length))return!1;var l=s.id||"modalWindow_"+t(),n='<div id="'+l+'" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true"><div class="modal-dialog" role="document"><div class="modal-content">';s.title&&(n+='<div class="modal-header rounded"><h6 class="modal-title"></h6><button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button></div>'),s.message&&(n+='<div class="modal-body"></div>'),s.buttons&&s.buttons.length&&(n+='<div class="modal-footer text-center"></div>'),a("body").append(n);var r=a("#"+l);switch(s.title&&s.title.length&&r.find(".modal-title").html(s.title),s.message&&s.message.length&&r.find(".modal-body").html(s.message),!s.title||s.message||s.buttons&&s.buttons.length||r.find(".modal-header").css({"border-bottom":"0px"}),!s.title&&!s.message&&s.buttons&&s.buttons.length&&r.find(".modal-footer").css({"border-top":"0px"}),s.size&&s.size.length&&r.find(".modal-dialog").addClass(s.size),s.centered&&r.find(".modal-dialog").addClass("modal-dialog-centered"),s.scrollable&&r.find(".modal-dialog").addClass("modal-dialog-scrollable"),!0){case"primary"==s.type:r.find(".modal-header").addClass("bg-primary").find(".modal-title").addClass("text-white"),r.find(".modal-body").addClass("text-primary");break;case"secondary"==s.type:r.find(".modal-header").addClass("bg-secondary").find(".modal-title").addClass("text-white"),r.find(".modal-body").addClass("text-secondary");break;case"success"==s.type:r.find(".modal-header").addClass("bg-success").find(".modal-title").addClass("text-white"),r.find(".modal-body").addClass("text-success");break;case"danger"==s.type:r.find(".modal-header").addClass("bg-danger").find(".modal-title").addClass("text-white"),r.find(".modal-body").addClass("text-danger");break;case"warning"==s.type:r.find(".modal-header").addClass("bg-warning"),r.find(".modal-body").addClass("text-warning");break;case"info"==s.type:r.find(".modal-header").addClass("bg-info").find(".modal-title").addClass("text-white"),r.find(".modal-body").addClass("text-info");break;case"light"==s.type:r.find(".modal-header").addClass("bg-light").find(".modal-title").addClass("text-black"),r.find(".modal-body").addClass("text-black");break;case"dark"==s.type:r.find(".modal-header").addClass("bg-dark").find(".modal-title").addClass("text-white"),r.find(".modal-body").addClass("text-dark")}o=r.modal(s);try{var c=r.find(".modal-footer");for(i in s.buttons){var m=s.buttons[i];c.append('<button class="btn" />');var f=c.find("button").eq(i);m.id&&f.attr("id",m.id),m.label&&f.html(m.label),m.cssClass&&f.addClass(m.cssClass),"function"==typeof m.action&&function(a,d,e){a.bind("click",function(){d(e,a)})}(f,m.action,o)}}catch(a){console.log(a.message)}return"function"==typeof s.open&&o.on("shown.bs.modal",s.open),"function"==typeof s.close&&o.on("hidden.bs.modal",s.close),s.autodestroy&&o.on("hidden.bs.modal",function(){e(o)}),s.duration&&o.on("shown.bs.modal",function(){setTimeout(function(){o.modal("hide")},1e3*parseFloat(s.duration))}),o}catch(a){console.warn(a.message)}},d.show=function(a){try{return this.dialog(a).modal("show")}catch(a){console.warn(a.message)}};var e=function(a){try{setTimeout(function(){a.remove()},200)}catch(a){console.warn(a.message)}},t=function(){for(var a=[],d=0;d<=15;d++)a[d]=d.toString(16);var e="";for(d=1;d<=36;d++)e+=9===d||14===d||19===d||24===d?"-":15===d?4:20===d?a[4*Math.random()|8]:a[16*Math.random()|0];return e};return d});
|
|
@ -1,68 +0,0 @@
|
||||||
.bootstrap-dialog {
|
|
||||||
/* dialog types */
|
|
||||||
/**
|
|
||||||
* Icon animation
|
|
||||||
* Copied from font-awesome: http://fontawesome.io/
|
|
||||||
**/
|
|
||||||
/** End of icon animation **/
|
|
||||||
}
|
|
||||||
.bootstrap-dialog .bootstrap-dialog-button-icon {
|
|
||||||
margin-right: .5rem;
|
|
||||||
}
|
|
||||||
.bootstrap-dialog.type-primary .modal-header {
|
|
||||||
background-color: var(--bs-primary);
|
|
||||||
}
|
|
||||||
.bootstrap-dialog.type-secondary .modal-header {
|
|
||||||
background-color: var(--bs-secondary);
|
|
||||||
}
|
|
||||||
.bootstrap-dialog.type-secondary .modal-header {
|
|
||||||
background-color: var(--bs-secondary);
|
|
||||||
}
|
|
||||||
.bootstrap-dialog.type-success .modal-header {
|
|
||||||
background-color: var(--bs-success);
|
|
||||||
}
|
|
||||||
.bootstrap-dialog.type-danger .modal-header {
|
|
||||||
background-color: var(--bs-danger);
|
|
||||||
}
|
|
||||||
.bootstrap-dialog.type-warning .modal-header {
|
|
||||||
background-color: var(--bs-warning);
|
|
||||||
}
|
|
||||||
.bootstrap-dialog.type-info .modal-header {
|
|
||||||
background-color: var(--bs-info);
|
|
||||||
}
|
|
||||||
.bootstrap-dialog.type-light .modal-header {
|
|
||||||
background-color: var(--bs-light);
|
|
||||||
}
|
|
||||||
.bootstrap-dialog.type-dark .modal-header {
|
|
||||||
background-color: var(--bs-dark);
|
|
||||||
}
|
|
||||||
|
|
||||||
.bootstrap-dialog .bootstrap-dialog-title {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
.bootstrap-dialog.type-light .bootstrap-dialog-title {
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
.bootstrap-dialog.type-dark .bootstrap-dialog-close-button {
|
|
||||||
background-color: var(--bs-light);
|
|
||||||
}
|
|
||||||
|
|
||||||
.bootstrap-dialog.size-large .bootstrap-dialog-title {
|
|
||||||
font-size: 24px;
|
|
||||||
}
|
|
||||||
.bootstrap-dialog.size-large .bootstrap-dialog-close-button {
|
|
||||||
font-size: 30px;
|
|
||||||
}
|
|
||||||
.bootstrap-dialog.size-large .bootstrap-dialog-message {
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bootstrap-dialog.size-extra-large .bootstrap-dialog-title {
|
|
||||||
font-size: 28px;
|
|
||||||
}
|
|
||||||
.bootstrap-dialog.size-extra-large .bootstrap-dialog-close-button {
|
|
||||||
font-size: 34px;
|
|
||||||
}
|
|
||||||
.bootstrap-dialog.size-extra-large .bootstrap-dialog-message {
|
|
||||||
font-size: 22px;
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
.bootstrap-dialog .bootstrap-dialog-button-icon{margin-right:.5rem}.bootstrap-dialog.type-primary .modal-header{background-color:var(--bs-primary)}.bootstrap-dialog.type-secondary .modal-header{background-color:var(--bs-secondary)}.bootstrap-dialog.type-success .modal-header{background-color:var(--bs-success)}.bootstrap-dialog.type-danger .modal-header{background-color:var(--bs-danger)}.bootstrap-dialog.type-warning .modal-header{background-color:var(--bs-warning)}.bootstrap-dialog.type-info .modal-header{background-color:var(--bs-info)}.bootstrap-dialog.type-light .modal-header{background-color:var(--bs-light)}.bootstrap-dialog.type-dark .modal-header{background-color:var(--bs-dark)}.bootstrap-dialog .bootstrap-dialog-title{color:#fff}.bootstrap-dialog.type-light .bootstrap-dialog-title{color:#333}.bootstrap-dialog.type-dark .bootstrap-dialog-close-button{background-color:var(--bs-light)}.bootstrap-dialog.size-large .bootstrap-dialog-title{font-size:24px}.bootstrap-dialog.size-large .bootstrap-dialog-close-button{font-size:30px}.bootstrap-dialog.size-large .bootstrap-dialog-message{font-size:18px}.bootstrap-dialog.size-extra-large .bootstrap-dialog-title{font-size:28px}.bootstrap-dialog.size-extra-large .bootstrap-dialog-close-button{font-size:34px}.bootstrap-dialog.size-extra-large .bootstrap-dialog-message{font-size:22px}
|
|
1265
static/lib/bootstrap5-dialog/js/bootstrap-dialog.js
vendored
1265
static/lib/bootstrap5-dialog/js/bootstrap-dialog.js
vendored
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue