chg: [events] Index table delete buttons switch to fetch then post

pull/6308/head
mokaddem 2020-09-10 09:12:53 +02:00
parent c7984cebdc
commit d06cd0d3e9
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 12 additions and 1 deletions

View File

@ -231,7 +231,7 @@
<a href='<?php echo $baseurl."/events/edit/".$event['Event']['id'];?>' title = "<?php echo __('Edit');?>" aria-label = "<?php echo __('Edit');?>"><i class="black fa fa-edit"></i></a>
<?php
echo $this->Form->postLink('', array('action' => 'delete', $event['Event']['id']), array('class' => 'fa fa-trash', 'title' => __('Delete'), 'aria-label' => __('Delete')), __('Are you sure you want to delete # %s?', $event['Event']['id']));
echo sprintf('<a class="useCursorPointer fa fa-trash" title="%s" aria-label="%s" onclick="deleteEvent(%s)"></a>', __('Delete'), __('Delete'), h($event['Event']['id']));
endif;
?>
<a href='<?php echo $baseurl."/events/view/".$event['Event']['id'];?>' title = "<?php echo __('View');?>" aria-label = "<?php echo __('View');?>"><i class="fa black fa-eye"></i></a>
@ -261,4 +261,15 @@
});
});
});
function deleteEvent(id) {
var message = "<?= __('Are you sure you want to delete # ') ?>" + id + "?"
var url = '<?= $baseurl ?>/events/delete/' + id
if (confirm(message)) {
fetchFormDataAjax(url, function(formData) {
$('body').append($('<div id="temp"/>').html(formData));
$('#temp form').submit()
})
}
}
</script>