fix: [sighting] prevent ID collision in the UI.

Sighting canvas is now correctly positioned regardless of the id.
pull/4048/head
mokaddem 2019-01-24 11:36:09 +01:00
parent 0a9825c6aa
commit cc5143cd7a
4 changed files with 5 additions and 5 deletions

View File

@ -29,7 +29,7 @@
<td class="short">
<?php
if (!empty($sightingsData['csv'][$object['id']])) {
echo $this->element('sparkline', array('id' => $object['id'], 'csv' => $sightingsData['csv'][$object['id']]));
echo $this->element('sparkline', array('scope' => 'object', 'id' => $object['id'], 'csv' => $sightingsData['csv'][$object['id']]));
}
?>
</td>

View File

@ -5,7 +5,7 @@ Modified version of http://www.tnoda.com/blog/2013-12-19
echo $this->Html->script('d3');
//echo $this->Html->css('sightingstyle');
?>
<div id="spark_<?php echo h($id); ?>"></div>
<div id="spark_<?php echo (isset($scope) ? h($scope) . '_' : ''); ?><?php echo h($id); ?>"></div>
<script>
var width = 100;
var height = 25;
@ -43,6 +43,6 @@ Modified version of http://www.tnoda.com/blog/2013-12-19
var myData = "<?php echo isset($csv) ? $csv : ''; ?>";
if (myData != '') {
var data = d3.csv.parse(myData);
sparkline('#spark_<?php echo h($id); ?>', data);
sparkline('#spark_<?php echo (isset($scope) ? h($scope) . '_' : ''); ?><?php echo h($id); ?>', data);
}
</script>

View File

@ -215,7 +215,7 @@
<dd>
<?php
if (!empty($sightingsData['csv']['event'])) {
echo $this->element('sparkline', array('id' => $event['Event']['id'], 'csv' => $sightingsData['csv']['event']));
echo $this->element('sparkline', array('scope' => 'event', 'id' => $event['Event']['id'], 'csv' => $sightingsData['csv']['event']));
} else {
echo '&nbsp';
}

View File

@ -62,7 +62,7 @@
&nbsp;
</td>
<td class="shortish">
<?php echo $this->element('sparkline', array('id' => $item['GalaxyCluster']['id'], 'csv' => $csv[$k])); ?>
<?php echo $this->element('sparkline', array('scope' => 'cluster', 'id' => $item['GalaxyCluster']['id'], 'csv' => $csv[$k])); ?>
</td>
<td class="short">
<?php