chg: [UI] Simplify code for adding galaxies

pull/8248/head
Jakub Onderka 2022-03-29 17:20:51 +02:00
parent 9b9e332019
commit d85fbbaf95
7 changed files with 9 additions and 47 deletions

View File

@ -320,9 +320,6 @@ echo $this->element('/genericElements/SideMenu/side_menu', ['menuList' => 'event
$('.screenshot').click(function() {
screenshotPopup($(this).attr('src'), $(this).attr('title'));
});
$('.addGalaxy').click(function() {
addGalaxyListener(this);
});
$('.sightings_advanced_add').click(function() {
var selected = [];
var object_context = $(this).data('object-context');

View File

@ -227,9 +227,6 @@ attributes or the appropriate distribution level. If you think there is a mistak
var deleted = <?php echo (!empty($deleted)) ? '1' : '0';?>;
var includeRelatedTags = <?php echo (!empty($includeRelatedTags)) ? '1' : '0';?>;
$(function() {
$('.addGalaxy').click(function() {
addGalaxyListener(this);
});
<?php
if (isset($focus)):
?>

View File

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

View File

@ -14,9 +14,4 @@ echo $this->element('galaxyQuickViewNew', [
?>
<script type="text/javascript">
var showContext = false;
$(function () {
$('.addGalaxy').click(function() {
addGalaxyListener(this);
});
});
</script>

View File

@ -1,11 +1,3 @@
<?php
echo $this->element('TagCollections/index_row');
?>
<script type="text/javascript">
$(document).ready(function() {
$('.addGalaxy').click(function() {
addGalaxyListener(this);
});
});
</script>

View File

@ -19,11 +19,4 @@
));
echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'tag-collections', 'menuItem' => 'index'));
?>
<script type="text/javascript">
$(document).ready(function() {
$('.addGalaxy').click(function() {
addGalaxyListener(this);
});
});
</script>

View File

@ -4221,18 +4221,6 @@ $('#eventToggleButtons button').click(function() {
}
});
function addGalaxyListener(id) {
var target_type = $(id).data('target-type');
var target_id = $(id).data('target-id');
var local = $(id).data('local');
if (local) {
local = 1;
} else {
local = 0;
}
popoverPopup(id, target_id + '/' + target_type + '/local:' + local, 'galaxies', 'selectGalaxyNamespace');
}
function quickSubmitGalaxyForm(cluster_ids, additionalData) {
cluster_ids = cluster_ids === null ? [] : cluster_ids;
var target_id = additionalData['target_id'];