chg: [UI] WIP - generic_picker replaced galaxy deletion alert by confirm

popover
pull/4024/head
mokaddem 2019-01-14 14:30:38 +01:00
parent 512a8f83d1
commit 492fdacdf1
3 changed files with 23 additions and 11 deletions

View File

@ -20,11 +20,9 @@
<a href="<?php echo $baseurl; ?>/events/index/searchtag:<?php echo h($cluster['tag_id']); ?>" class="icon-th-list" title="<?php echo __('View all events containing this cluster.');?>"></a>
<?php
if ($isSiteAdmin || ($mayModify && $isAclTagger)) {
echo $this->Form->postLink('',
$baseurl . '/galaxy_clusters/detach/' . ucfirst(h($target_id)) . '/' . h($target_type) . '/' . $cluster['tag_id'],
array('class' => 'icon-trash', 'title' => __('Delete'), 'div' => false),
__('Are you sure you want to detach %s from this event?', h($cluster['value']))
);
echo $this->Form->create(false, array('url' => $baseurl . '/galaxy_clusters/detach/' . ucfirst(h($target_id)) . '/' . h($target_type) . '/' . $cluster['tag_id'], 'style' => 'display: inline-block; margin: 0px;'));
echo '<it href="#" class="icon-trash useCursorPointer" title="' . __('Are you sure you want to detach %s from this event?', h($cluster['value'])) . '" onclick="popoverConfirm(this)"></it>';
echo $this->Form->end();
}
?>
<div style="margin-left:15px;display:none;" class="blue galaxy_data">

View File

@ -70,11 +70,9 @@
<a href="<?php echo $baseurl; ?>/events/index/searchtag:<?php echo h($cluster['tag_id']); ?>" class="icon-th-list" title="<?php echo __('View all events containing this cluster.');?>"></a>
<?php
if ($isSiteAdmin || ($mayModify && $isAclTagger)) {
echo $this->Form->postLink('',
$baseurl . '/galaxy_clusters/detach/' . ucfirst(h($target_id)) . '/' . h($target_type) . '/' . $cluster['tag_id'],
array('class' => 'icon-trash', 'title' => 'Delete'),
__('Are you sure you want to detach %s from this %s?', h($cluster['value']), h($target_type))
);
echo $this->Form->create(false, array('url' => $baseurl . '/galaxy_clusters/detach/' . ucfirst(h($target_id)) . '/' . h($target_type) . '/' . $cluster['tag_id'], 'style' => 'display: inline-block; margin: 0px;'));
echo '<a href="#" class="icon-trash" title="' . __('Are you sure you want to detach %s from this %s?', h($cluster['value']), h($target_type)) . '" onclick="popoverConfirm(this)"></a>';
echo $this->Form->end();
}
?>
</div>

View File

@ -1397,7 +1397,7 @@ function openPopup(id) {
function openPopover(clicked, data) {
// popup handling //
var loadingHtml = '<div style="height: 75px; width: 75px;"><div class="spinner"></div><div class="loadingText">Loading</div></div>';
var closeButtonHtml = '<button type="button" class="close" onclick="$(this).closest(\'div.popover\').prev().popover(\'destroy\');">×</button>';
var closeButtonHtml = '<button type="button" class="close" style="margin-left: 5px;" onclick="$(this).closest(\'div.popover\').prev().popover(\'destroy\');">×</button>';
$clicked = $(clicked);
var title = $clicked.attr('title');
var origTitle = $clicked.attr('data-original-title');
@ -1497,6 +1497,22 @@ function popoverPopup(clicked, id, context, target, admin) {
});
}
// create a confirm popover on the clicked html node.
function popoverConfirm(clicked) {
var $clicked = $(clicked);
var popoverContent = '<div>';
popoverContent += '<span class="btn btn-primary" onclick=submitClosestForm(this)>Yes</span>';
popoverContent += '<span class="btn btn-inverse" style="float: right;" onclick=cancelPrompt()>Cancel</span>';
popoverContent += '</div>';
openPopover($clicked, popoverContent);
}
function submitClosestForm(clicked) {
$clicked = $(clicked);
$form = $clicked.closest('form');
$form.submit();
}
function simplePopup(url) {
$("#gray_out").fadeIn();
$.ajax({