Skip to content

Fix CO Title and logo home link (CFM-380) #174

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions app/templates/layout/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
$bodyClasses = $controller_stripped . ' ' .$action_stripped;
$isCoSelectView = $controller_stripped == 'cos' && $action_stripped == 'select';
$isDashboard = $controller_stripped == 'dashboards' && $action_stripped == 'dashboard';
$generateHomeLink = (!$isCoSelectView && !empty($vv_cur_co));

// add further body classes as needed
if(!empty($vv_user)) {
Expand Down Expand Up @@ -115,35 +116,39 @@

<header id="banner">
<div id="logo-title-wrapper">
<?php if($generateHomeLink): ?>
<?php
// wrap the logo and the title in the home link
$cmHomeLink = $this->Url->build([
'plugin' => null,
'controller' => 'Dashboards',
'action' => 'dashboard',
'?' => ['co_id' => $vv_cur_co->id]],
['escape' => false]
);
?>
<a href="<?= $cmHomeLink ?>">
<?php endif; ?>
<div id="logo">
<?=
$this->Html->link(
$this->Html->image(
"COmanage-Gears.svg",
array(
'alt' => __('registry.meta.logo')
)
),'/',
array('escape' => false)
);
);
?>
</div>
<div id="siteTitle">
<!-- XXX Sanitize $vv_cur_co['name'] -->
<?php if($isCoSelectView): // just print the name ?>
<?= __('registry.meta.registry') ?>
<?php elseif(!empty($vv_cur_co)): ?>
<?= $this->Html->link(
$vv_cur_co['name'],
['controller' => 'Dashboards',
'action' => 'dashboard',
'?' => ['co_id' => $vv_cur_co->id]],
['escape' => false]);
?>
<?php if($generateHomeLink): ?>
<?= h($vv_cur_co['name']) ?>
<?php else: ?>
<?= $this->Html->link(__('registry.meta.registry'), '/'); ?>
<?= __('registry.meta.registry') ?>
<?php endif; ?>
</div>
<?php if($generateHomeLink): ?>
</a>
<?php endif; ?>
</div>
<!-- Custom Navigation Links -->
<?php if(!empty($vv_NavLinks) || !empty($vv_CoNavLinks)): ?>
Expand Down