From 3b6e559a7d8f1ff66877712d7f6f6abf68979134 Mon Sep 17 00:00:00 2001 From: Arlen Johnson Date: Thu, 21 Jul 2022 12:32:42 -0400 Subject: [PATCH] Remove entity ID rendered in page heading, and place it in a separate view variable. (CFM-193) (#43) * Remove entity ID rendered in page heading, and place it in a separate view variable. (CFM-193) * Expose entity ID under add/edit forms and views. (CFM-193) --- app/resources/locales/en_US/information.po | 3 +++ app/resources/locales/en_US/operation.po | 4 ++-- app/src/Controller/StandardController.php | 12 ++++++------ app/templates/Standard/add-edit-view.php | 2 ++ app/webroot/css/co-base.css | 8 ++++++++ 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/app/resources/locales/en_US/information.po b/app/resources/locales/en_US/information.po index 15f47f3ae..8713d0b20 100644 --- a/app/resources/locales/en_US/information.po +++ b/app/resources/locales/en_US/information.po @@ -45,6 +45,9 @@ msgstr "Error: " msgid "flash.success" msgstr "Success: " +msgid "entity.id" +msgstr "ID: {0}" + msgid "pagination.format" msgstr "Page {{page}} of {{pages}}, Viewing {{start}}-{{end}} of {{count}}" diff --git a/app/resources/locales/en_US/operation.po b/app/resources/locales/en_US/operation.po index c1491edeb..29198eb27 100644 --- a/app/resources/locales/en_US/operation.po +++ b/app/resources/locales/en_US/operation.po @@ -67,7 +67,7 @@ msgid "edit.a" msgstr "Edit {0}" msgid "edit.ai" -msgstr "Edit {0} (ID {1})" +msgstr "Edit {0}" msgid "filter" msgstr "Filter" @@ -127,5 +127,5 @@ msgid "view.a" msgstr "View {0}" msgid "view.ai" -msgstr "View {0} ({1})" +msgstr "View {0}" diff --git a/app/src/Controller/StandardController.php b/app/src/Controller/StandardController.php index 17dd1be8f..280e311cf 100644 --- a/app/src/Controller/StandardController.php +++ b/app/src/Controller/StandardController.php @@ -319,15 +319,15 @@ public function edit(string $id) { if(method_exists($table, 'generateDisplayField')) { // We don't use a trait for this since each table will implement different logic - $this->set('vv_title', __d('operation', 'edit.ai', $table->generateDisplayField($obj), $id)); + $this->set('vv_title', __d('operation', 'edit.ai', $table->generateDisplayField($obj))); } else { // Default view title is edit object display field $field = $table->getDisplayField(); if(!empty($obj->$field)) { - $this->set('vv_title', __d('operation', 'edit.ai', $obj->$field, $id)); + $this->set('vv_title', __d('operation', 'edit.ai', $obj->$field)); } else { - $this->set('vv_title', __d('operation', 'edit.ai', __d('controller', $modelsName, [1]), $id)); + $this->set('vv_title', __d('operation', 'edit.ai', __d('controller', $modelsName, [1]))); } } @@ -648,15 +648,15 @@ public function view($id = null) { if(method_exists($table, 'generateDisplayField')) { // We don't use a trait for this since each table will implement different logic - $this->set('vv_title', __d('operation', 'view.ai', $table->generateDisplayField($obj), $id)); + $this->set('vv_title', __d('operation', 'view.ai', $table->generateDisplayField($obj))); } else { // Default view title is the object display field $field = $table->getDisplayField(); if(!empty($obj->$field)) { - $this->set('vv_title', __d('operation', 'view.ai', $obj->$field, $id)); + $this->set('vv_title', __d('operation', 'view.ai', $obj->$field)); } else { - $this->set('vv_title', __d('operation', 'view.ai', __d('controller', $modelsName, [1]), $id)); + $this->set('vv_title', __d('operation', 'view.ai', __d('controller', $modelsName, [1]))); } } diff --git a/app/templates/Standard/add-edit-view.php b/app/templates/Standard/add-edit-view.php index 7f8f43ef6..4d0d43a45 100644 --- a/app/templates/Standard/add-edit-view.php +++ b/app/templates/Standard/add-edit-view.php @@ -134,6 +134,8 @@ } } +print '
  • ' . __d('information', 'entity.id', $vv_obj->id) . '
  • '; + if($vv_action == 'add' || $vv_action == 'edit') { // We don't want/need to output these for view actions diff --git a/app/webroot/css/co-base.css b/app/webroot/css/co-base.css index 9feb3775a..855c3b0fd 100644 --- a/app/webroot/css/co-base.css +++ b/app/webroot/css/co-base.css @@ -1252,6 +1252,14 @@ ul.form-list .cm-time-picker-vals li { .v-leave-to { opacity: 0; } +/* ENTITY ID under each Edit/View Form/List */ +#cm-entity-id { + position: absolute; + border: none; + right: 2.5em; + color: var(--cmg-color-gray-003); + background-color: unset; +} /* DIALOG BOX */ #dialog .modal-header { background-color: var(--cmg-color-lightgray-004);