Skip to content

Commit

Permalink
Add controller to persistent view variables, and add platform config …
Browse files Browse the repository at this point in the history
…notice to config menu panel. (CFM-310)
  • Loading branch information
arlen committed Oct 5, 2023
1 parent e27ec58 commit 79e1252
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/src/Controller/AppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ public function beforeRender(\Cake\Event\EventInterface $event) {
$modelsName = $this->name;

// Views can also inspect the request object to determine the current
// action, but it seems slightly easier to do it once here.
// controller and action, but it seems slightly easier to do it once here.
$this->set('vv_controller', $this->request->getParam('controller'));
$this->set('vv_action', $this->request->getParam('action'));

if(isset($this->RegistryAuth)) {
Expand Down
23 changes: 23 additions & 0 deletions app/templates/element/menuPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,29 @@
</ul>
*/ ?>
</div>
<?php if($vv_cur_co->id != 1 && $vv_user_roles['platform']): ?>
<?php
$noticeUrls = [
$this->Url->build([
'plugin' => null,
'controller' => 'dashboards',
'action' => 'configuration',
'?' => [
'co_id' => 1
]]),
$this->Url->build([
'plugin' => null,
'controller' => 'dashboards',
'action' => 'dashboard',
'?' => [
'co_id' => 1
]])
];
?>
<div class="config-platform-notice">
<?= $this->Alert->alert(__d('information','cmp.config.notice', $noticeUrls), 'information', true) ?>
</div>
<?php endif; ?>
<div class="comanage-version">
<?php print __('registry.version', chop(file_get_contents(CONFIG . "VERSION"))); ?>
</div>
Expand Down
9 changes: 8 additions & 1 deletion app/templates/layout/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@
} else {
$bodyClasses .= ' logged-out';
}

// add hints that we're in the platform-level (COmanage) CO
$isPlatformCO = false;
if(!empty($vv_cur_co) && ($vv_cur_co->id == 1) && !($vv_controller == 'Cos' && $vv_action == 'select')) {
$isPlatformCO = true;
$bodyClasses .= ' platform-co';
}
?>
<body class="<?= $bodyClasses ?>" onload="jsOnLoadCallHooks()">
<div id="skip-to-content-box">
Expand Down Expand Up @@ -158,7 +165,7 @@
</div>
</div>

<?php if(!empty($vv_cur_co) && ($vv_cur_co->id == 1) && ($vv_action != 'select')): ?>
<?php if($isPlatformCO): ?>
<?php
$platformConfigUrl = $this->Url->build([
'plugin' => null,
Expand Down
14 changes: 14 additions & 0 deletions app/webroot/css/co-base.css
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,20 @@ h2.config-subtitle {
.config-platform-notice {
margin: 4em 0 -3em;
}
#main-menu .menu-panel .config-platform-notice {
margin: 0 0 1em;
}
#main-menu .menu-panel .config-platform-notice a {
display: inline;
padding: 0;
}
#main-menu .menu-panel .config-platform-notice a:hover {
background-color: unset;
text-decoration: underline;
}
#main-menu .menu-panel .config-platform-notice .material-icons-outlined {
font-size: 24px;
}
/* INDEX ACTION COMMAND MENUS */
th.with-field-actions {
padding-left: 2.75em;
Expand Down
6 changes: 6 additions & 0 deletions app/webroot/css/co-responsive.css
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@
#advanced-menu {
margin-top: 2rem;
}
body.platform-co #advanced-menu li a {
padding: 0.25em;
}
#co-menu-collapse {
display: flex;
justify-content: center;
Expand Down Expand Up @@ -294,6 +297,9 @@
bottom: 2rem;
margin: 0;
}
#main-menu .menu-panel .config-platform-notice {
margin: 10em 0 4em;
}
/* GENERAL */
.table-container {
overflow: unset;
Expand Down

0 comments on commit 79e1252

Please sign in to comment.