fix: [UI] Correctly handle links to related events

pull/7859/head
Jakub Onderka 2021-10-18 17:34:36 +02:00
parent 4f31876890
commit fd150d5fe0
3 changed files with 7 additions and 2 deletions

View File

@ -1,6 +1,7 @@
<?php
$i = 0;
$linkColour = ($scope == 'Attribute') ? 'red' : 'white';
$withPivot = isset($withPivot) ? $withPivot : false;
// remove duplicates
$relatedEvents = array();
foreach ($event['Related' . $scope][$object['id']] as $k => $relatedAttribute) {
@ -32,8 +33,10 @@ foreach ($event['Related' . $scope][$object['id']] as $relatedAttribute) {
}
$link = $this->Html->link(
$relatedAttribute['id'],
array('controller' => 'events', 'action' => 'view', $relatedAttribute['id'], true, $event['Event']['id']),
array('class' => ($relatedAttribute['org_id'] == $me['org_id']) ? $linkColour : 'blue')
$withPivot ?
['controller' => 'events', 'action' => 'view', $relatedAttribute['id'], true, $event['Event']['id']] :
['controller' => 'events', 'action' => 'view', $relatedAttribute['id']],
['class' => ($relatedAttribute['org_id'] == $me['org_id']) ? $linkColour : 'blue']
);
echo sprintf(
'<li class="no-side-padding %s" %s data-toggle="popover" data-content="%s" data-trigger="hover">%s&nbsp;</li>',

View File

@ -210,6 +210,7 @@ $quickEdit = function($fieldName) use ($editScope, $object, $event) {
'scope' => 'Attribute',
'object' => $object,
'event' => $event,
'withPivot' => true,
));
echo '</ul>';
}

View File

@ -110,6 +110,7 @@
'scope' => 'ShadowAttribute',
'object' => $object,
'event' => $event,
'withPivot' => true,
));
}
?>