mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-12 23:17:02 +02:00
gui fixes
This commit is contained in:
@ -1099,5 +1099,52 @@ $.datepicker.setDefaults($.datepicker.regional[Piler.piler_ui_lang]);
|
||||
|
||||
});
|
||||
|
||||
// modal additions
|
||||
|
||||
$(document).on("click", ".confirm-delete", function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
|
||||
var id = $(this).data('id'),
|
||||
name = $(this).data('name'),
|
||||
url = $(".modal-footer #id").attr("href");
|
||||
|
||||
//set id
|
||||
url = UpdateQueryString('id',id,url);
|
||||
//set name
|
||||
url = UpdateQueryString('name',encodeURIComponent(name),url);
|
||||
//set confirmation
|
||||
url = UpdateQueryString('confirmed',1,url);
|
||||
//set href
|
||||
$(".modal-footer #id").attr("href",url);
|
||||
//set display text
|
||||
$(".modal-body #name").html( name );
|
||||
//finally, display the confirm modal box
|
||||
$('#deleteconfirm-modal').modal('show');
|
||||
});
|
||||
|
||||
function UpdateQueryString(key, value, url) { // from http://stackoverflow.com/questions/5999118/add-or-update-query-string-parameter/11654596#11654596
|
||||
if (!url) url = window.location.href;
|
||||
var re = new RegExp("([?|&])" + key + "=.*?(&|#|$)(.*)", "gi");
|
||||
|
||||
if (re.test(url)) {
|
||||
if (typeof value !== 'undefined' && value !== null)
|
||||
return url.replace(re, '$1' + key + "=" + value + '$2$3');
|
||||
else {
|
||||
return url.replace(re, '$1$3').replace(/(&|\?)$/, '');
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (typeof value !== 'undefined' && value !== null) {
|
||||
var separator = url.indexOf('?') !== -1 ? '&' : '?',
|
||||
hash = url.split('#');
|
||||
url = hash[0] + separator + key + '=' + value;
|
||||
if (hash[1]) url += '#' + hash[1];
|
||||
return url;
|
||||
}
|
||||
else
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user