Release 0.247: improve delete confirmation dialog
This commit is contained in:
@@ -149,11 +149,22 @@ $perPage = (int)($list->pagination['per_page'] ?? 15);
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<?php foreach (($row['_actions'] ?? []) as $action): ?>
|
<?php foreach (($row['_actions'] ?? []) as $action): ?>
|
||||||
|
<?php
|
||||||
|
$confirmMessage = (string)($action['confirm'] ?? '');
|
||||||
|
$needsConfirm = $confirmMessage !== '';
|
||||||
|
$actionClass = (string)($action['class'] ?? 'btn btn-default btn-xs');
|
||||||
|
if ($needsConfirm) {
|
||||||
|
$actionClass .= ' js-table-action-confirm';
|
||||||
|
}
|
||||||
|
?>
|
||||||
<a
|
<a
|
||||||
href="<?= htmlspecialchars((string)($action['url'] ?? '#'), ENT_QUOTES, 'UTF-8'); ?>"
|
href="<?= htmlspecialchars((string)($action['url'] ?? '#'), ENT_QUOTES, 'UTF-8'); ?>"
|
||||||
class="<?= htmlspecialchars((string)($action['class'] ?? 'btn btn-default btn-xs'), ENT_QUOTES, 'UTF-8'); ?>"
|
class="<?= htmlspecialchars($actionClass, ENT_QUOTES, 'UTF-8'); ?>"
|
||||||
<?php if (!empty($action['confirm'])): ?>
|
<?php if ($needsConfirm): ?>
|
||||||
onclick="return confirm('<?= htmlspecialchars((string)$action['confirm'], ENT_QUOTES, 'UTF-8'); ?>');"
|
data-confirm-title="Potwierdzenie"
|
||||||
|
data-confirm-message="<?= htmlspecialchars($confirmMessage, ENT_QUOTES, 'UTF-8'); ?>"
|
||||||
|
data-confirm-ok="<?= htmlspecialchars((string)($action['confirm_ok'] ?? 'Usun'), ENT_QUOTES, 'UTF-8'); ?>"
|
||||||
|
data-confirm-cancel="<?= htmlspecialchars((string)($action['confirm_cancel'] ?? 'Anuluj'), ENT_QUOTES, 'UTF-8'); ?>"
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
>
|
>
|
||||||
<?= htmlspecialchars((string)($action['label'] ?? ''), ENT_QUOTES, 'UTF-8'); ?>
|
<?= htmlspecialchars((string)($action['label'] ?? ''), ENT_QUOTES, 'UTF-8'); ?>
|
||||||
@@ -217,3 +228,96 @@ $perPage = (int)($list->pagination['per_page'] ?? 15);
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
.jconfirm.table-list-confirm-dialog .jconfirm-row {
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jconfirm.table-list-confirm-dialog .jconfirm-box-container {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 560px;
|
||||||
|
padding-left: 12px;
|
||||||
|
padding-right: 12px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jconfirm.table-list-confirm-dialog .jconfirm-box {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
(function($) {
|
||||||
|
if (!$) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).off('click.tableListConfirm', '.js-table-action-confirm');
|
||||||
|
$(document).on('click.tableListConfirm', '.js-table-action-confirm', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
var $link = $(this);
|
||||||
|
var href = $link.attr('href');
|
||||||
|
var title = $link.data('confirmTitle') || 'Potwierdzenie';
|
||||||
|
var message = $link.data('confirmMessage') || 'Czy na pewno chcesz kontynuowac?';
|
||||||
|
var okLabel = $link.data('confirmOk') || 'Usun';
|
||||||
|
var cancelLabel = $link.data('confirmCancel') || 'Anuluj';
|
||||||
|
|
||||||
|
if (!href) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof $.confirm === 'function') {
|
||||||
|
$.confirm({
|
||||||
|
title: String(title),
|
||||||
|
content: String(message),
|
||||||
|
type: 'red',
|
||||||
|
boxWidth: '560px',
|
||||||
|
useBootstrap: false,
|
||||||
|
animation: 'scale',
|
||||||
|
closeAnimation: 'scale',
|
||||||
|
backgroundDismissAnimation: 'shake',
|
||||||
|
container: 'body',
|
||||||
|
theme: 'modern',
|
||||||
|
columnClass: '',
|
||||||
|
typeAnimated: true,
|
||||||
|
lazyOpen: false,
|
||||||
|
draggable: false,
|
||||||
|
closeIcon: true,
|
||||||
|
containerFluid: true,
|
||||||
|
escapeKey: true,
|
||||||
|
backgroundDismiss: true,
|
||||||
|
animationBounce: 1.1,
|
||||||
|
watchInterval: 100,
|
||||||
|
offsetTop: 0,
|
||||||
|
offsetBottom: 0,
|
||||||
|
customClass: 'table-list-confirm-dialog',
|
||||||
|
buttons: {
|
||||||
|
cancel: {
|
||||||
|
text: String(cancelLabel),
|
||||||
|
btnClass: 'btn-default'
|
||||||
|
},
|
||||||
|
confirm: {
|
||||||
|
text: String(okLabel),
|
||||||
|
btnClass: 'btn-danger',
|
||||||
|
action: function() {
|
||||||
|
window.location.href = href;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window.confirm(String(message))) {
|
||||||
|
window.location.href = href;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
})(window.jQuery);
|
||||||
|
</script>
|
||||||
|
|||||||
BIN
updates/0.20/ver_0.247.zip
Normal file
BIN
updates/0.20/ver_0.247.zip
Normal file
Binary file not shown.
@@ -1,5 +1,7 @@
|
|||||||
<b>ver. 0.245</b><br />
|
<b>ver. 0.247</b><br />
|
||||||
<b>ver. 0.246</b><br />
|
- UPDATE - nowy dialog potwierdzenia usuwania w `components/table-list` (zamiast natywnego `confirm`)
|
||||||
|
- UPDATE - popup usuwania: wiekszy rozmiar i centrowanie na srodku ekranu
|
||||||
|
<hr><b>ver. 0.246</b><br />
|
||||||
- UPDATE - migracja listy banerow do nowego mechanizmu tabeli (`components/table-list`, filtrowanie, sortowanie, paginacja)
|
- UPDATE - migracja listy banerow do nowego mechanizmu tabeli (`components/table-list`, filtrowanie, sortowanie, paginacja)
|
||||||
- UPDATE - `admin\Controllers\BannerController::list()` buduje `PaginatedTableViewModel`
|
- UPDATE - `admin\Controllers\BannerController::list()` buduje `PaginatedTableViewModel`
|
||||||
- UPDATE - `Domain\Banner\BannerRepository::listForAdmin()` (bezpieczne filtrowanie i sortowanie)
|
- UPDATE - `Domain\Banner\BannerRepository::listForAdmin()` (bezpieczne filtrowanie i sortowanie)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?
|
<?
|
||||||
$current_ver = 246;
|
$current_ver = 247;
|
||||||
|
|
||||||
for ($i = 1; $i <= $current_ver; $i++)
|
for ($i = 1; $i <= $current_ver; $i++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user