fix: [UI] Popovers

pull/8248/head
Jakub Onderka 2022-03-29 18:50:22 +02:00
parent 9b92b502cc
commit c155dabc7b
6 changed files with 29 additions and 26 deletions

View File

@ -161,5 +161,5 @@
'child' => $attrKey == $lastElement ? 'last' : true
));
}
echo '<tr class="objectAddFieldTr"><td><span class="fa fa-plus-circle objectAddField" title="' . __('Add an Object Attribute') .'" data-popover-popup="/objects/quickFetchTemplateWithValidObjectAttributes/' . h($object['id']) .'"></span></td></tr>';
echo '<tr class="objectAddFieldTr"><td><span class="fa fa-plus-circle objectAddField" title="' . __('Add an Object Attribute') .'" data-popover-popup="' . $baseurl . '/objects/quickFetchTemplateWithValidObjectAttributes/' . h($object['id']) .'"></span></td></tr>';
}

View File

@ -107,24 +107,22 @@
$buttonData = array();
if ($full) {
$buttonData[] = sprintf(
'<button title="%s" role="button" tabindex="0" aria-label="%s" class="%s" style="%s" data-popover-popup="%s">%s</button>',
'<button title="%s" role="button" tabindex="0" aria-label="%s" class="%s" data-popover-popup="%s">%s</button>',
__('Add a tag'),
__('Add a tag'),
'addTagButton btn btn-inverse noPrint',
'line-height:10px; padding: 2px;',
'/tags/selectTaxonomy/' . $id . ($scope === 'event') ? '' : ('/' . $scope),
'<i class="fas fa-globe-americas"></i> +'
'addTagButton addButton btn btn-inverse noPrint',
$baseurl . '/tags/selectTaxonomy/' . $id . ($scope === 'event' ? '' : ('/' . $scope)),
'<i class="fas fa-globe-americas"></i> <i class="fas fa-plus"></i>'
);
}
if ($full || $fullLocal) {
$buttonData[] = sprintf(
'<button title="%s" role="button" tabindex="0" aria-label="%s" class="%s" style="%s" data-popover-popup="%s">%s</button>',
'<button title="%s" role="button" tabindex="0" aria-label="%s" class="%s" data-popover-popup="%s">%s</button>',
__('Add a local tag'),
__('Add a local tag'),
'addLocalTagButton btn btn-inverse noPrint',
'line-height:10px; padding: 2px;',
'/tags/selectTaxonomy/local:1/' . $id . ($scope === 'event') ? '' : ('/' . $scope),
'<i class="fas fa-user"></i> +'
'addLocalTagButton addButton btn btn-inverse noPrint',
$baseurl . '/tags/selectTaxonomy/local:1/' . $id . ($scope === 'event' ? '' : ('/' . $scope)),
'<i class="fas fa-user"></i> <i class="fas fa-plus"></i>'
);
}
if (!empty($buttonData)) {

View File

@ -72,7 +72,7 @@
'class' => 'mass-select hidden',
'fa-icon' => 'tag',
'data' => [
'popover-popup' => '/tags/selectTaxonomy/selected/attribute',
'popover-popup' => $baseurl . '/tags/selectTaxonomy/selected/attribute',
],
),
array(
@ -82,7 +82,7 @@
'fa-icon' => 'rebel',
'fa-source' => 'fab',
'data' => [
'popover-popup' => '/galaxies/selectGalaxyNamespace/selected/attribute/eventid:' . $eventId,
'popover-popup' => $baseurl . '/galaxies/selectGalaxyNamespace/selected/attribute/eventid:' . $eventId,
],
),
array(

View File

@ -123,20 +123,20 @@ echo $this->Form->end();
<?php endif; ?>
<?php
if ($editButtonsEnabled) {
$link = "/galaxies/selectGalaxyNamespace/" . h($target_id) . "/" . h($target_type) . "/local:0";
$link = "$baseurl/galaxies/selectGalaxyNamespace/" . h($target_id) . "/" . h($target_type) . "/local:0";
echo sprintf(
'<button class="%s" data-popover-popup="%s" role="button" tabindex="0" aria-label="' . __('Add new cluster') . '" title="' . __('Add new cluster') . '">%s</button>',
'useCursorPointer btn btn-inverse',
'useCursorPointer addButton btn btn-inverse',
$link,
'<i class="fas fa-globe-americas"></i> <i class="fas fa-plus"></i>'
);
}
if ($editButtonsLocalEnabled) {
$link = "/galaxies/selectGalaxyNamespace/" . h($target_id) . "/" . h($target_type) . "/local:1";
$link = "$baseurl/galaxies/selectGalaxyNamespace/" . h($target_id) . "/" . h($target_type) . "/local:1";
echo sprintf(
'<button class="%s" data-popover-popup="%s" role="button" tabindex="0" aria-label="' . __('Add new local cluster') . '" title="' . __('Add new local cluster') . '">%s</button>',
'useCursorPointer btn btn-inverse',
'useCursorPointer addButton btn btn-inverse',
$link,
'<i class="fas fa-user"></i> <i class="fas fa-plus"></i>'
);

View File

@ -2056,14 +2056,14 @@ a.discrete {
font-size: 12px;
}
button.addGalaxy {
button.addButton {
line-height: 10px;
padding: 2px;
margin-right: 5px;
margin-top: 1px;
}
button.addGalaxy .fa-plus {
button.addButton .fa-plus {
font-size: 11px;
line-height: 13px;
}

View File

@ -1802,6 +1802,7 @@ function getPopup(id, context, target, admin, popupType) {
}
// Same as getPopup function but create a popover to populate first
// DEPRECATED
function popoverPopup(clicked, id, context, target, admin) {
var url = baseurl;
if (typeof admin !== 'undefined' && admin != '') url+= "/admin";
@ -1810,20 +1811,24 @@ function popoverPopup(clicked, id, context, target, admin) {
}
if (target != '') url += "/" + target;
if (id != '') url += "/" + id;
var popover = openPopover(clicked, undefined);
$clicked = $(clicked);
popoverPopupNew(clicked, url);
}
function popoverPopupNew(clicked, url) {
var $clicked = $(clicked);
var popover = openPopover($clicked, undefined);
// actual request //
$.ajax({
dataType:"html",
dataType: "html",
cache: false,
success:function (data) {
success: function (data) {
if (popover.options.content !== data) {
popover.options.content = data;
popover.options.content = data;
$clicked.popover('show');
}
},
error:function(jqXHR ) {
error: function(jqXHR) {
var errorJSON = '';
try {
errorJSON = JSON.parse(jqXHR.responseText);
@ -4770,7 +4775,7 @@ $(document.body).on('click', 'a.modal-open', function (e) {
$(document.body).on('click', '[data-popover-popup]', function (e) {
e.preventDefault();
var url = $(this).data('popover-popup');
popoverPopup(this, url);
popoverPopupNew(this, url);
});
function queryEventLock(event_id, timestamp) {