gui fixes

This commit is contained in:
SJ
2013-08-14 23:40:52 +02:00
parent b3cea9de7f
commit 29482ffb1d
47 changed files with 1065 additions and 497 deletions

View File

@ -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;
}
}