From 23f9182e66b6ebe5952f7147e94adf09c2756c5c Mon Sep 17 00:00:00 2001 From: Arlen Johnson Date: Wed, 11 Oct 2023 07:40:51 -0400 Subject: [PATCH] Restore attribute cards on External Id canvas (CFM-345) (#133) * Add test for ext_identity_source_records on External Id canvas (CFM-345) * Restore attribute cards on External Id canvas. Improve read-only form-list styling. (CFM-345) --- .../Model/Table/ExternalIdentitiesTable.php | 6 +-- app/src/View/Helper/FieldHelper.php | 2 +- app/templates/ExternalIdentities/fields.inc | 46 ++++++++++--------- app/webroot/css/co-base.css | 9 ++++ 4 files changed, 35 insertions(+), 28 deletions(-) diff --git a/app/src/Model/Table/ExternalIdentitiesTable.php b/app/src/Model/Table/ExternalIdentitiesTable.php index bf9f8d703..de6eceba8 100644 --- a/app/src/Model/Table/ExternalIdentitiesTable.php +++ b/app/src/Model/Table/ExternalIdentitiesTable.php @@ -131,6 +131,7 @@ public function initialize(array $config): void { 'Addresses', 'AdHocAttributes', 'EmailAddresses', + 'ExtIdentitySourceRecords' => ['ExternalIdentitySources'], 'Identifiers', 'Names', 'Pronouns', @@ -138,11 +139,6 @@ public function initialize(array $config): void { 'Urls' ]); - $this->setViewContains([ - 'PrimaryName', - 'ExtIdentitySourceRecords' => ['ExternalIdentitySources'] - ]); - $this->setAutoViewVars([ 'statuses' => [ 'type' => 'enum', diff --git a/app/src/View/Helper/FieldHelper.php b/app/src/View/Helper/FieldHelper.php index 635014567..5fe65f799 100644 --- a/app/src/View/Helper/FieldHelper.php +++ b/app/src/View/Helper/FieldHelper.php @@ -220,7 +220,7 @@ public function dateControl(string $fieldName, string $dateType=DateTypeEnum::St $controlCode = ''; } } else { - $controlCode = __d('information', 'notset'); + $controlCode = '
' . __d('information', 'notset') . '
'; } // Return this to the generic control() function return $this->control($fieldName, $coptions, ctrlCode: $controlCode, labelIsTextOnly: true); diff --git a/app/templates/ExternalIdentities/fields.inc b/app/templates/ExternalIdentities/fields.inc index 06c5d1636..7b4a573c5 100644 --- a/app/templates/ExternalIdentities/fields.inc +++ b/app/templates/ExternalIdentities/fields.inc @@ -27,28 +27,30 @@ // This view will not support add/edit if($vv_action == 'add' || $vv_action == 'edit' || $vv_action == 'view') { - print __d( - 'information', - 'ExternalIdentities.source', - [ - $this->Html->link( - $vv_obj->ext_identity_source_records[0]->external_identity_source->description, - [ - 'controller' => 'external-identity-sources', - 'action' => 'edit', - $vv_obj->ext_identity_source_records[0]->external_identity_source->id - ] - ), - $this->Html->link( - __d('operation', 'view.a', [__d('controller', 'ExtIdentitySourceRecords', 1)]), - [ - 'controller' => 'ext-identity-source-records', - 'action' => 'view', - $vv_obj->ext_identity_source_records[0]->id - ] - ) - ] - ); + if(!empty($vv_obj->ext_identity_source_records[0])) { + print __d( + 'information', + 'ExternalIdentities.source', + [ + $this->Html->link( + $vv_obj->ext_identity_source_records[0]->external_identity_source->description, + [ + 'controller' => 'external-identity-sources', + 'action' => 'edit', + $vv_obj->ext_identity_source_records[0]->external_identity_source->id + ] + ), + $this->Html->link( + __d('operation', 'view.a', [__d('controller', 'ExtIdentitySourceRecords', 1)]), + [ + 'controller' => 'ext-identity-source-records', + 'action' => 'view', + $vv_obj->ext_identity_source_records[0]->id + ] + ) + ] + ); + } print $this->Field->control('status', ['empty' => false]); diff --git a/app/webroot/css/co-base.css b/app/webroot/css/co-base.css index 7742a527c..03dea60ee 100644 --- a/app/webroot/css/co-base.css +++ b/app/webroot/css/co-base.css @@ -1200,6 +1200,9 @@ ul.form-list { clear: both; padding: 0; } +body.view ul.form-list { + border-bottom: 1px solid var(--cmg-color-bg-005); +} .cm-time-picker-vals ul li, ul.form-list li { background-color: var(--cmg-color-body-bg); @@ -1231,6 +1234,9 @@ ul.form-list li.fields-submit { border-left: none; border-right: none; } +ul.form-list li.fields-submit .field:hover { + background-color: var(--cmg-color-body-bg); +} ul.form-list .field-name { display: block; } @@ -1273,6 +1279,9 @@ ul.form-list select { background-color: var(--cmg-color-body-bg); border-color: var(--cmg-color-bg-007); } +ul.form-list .not-set { + padding: 4px 6px; +} .form-select:disabled { background-color: var(--cmg-color-bg-009); }