From d2068900ba6b2d3b64227af1065f94bdb2dcea12 Mon Sep 17 00:00:00 2001 From: Arlen Johnson Date: Wed, 2 Oct 2024 09:11:35 -0400 Subject: [PATCH] Cleanup to subnavigation and titling (CFM-31) (#229) * Cleanup to subnavigation and titling (CFM-31) * Trivial cleanup (CFM-31) * More trivial cleanup (CFM-31) * Even more trivial cleanup (CFM-31) --- .../src/Model/Table/AttributeCollectorsTable.php | 1 + .../src/Model/Table/EnrollmentAttributesTable.php | 6 +++--- .../templates/AttributeCollectors/fields.inc | 2 ++ .../templates/EnrollmentAttributes/columns.inc | 3 +-- app/resources/locales/en_US/information.po | 3 +++ app/resources/locales/en_US/operation.po | 3 +++ app/src/Model/Table/EnrollmentFlowStepsTable.php | 3 ++- app/src/Model/Table/ExternalIdentityRolesTable.php | 2 +- app/src/Model/Table/PersonRolesTable.php | 2 +- app/src/Model/Table/PetitionsTable.php | 2 +- app/templates/EnrollmentFlowSteps/columns.inc | 11 +++++------ app/templates/Standard/add-edit-view.php | 9 +++++---- app/templates/Standard/index.php | 7 ++++--- app/templates/element/subnavigation/supertitle.php | 4 ++++ 14 files changed, 36 insertions(+), 22 deletions(-) diff --git a/app/plugins/CoreEnroller/src/Model/Table/AttributeCollectorsTable.php b/app/plugins/CoreEnroller/src/Model/Table/AttributeCollectorsTable.php index 2c1699ddf..23bd6e444 100644 --- a/app/plugins/CoreEnroller/src/Model/Table/AttributeCollectorsTable.php +++ b/app/plugins/CoreEnroller/src/Model/Table/AttributeCollectorsTable.php @@ -40,6 +40,7 @@ class AttributeCollectorsTable extends Table { use \App\Lib\Traits\AutoViewVarsTrait; use \App\Lib\Traits\CoLinkTrait; + use \App\Lib\Traits\LayoutTrait; use \App\Lib\Traits\PermissionsTrait; use \App\Lib\Traits\PrimaryLinkTrait; use \App\Lib\Traits\TabTrait; diff --git a/app/plugins/CoreEnroller/src/Model/Table/EnrollmentAttributesTable.php b/app/plugins/CoreEnroller/src/Model/Table/EnrollmentAttributesTable.php index a9b6bc9e4..6d22a1d9d 100644 --- a/app/plugins/CoreEnroller/src/Model/Table/EnrollmentAttributesTable.php +++ b/app/plugins/CoreEnroller/src/Model/Table/EnrollmentAttributesTable.php @@ -47,7 +47,7 @@ class EnrollmentAttributesTable extends Table { use \App\Lib\Traits\TableMetaTrait; use \App\Lib\Traits\ValidationTrait; use \App\Lib\Traits\TabTrait; - + /** * Perform Cake Model initialization. * @@ -77,8 +77,8 @@ public function initialize(array $config): void { $this->setPrimaryLink('CoreEnroller.attribute_collector_id'); $this->setRequiresCO(true); - $this->setRedirectGoal(action: 'add', goal: 'self'); - $this->setRedirectGoal(action: 'edit', goal: 'self'); + $this->setRedirectGoal(action: 'add', goal: 'index'); + $this->setRedirectGoal(action: 'edit', goal: 'index'); $this->setAutoViewVars([ 'addressRequiredFields' => [ diff --git a/app/plugins/CoreEnroller/templates/AttributeCollectors/fields.inc b/app/plugins/CoreEnroller/templates/AttributeCollectors/fields.inc index 113565bee..40a5b752c 100644 --- a/app/plugins/CoreEnroller/templates/AttributeCollectors/fields.inc +++ b/app/plugins/CoreEnroller/templates/AttributeCollectors/fields.inc @@ -31,3 +31,5 @@ declare(strict_types = 1); $this->Field->disableFormEditMode(); +print __d('information', 'plugin.config.none'); + diff --git a/app/plugins/CoreEnroller/templates/EnrollmentAttributes/columns.inc b/app/plugins/CoreEnroller/templates/EnrollmentAttributes/columns.inc index 01bf7b8a2..e325623fb 100644 --- a/app/plugins/CoreEnroller/templates/EnrollmentAttributes/columns.inc +++ b/app/plugins/CoreEnroller/templates/EnrollmentAttributes/columns.inc @@ -33,7 +33,6 @@ $indexColumns = [ 'label' => [ 'type' => 'link', 'sortable' => true, - 'class' => 'cm-modal-link nospin', // launch this in a modal 'dataAttrs' => [ ['data-cm-modal-title', __d('operation', 'EnrollmentAttributes', 1)] ] @@ -89,7 +88,7 @@ $action_args = array(); // and we will use the username instead. $action_args['vv_attr_id'] = $vv_user['username']; $action_args['vv_actions_type'] = 'mvea-add-menu'; -$action_args['vv_actions_title'] = __d('operation', 'add'); +$action_args['vv_actions_title'] = __d('operation', 'add.attribute'); $action_args['vv_actions_icon'] = 'add_circle'; $action_args['vv_actions_class'] = 'mvea-add-menu'; $actionOrderDefault = $this->Menu->getMenuOrder('Default'); diff --git a/app/resources/locales/en_US/information.po b/app/resources/locales/en_US/information.po index 725acb010..21bff9791 100644 --- a/app/resources/locales/en_US/information.po +++ b/app/resources/locales/en_US/information.po @@ -111,6 +111,9 @@ msgstr "Active" msgid "plugin.active.only" msgstr "Active, Cannot Be Disabled" +msgid "plugin.config.none" +msgstr "This plugin requires no configuration." + msgid "plugin.inactive" msgstr "Inactive" diff --git a/app/resources/locales/en_US/operation.po b/app/resources/locales/en_US/operation.po index d7429d58a..c30bec0e2 100644 --- a/app/resources/locales/en_US/operation.po +++ b/app/resources/locales/en_US/operation.po @@ -36,6 +36,9 @@ msgstr "Add" msgid "add.a" msgstr "Add a New {0}" +msgid "add.attribute" +msgstr "Add attribute" + msgid "add.member" msgstr "Add member: " diff --git a/app/src/Model/Table/EnrollmentFlowStepsTable.php b/app/src/Model/Table/EnrollmentFlowStepsTable.php index d550ddc97..75a5c25a3 100644 --- a/app/src/Model/Table/EnrollmentFlowStepsTable.php +++ b/app/src/Model/Table/EnrollmentFlowStepsTable.php @@ -41,13 +41,14 @@ class EnrollmentFlowStepsTable extends Table { use \App\Lib\Traits\AutoViewVarsTrait; use \App\Lib\Traits\ChangelogBehaviorTrait; use \App\Lib\Traits\CoLinkTrait; + use \App\Lib\Traits\LayoutTrait; use \App\Lib\Traits\PermissionsTrait; use \App\Lib\Traits\PluggableModelTrait; use \App\Lib\Traits\PrimaryLinkTrait; use \App\Lib\Traits\TabTrait; use \App\Lib\Traits\TableMetaTrait; use \App\Lib\Traits\ValidationTrait; - + /** * Perform Cake Model initialization. * diff --git a/app/src/Model/Table/ExternalIdentityRolesTable.php b/app/src/Model/Table/ExternalIdentityRolesTable.php index d67b2f81d..0215fb171 100644 --- a/app/src/Model/Table/ExternalIdentityRolesTable.php +++ b/app/src/Model/Table/ExternalIdentityRolesTable.php @@ -144,7 +144,7 @@ public function initialize(array $config): void { // render in index mode for the same use case/context // XXX edit should go first. 'ExternalIdentities' => ['edit', 'view'], - 'ExternalIdentityRoles' => ['index'], + 'ExternalIdentityRoles' => ['edit', 'view', 'index'], ], // What model will have a counter-badge after the tab title 'counter' => ['ExternalIdentityRoles'], diff --git a/app/src/Model/Table/PersonRolesTable.php b/app/src/Model/Table/PersonRolesTable.php index 324b81f0f..5f6a932de 100644 --- a/app/src/Model/Table/PersonRolesTable.php +++ b/app/src/Model/Table/PersonRolesTable.php @@ -175,7 +175,7 @@ public function initialize(array $config): void { // render in index mode for the same use case/context // XXX edit should go first. 'People' => ['edit', 'view'], - 'PersonRoles' => ['edit', 'view', 'index'], + 'PersonRoles' => ['edit','view','index'], 'ExternalIdentities' => ['index'], ], // What model will have a counter-badge after the tab title diff --git a/app/src/Model/Table/PetitionsTable.php b/app/src/Model/Table/PetitionsTable.php index 2c0beb9a8..5fd8554ab 100644 --- a/app/src/Model/Table/PetitionsTable.php +++ b/app/src/Model/Table/PetitionsTable.php @@ -168,7 +168,7 @@ public function initialize(array $config): void { [ // Ordered list of Tabs 'tabs' => ['EnrollmentFlows', 'EnrollmentFlowSteps', 'Petitions'], - // What actions will inlcude the subnavigation header + // What actions will include the subnavigation header 'action' => [ // If a model renders in a subnavigation mode in edit/view mode, it cannot // render in index mode for the same use case/context diff --git a/app/templates/EnrollmentFlowSteps/columns.inc b/app/templates/EnrollmentFlowSteps/columns.inc index 3f2035cdb..54283dc18 100644 --- a/app/templates/EnrollmentFlowSteps/columns.inc +++ b/app/templates/EnrollmentFlowSteps/columns.inc @@ -32,7 +32,11 @@ $indexColumns = [ ], 'description' => [ 'type' => 'link', - 'sortable' => true + 'sortable' => true, + 'class' => 'cm-modal-link nospin row-link', // launch this in a modal + 'dataAttrs' => [ + ['data-cm-modal-title', __d('controller', 'EnrollmentFlowSteps', 1)] + ] ], 'actor_type' => [ 'type' => 'enum', @@ -57,8 +61,3 @@ $rowActions = [ 'icon' => 'electrical_services' ] ]; - -$subnav = [ - 'name' => 'enrollment_flow', - 'active' => 'steps' -]; \ No newline at end of file diff --git a/app/templates/Standard/add-edit-view.php b/app/templates/Standard/add-edit-view.php index b68449f64..cfd18086b 100644 --- a/app/templates/Standard/add-edit-view.php +++ b/app/templates/Standard/add-edit-view.php @@ -66,14 +66,16 @@ } // Subnavigation +$hasSubnav = false; if(file_exists(ROOT . DS . 'templates' . DS . 'Standard/subnavigation.inc')) { include(ROOT . DS . 'templates' . DS . 'Standard/subnavigation.inc'); + $hasSubnav = $this->get('hasSupertitle'); } ?>
- +

@@ -156,9 +158,8 @@ } ?>
- - -getLayout() === 'iframe'): ?> + + element('flash', $flashArgs) ?> diff --git a/app/templates/Standard/index.php b/app/templates/Standard/index.php index 7a1e6b532..d58a73616 100644 --- a/app/templates/Standard/index.php +++ b/app/templates/Standard/index.php @@ -83,14 +83,16 @@ } // Subnavigation +$hasSubnav = false; if(file_exists(ROOT . DS . 'templates' . DS . 'Standard/subnavigation.inc')) { include(ROOT . DS . 'templates' . DS . 'Standard/subnavigation.inc'); + $hasSubnav = $this->get('hasSupertitle'); } ?>
- +

@@ -184,8 +186,7 @@
- - + element('flash', $flashArgs); ?> diff --git a/app/templates/element/subnavigation/supertitle.php b/app/templates/element/subnavigation/supertitle.php index f138cb812..64ac955b7 100644 --- a/app/templates/element/subnavigation/supertitle.php +++ b/app/templates/element/subnavigation/supertitle.php @@ -41,6 +41,10 @@ default => __d('information','global.title.none') }; +// This allows us to know that we have subnavigation in the +// Standard views (index.php, add-edit-view.php). +$this->set('hasSupertitle', true); + ?>