Skip to content

Commit

Permalink
Add External Identity Roles canvas (CFM-263) (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
arlen authored Sep 6, 2023
1 parent e6d57d4 commit 9ee65f6
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 90 deletions.
3 changes: 1 addition & 2 deletions app/src/Model/Table/ExternalIdentityRolesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,9 @@ public function initialize(array $config): void {
$this->setRedirectGoal('self');

$this->setEditContains([
/*
'Addresses',
'AdHocAttributes',
'TelephoneNumbers'*/
'TelephoneNumbers'
]);

$this->setAutoViewVars([
Expand Down
33 changes: 33 additions & 0 deletions app/templates/ExternalIdentityRoles/fields-nav.inc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,39 @@
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

// List the MVEAs that may be shown on the mveaCanvas
// When this array exists, the mveaCanvas.php element will render
$mveas = [
'ad_hoc_attributes',
'addresses',
'telephone_numbers'
];

// Name the MVEAs Entity Type
$mveasEntityType = "external_identity_role";

// $addMenuLinks is also given slightly different treatment from the typical $topLinks found in most views:
// it is a page-global menu used for adding MVEAs and is given special treatment in element/mveaCanvas.php.
$addMenuLinks = [
[
'controller' => 'ad_hoc_attributes',
'action' => 'add',
'icon' => 'check_box',
'iconClass' => 'material-icons-outlined'
],
[
'controller' => 'addresses',
'action' => 'add',
'icon' => 'contact_mail',
'iconClass' => 'material-icons-outlined'
],
[
'controller' => 'telephone_numbers',
'action' => 'add',
'icon' => 'phone'
]
];

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

Expand Down
2 changes: 1 addition & 1 deletion app/templates/element/mveaCanvas.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
}
?>
<div id="mvea-canvas" class="co-cards">
<div id="mvea-canvas-attributes-js" class="row row-cols-1 g-4 <?= ($widgetCount > 1) ? 'row-cols-md-2' : ''?>">
<div id="mvea-canvas-attributes-js" class="row row-cols-1 g-4<?= ($widgetCount > 1) ? ' row-cols-md-2' : ''?>">
<?php
foreach($attributes as $attr) {
if(!empty(($vv_obj[$attr]))) {
Expand Down
87 changes: 0 additions & 87 deletions app/templates/element/subnavigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,93 +368,6 @@
</ul>
</nav>

<?php if($isExternalIdRole): ?>
<!-- Third-level subnavigation links - only for External Identity Roles -->
<div id="external-id-role">
<h3>
<?php
// Set the link filter for External Identity Roles
$curId = $vv_primary_link_obj->id;
if(!empty($vv_obj) && ($curController == 'ExternalIdentityRoles' && ($curAction == 'edit' || $curAction == 'view'))) {
$curId = $vv_obj->id;
}
$linkFilter = ['external_identity_role_id' => $curId];

if(!empty($vv_ei_role)) {
print $vv_ei_role;
} elseif(!empty($vv_obj->title)) {
print $vv_obj->title;
} else {
// As above, we shouldn't get here, but have a deafult in case.
print __d('information','global.title.none');
}
?>
</h3>
<nav id="external-id-role-nav" class="cm-subnav-links">
<ul class="list-inline">
<li class="list-inline-item">
<?php
// Properties
$linkClass = (
$curController == 'ExternalIdentityRoles'
&& ($curAction == 'edit' || $curAction == 'view')
) ? 'nav-link active' : 'nav-link';
print $this->Html->link(
__d('controller', 'Properties', [99]),
[ 'controller' => 'external-identity-roles',
'action' => 'edit',
$curId
],
['class' => $linkClass]
);
?>
</li>
<li class="list-inline-item">
<?php
// Ad-Hoc Attributes
$linkClass = ($subActive == 'ad_hoc_attributes') ? 'nav-link active' : 'nav-link';
print $this->Html->link(
__d('controller', 'AdHocAttributes', [99]),
[ 'controller' => 'ad_hoc_attributes',
'action' => 'index',
'?' => $linkFilter
],
['class' => $linkClass]
);
?>
</li>
<li class="list-inline-item">
<?php
// Addresses
$linkClass = ($subActive == 'addresses') ? 'nav-link active' : 'nav-link';
print $this->Html->link(
__d('controller', 'Addresses', [99]),
[ 'controller' => 'addresses',
'action' => 'index',
'?' => $linkFilter
],
['class' => $linkClass]
);
?>
</li>
<li class="list-inline-item">
<?php
// Telephone Numbers
$linkClass = ($subActive == 'telephone_numbers') ? 'nav-link active' : 'nav-link';
print $this->Html->link(
__d('controller', 'TelephoneNumbers', [99]),
[ 'controller' => 'telephone_numbers',
'action' => 'index',
'?' => $linkFilter
],
['class' => $linkClass]
);
?>
</li>
</ul>
</nav>
</div>
<?php endif; // end $isExternalIdRole ?>
<?php endif; // end $isExternalId ?>
</div>

0 comments on commit 9ee65f6

Please sign in to comment.