Skip to content

Commit

Permalink
Add subnavigation to People and Groups (CFM-192) (COmanage#58)
Browse files Browse the repository at this point in the history
* Submenus first commit: add submenus to People and Groups (CFM-192)

* Add more submenu files (CFM-192)

* Submenus working for People, Person-Roles, External Identities, and External Identity Roles (CFM-192)

* Clean up subnavigation logic and remove hard-coded links from Roles and External Identities (CFM-192)

* Fix subnavigation for External Identity Roles in sub-entity edit views (CFM-192)

* Improve subnavigation Pronouns (CFM-192)

* Restore History Records link to External Identities (CFM-192)
  • Loading branch information
arlen authored Nov 1, 2022
1 parent cf00ffc commit b5e8e3e
Show file tree
Hide file tree
Showing 43 changed files with 1,332 additions and 333 deletions.
3 changes: 3 additions & 0 deletions app/resources/locales/en_US/information.po
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@ msgstr "Page {{page}} of {{pages}}, Viewing {{start}}-{{end}} of {{count}}"

msgid "global.records.none"
msgstr "There are no records to display."

msgid "global.title.none"
msgstr "No title"
3 changes: 3 additions & 0 deletions app/resources/locales/en_US/menu.po
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

# Menu Messages

msgid "co.Attributes"
msgstr "Attributes"

msgid "co.configuration"
msgstr "Config"

Expand Down
12 changes: 9 additions & 3 deletions app/src/Controller/MVEAController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ public function beforeRender(\Cake\Event\EventInterface $event) {
$this->set('vv_ei_id', $externalIdentity->id);

// What's the primary name of the Person?
$this->set('vv_person_name', $Names->primaryName($externalIdentity->person_id));
$personName = $Names->primaryName($externalIdentity->person_id);
$this->set('vv_person_name', $personName);
$this->set('vv_supertitle', $personName->full_name);
$this->set('vv_person_id', $externalIdentity->person_id);
break;
case 'person_role_id':
Expand All @@ -92,11 +94,15 @@ public function beforeRender(\Cake\Event\EventInterface $event) {
$this->set('vv_person_role_id', $link->value);

// Also set a name
$this->set('vv_person_name', $Names->primaryName($roleEntity->person_id));
$personName = $Names->primaryName($roleEntity->person_id);
$this->set('vv_person_name', $personName);
$this->set('vv_supertitle', $personName->full_name);
$this->set('vv_person_id', $roleEntity->person_id);
break;
case 'person_id':
$this->set('vv_person_name', $Names->primaryName((int)$link->value));
$personName = $Names->primaryName((int)$link->value);
$this->set('vv_person_name', $personName);
$this->set('vv_supertitle', $personName->full_name);
$this->set('vv_person_id', $link->value);
break;
default;
Expand Down
9 changes: 9 additions & 0 deletions app/src/Controller/StandardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ public function add() {

// Default title is add new object
$this->set('vv_title', __d('operation', 'add.a', __d('controller', $modelsName, [1])));

// Supertitle is normally the display name of the parent object when subnavigation exists.
// Set this here as the fallback default. This value is overriden in MVEAController to hold the
// name of the parent object, not the model name of the current object.
// TODO: set this to a better value for other kinds of child objects (e.g. Group member)
$this->set('vv_supertitle', __d('controller', $modelsName, [1]));

// Let the view render
$this->render('/Standard/add-edit-view');
Expand Down Expand Up @@ -322,6 +328,9 @@ public function edit(string $id) {
// 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)));
$this->set('vv_supertitle', $table->generateDisplayField($obj));
// Pass the display field also into subtitle for dealing with External IDs
$this->set('vv_subtitle', $table->generateDisplayField($obj));
} else {
// Default view title is edit object display field
$field = $table->getDisplayField();
Expand Down
6 changes: 6 additions & 0 deletions app/templates/AdHocAttributes/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,10 @@ $indexColumns = [
$bulkActions = [
// TODO: develop bulk actions. For now, use a placeholder.
'delete' => true
];

$subnav = [
'name' => 'person',
'active' => 'attributes',
'subActive' => 'ad_hoc_attributes'
];
35 changes: 35 additions & 0 deletions app/templates/AdHocAttributes/fields-nav.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* COmanage Registry Ad Hoc Attributes Edit Navigation
*
* Portions licensed to the University Corporation for Advanced Internet
* Development, Inc. ("UCAID") under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership.
*
* UCAID licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @link https://www.internet2.edu/comanage COmanage Project
* @package registry
* @since COmanage Registry v5.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

// XXX: if CFM-218 (Make fields.inc configuration only) is accepted, move the contents of this file into fields.inc
$topLinks = [];

$subnav = [
'name' => 'person',
'active' => 'attributes',
'subActive' => 'ad_hoc_attributes'
];
6 changes: 6 additions & 0 deletions app/templates/Addresses/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ $bulkActions = [
// TODO: develop bulk actions. For now, use a placeholder.
'delete' => true
];

$subnav = [
'name' => 'person',
'active' => 'attributes',
'subActive' => 'addresses'
];
35 changes: 35 additions & 0 deletions app/templates/Addresses/fields-nav.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* COmanage Registry Addresses Edit Navigation
*
* Portions licensed to the University Corporation for Advanced Internet
* Development, Inc. ("UCAID") under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership.
*
* UCAID licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @link https://www.internet2.edu/comanage COmanage Project
* @package registry
* @since COmanage Registry v5.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

// XXX: if CFM-218 (Make fields.inc configuration only) is accepted, move the contents of this file into fields.inc
$topLinks = [];

$subnav = [
'name' => 'person',
'active' => 'attributes',
'subActive' => 'addresses'
];
6 changes: 6 additions & 0 deletions app/templates/EmailAddresses/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,10 @@ $indexColumns = [
$bulkActions = [
// TODO: develop bulk actions. For now, use a placeholder.
'delete' => true
];

$subnav = [
'name' => 'person',
'active' => 'attributes',
'subActive' => 'email_addresses'
];
35 changes: 35 additions & 0 deletions app/templates/EmailAddresses/fields-nav.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* COmanage Registry Email Address Edit Navigation
*
* Portions licensed to the University Corporation for Advanced Internet
* Development, Inc. ("UCAID") under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership.
*
* UCAID licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @link https://www.internet2.edu/comanage COmanage Project
* @package registry
* @since COmanage Registry v5.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

// XXX: if CFM-218 (Make fields.inc configuration only) is accepted, move the contents of this file into fields.inc
$topLinks = [];

$subnav = [
'name' => 'person',
'active' => 'attributes', // default for person. 'external identities' are special cased
'subActive' => 'email_addresses'
];
5 changes: 5 additions & 0 deletions app/templates/ExternalIdentities/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,9 @@ $indexColumns = [
$bulkActions = [
// TODO: develop bulk actions. For now, use a placeholder.
'delete' => true
];

$subnav = [
'name' => 'person',
'active' => 'external_identities'
];
49 changes: 49 additions & 0 deletions app/templates/ExternalIdentities/fields-nav.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
/**
* COmanage Registry External Identity Edit Navigation
*
* Portions licensed to the University Corporation for Advanced Internet
* Development, Inc. ("UCAID") under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership.
*
* UCAID licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @link https://www.internet2.edu/comanage COmanage Project
* @package registry
* @since COmanage Registry v5.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

// XXX: if CFM-218 (Make fields.inc configuration only) is accepted, move the contents of this file into fields.inc
$topLinks = [
[
'icon' => 'history',
'order' => 'Default',
'label' => __d('operation', 'HistoryRecords'),
'link' => [
'controller' => 'history_records',
'action' => 'index',
'?' => [
'external_identity_id' => $vv_obj->id
]
],
'class' => ''
]
];

$subnav = [
'name' => 'person',
'active' => 'external_identities',
'subActive' => 'properties'
];
112 changes: 0 additions & 112 deletions app/templates/ExternalIdentities/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -32,115 +32,3 @@ if($vv_action == 'add' || $vv_action == 'edit') {

print $this->Field->dateControl('date_of_birth', \App\Lib\Enum\DateTypeEnum::DateOnly);
}

// XXX This is a placeholder for canvas... maybe it should become a separate page
// rather than overload fields.inc?
print $this->Html->link(
__d('controller', 'Names', [99]),
[ 'controller' => 'names',
'action' => 'index',
'?' => [
'external_identity_id' => $vv_obj->id
]
],
['class' => 'linkbutton']
);

print $this->Html->link(
__d('controller', 'EmailAddresses', [99]),
[ 'controller' => 'email_addresses',
'action' => 'index',
'?' => [
'external_identity_id' => $vv_obj->id
]
],
['class' => 'linkbutton']
);

print $this->Html->link(
__d('controller', 'Identifiers', [99]),
[ 'controller' => 'identifiers',
'action' => 'index',
'?' => [
'external_identity_id' => $vv_obj->id
]
],
['class' => 'linkbutton']
);

print $this->Html->link(
__d('controller', 'ExternalIdentityRoles', [99]),
[ 'controller' => 'external_identity_roles',
'action' => 'index',
'?' => [
'external_identity_id' => $vv_obj->id
]
],
['class' => 'linkbutton']
);

print $this->Html->link(
__d('controller', 'HistoryRecords', [99]),
[ 'controller' => 'history_records',
'action' => 'index',
'?' => [
'external_identity_id' => $vv_obj->id
]
],
['class' => 'linkbutton']
);

print $this->Html->link(
__d('controller', 'AdHocAttributes', [99]),
[ 'controller' => 'ad_hoc_attributes',
'action' => 'index',
'?' => [
'external_identity_id' => $vv_obj->id
]
],
['class' => 'linkbutton']
);
print $this->Html->link(
__d('controller', 'Addresses', [99]),
[ 'controller' => 'addresses',
'action' => 'index',
'?' => [
'external_identity_id' => $vv_obj->id
]
],
['class' => 'linkbutton']
);

print $this->Html->link(
__d('controller', 'TelephoneNumbers', [99]),
[ 'controller' => 'telephone_numbers',
'action' => 'index',
'?' => [
'external_identity_id' => $vv_obj->id
]
],
['class' => 'linkbutton']
);

print $this->Html->link(
__d('controller', 'Urls', [99]),
[ 'controller' => 'urls',
'action' => 'index',
'?' => [
'external_identity_id' => $vv_obj->id
]
],
['class' => 'linkbutton']
);

print $this->Html->link(
__d('controller', 'Pronouns', [99]),
[ 'controller' => 'pronouns',
'action' => 'index',
'?' => [
'external_identity_id' => $vv_obj->id
]
],
['class' => 'linkbutton']
);
Loading

0 comments on commit b5e8e3e

Please sign in to comment.