From d95f113036b2dedb3ccc225e5e5a279697ab59ad Mon Sep 17 00:00:00 2001 From: Arlen Johnson Date: Fri, 28 Jul 2023 14:46:08 -0400 Subject: [PATCH] Add controller to persistent view variables, and add platform config notice to config menu panel. (CFM-310) --- app/src/Controller/AppController.php | 3 ++- app/templates/element/menuPanel.php | 23 +++++++++++++++++++++++ app/templates/layout/default.php | 9 ++++++++- app/webroot/css/co-base.css | 14 ++++++++++++++ app/webroot/css/co-responsive.css | 6 ++++++ 5 files changed, 53 insertions(+), 2 deletions(-) diff --git a/app/src/Controller/AppController.php b/app/src/Controller/AppController.php index a189d1de6..f8714ae4d 100644 --- a/app/src/Controller/AppController.php +++ b/app/src/Controller/AppController.php @@ -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)) { diff --git a/app/templates/element/menuPanel.php b/app/templates/element/menuPanel.php index 9ef29eda7..2ae3b3d4f 100644 --- a/app/templates/element/menuPanel.php +++ b/app/templates/element/menuPanel.php @@ -411,6 +411,29 @@ */ ?> + id != 1 && $vv_user_roles['platform']): ?> + Url->build([ + 'plugin' => null, + 'controller' => 'dashboards', + 'action' => 'configuration', + '?' => [ + 'co_id' => 1 + ]]), + $this->Url->build([ + 'plugin' => null, + 'controller' => 'dashboards', + 'action' => 'dashboard', + '?' => [ + 'co_id' => 1 + ]]) + ]; + ?> +
+ Alert->alert(__d('information','cmp.config.notice', $noticeUrls), 'information', true) ?> +
+
diff --git a/app/templates/layout/default.php b/app/templates/layout/default.php index 8b31dbac9..7a2fdf035 100644 --- a/app/templates/layout/default.php +++ b/app/templates/layout/default.php @@ -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'; + } ?>
@@ -158,7 +165,7 @@
- id == 1) && ($vv_action != 'select')): ?> + Url->build([ 'plugin' => null, diff --git a/app/webroot/css/co-base.css b/app/webroot/css/co-base.css index 48ebf1436..8cb5a452c 100644 --- a/app/webroot/css/co-base.css +++ b/app/webroot/css/co-base.css @@ -954,6 +954,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; diff --git a/app/webroot/css/co-responsive.css b/app/webroot/css/co-responsive.css index c18959aeb..1d0b3ef62 100644 --- a/app/webroot/css/co-responsive.css +++ b/app/webroot/css/co-responsive.css @@ -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; @@ -294,6 +297,9 @@ bottom: 2rem; margin: 0; } + #main-menu .menu-panel .config-platform-notice { + margin: 10em 0 4em; + } /* GENERAL */ .table-container { overflow: unset;