From a2676573a622cfd86f8e1e943d3294dff6d12b16 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Sat, 14 Oct 2023 10:44:23 +0200 Subject: [PATCH] add SeedDMSBox.redirect() --- views/bootstrap/styles/application.js | 17 +++++++++++++++++ views/bootstrap4/styles/application.js | 23 +++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/views/bootstrap/styles/application.js b/views/bootstrap/styles/application.js index cb5f37601..b4b1e87a2 100644 --- a/views/bootstrap/styles/application.js +++ b/views/bootstrap/styles/application.js @@ -1542,3 +1542,20 @@ $(document).ready(function() { /* {{{ */ } } }( window.SeedDMSAjax = window.SeedDMSAjax || {}, jQuery )); /* }}} */ + +(function( SeedDMSBox, $, undefined ) { /* {{{ */ + SeedDMSBox.redirect = function(url, boxparams) { + bootbox.dialog(boxparams.message, [{ + "label" : boxparams.confirmLabel, + "class" : "btn-danger", + "callback": function() { + window.location.href = url; + } + }, { + "label" : boxparams.cancelLabel, + "class" : "btn-cancel", + "callback": function() { + } + }]); + } +}( window.SeedDMSBox = window.SeedDMSBox || {}, jQuery )); /* }}} */ diff --git a/views/bootstrap4/styles/application.js b/views/bootstrap4/styles/application.js index 556dbeaf4..8b6fe233f 100644 --- a/views/bootstrap4/styles/application.js +++ b/views/bootstrap4/styles/application.js @@ -1598,3 +1598,26 @@ $(document).ready(function() { /* {{{ */ } } }( window.SeedDMSAjax = window.SeedDMSAjax || {}, jQuery )); /* }}} */ + +(function( SeedDMSBox, $, undefined ) { /* {{{ */ + SeedDMSBox.redirect = function(url, boxparams) { + bootbox.confirm({ + "message": boxparams.message, + "buttons": { + "confirm": { + "label" : boxparams.confirmLabel, + "className" : "btn-danger", + }, + "cancel": { + "label" : boxparams.cancelLabel, + "className" : "btn-secondary", + } + }, + "callback": function(result) { + if(result) { + window.location.href = url; + } + } + }); + } +}( window.SeedDMSBox = window.SeedDMSBox || {}, jQuery )); /* }}} */