Skip to content

Commit

Permalink
Provide subnavigation and iframe layout for EmailVerifiers, Identifie…
Browse files Browse the repository at this point in the history
…rCollectors, and InvitationAccepters (CFM-428) (#265)
  • Loading branch information
arlen authored Dec 19, 2024
1 parent 94d8621 commit d27c81a
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,27 @@ class EmailVerifiersController extends StandardEnrollerController {
'EmailVerifiers.id' => 'asc'
]
];

/**
* Callback run prior to the request render.
*
* @param EventInterface $event Cake Event
*
* @return Response|void
* @since COmanage Registry v5.0.0
*/

public function beforeRender(\Cake\Event\EventInterface $event) {
$link = $this->getPrimaryLink(true);

if(!empty($link->value)) {
$this->set('vv_bc_parent_obj', $this->EmailVerifiers->EnrollmentFlowSteps->get($link->value));
$this->set('vv_bc_parent_displayfield', $this->EmailVerifiers->EnrollmentFlowSteps->getDisplayField());
$this->set('vv_bc_parent_primarykey', $this->EmailVerifiers->EnrollmentFlowSteps->getPrimaryKey());
}

return parent::beforeRender($event);
}

/**
* Dispatch an Enrollment Flow Step.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,27 @@ class IdentifierCollectorsController extends StandardEnrollerController {
'IdentifierCollectors.id' => 'asc'
]
];

/**
* Callback run prior to the request render.
*
* @param EventInterface $event Cake Event
*
* @return Response|void
* @since COmanage Registry v5.0.0
*/

public function beforeRender(\Cake\Event\EventInterface $event) {
$link = $this->getPrimaryLink(true);

if(!empty($link->value)) {
$this->set('vv_bc_parent_obj', $this->IdentifierCollectors->EnrollmentFlowSteps->get($link->value));
$this->set('vv_bc_parent_displayfield', $this->IdentifierCollectors->EnrollmentFlowSteps->getDisplayField());
$this->set('vv_bc_parent_primarykey', $this->IdentifierCollectors->EnrollmentFlowSteps->getPrimaryKey());
}

return parent::beforeRender($event);
}

/**
* Dispatch an Enrollment Flow Step.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,27 @@ class InvitationAcceptersController extends StandardEnrollerController {
'InvitationAccepters.id' => 'asc'
]
];

/**
* Callback run prior to the request render.
*
* @param EventInterface $event Cake Event
*
* @return Response|void
* @since COmanage Registry v5.0.0
*/

public function beforeRender(\Cake\Event\EventInterface $event) {
$link = $this->getPrimaryLink(true);

if(!empty($link->value)) {
$this->set('vv_bc_parent_obj', $this->InvitationAccepters->EnrollmentFlowSteps->get($link->value));
$this->set('vv_bc_parent_displayfield', $this->InvitationAccepters->EnrollmentFlowSteps->getDisplayField());
$this->set('vv_bc_parent_primarykey', $this->InvitationAccepters->EnrollmentFlowSteps->getPrimaryKey());
}

return parent::beforeRender($event);
}

/**
* Dispatch an Enrollment Flow Step.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function initialize(array $config): void {
[
// Ordered list of Tabs
'tabs' => ['EnrollmentFlowSteps', 'CoreEnroller.AttributeCollectors', 'CoreEnroller.EnrollmentAttributes'],
// 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
Expand Down
20 changes: 19 additions & 1 deletion app/plugins/CoreEnroller/src/Model/Table/EmailVerifiersTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@
class EmailVerifiersTable extends Table {
use \App\Lib\Traits\AutoViewVarsTrait;
use \App\Lib\Traits\CoLinkTrait;
use \App\Lib\Traits\LabeledLogTrait;
use \App\Lib\Traits\LabeledLogTrait;
use \App\Lib\Traits\LayoutTrait;
use \App\Lib\Traits\PermissionsTrait;
use \App\Lib\Traits\PrimaryLinkTrait;
use \App\Lib\Traits\TableMetaTrait;
use \App\Lib\Traits\TabTrait;
use \App\Lib\Traits\ValidationTrait;

/**
Expand Down Expand Up @@ -83,6 +85,22 @@ public function initialize(array $config): void {
$this->setPrimaryLink('enrollment_flow_step_id');
$this->setRequiresCO(true);
$this->setAllowLookupPrimaryLink(['dispatch', 'display']);

// All the tabs share the same configuration in the ModelTable file
$this->setTabsConfig(
[
// Ordered list of Tabs
'tabs' => ['EnrollmentFlowSteps', 'CoreEnroller.EmailVerifiers'],
// 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
// XXX edit should go first.
'EnrollmentFlowSteps' => ['edit', 'view'],
'CoreEnroller.EmailVerifiers' => ['edit']
]
]
);

$this->setAutoViewVars([
'modes' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@
class IdentifierCollectorsTable 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\TableMetaTrait;
use \App\Lib\Traits\TabTrait;
use \App\Lib\Traits\ValidationTrait;

/**
Expand Down Expand Up @@ -75,7 +77,23 @@ public function initialize(array $config): void {
$this->setPrimaryLink('enrollment_flow_step_id');
$this->setRequiresCO(true);
$this->setAllowLookupPrimaryLink(['dispatch', 'display']);


// All the tabs share the same configuration in the ModelTable file
$this->setTabsConfig(
[
// Ordered list of Tabs
'tabs' => ['EnrollmentFlowSteps', 'CoreEnroller.IdentifierCollectors'],
// 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
// XXX edit should go first.
'EnrollmentFlowSteps' => ['edit', 'view'],
'CoreEnroller.IdentifierCollectors' => ['edit']
]
]
);

$this->setAutoViewVars([
'types' => [
'type' => 'type',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@

class InvitationAcceptersTable extends Table {
use \App\Lib\Traits\CoLinkTrait;
use \App\Lib\Traits\LayoutTrait;
use \App\Lib\Traits\PermissionsTrait;
use \App\Lib\Traits\PrimaryLinkTrait;
use \App\Lib\Traits\TableMetaTrait;
use \App\Lib\Traits\TabTrait;
use \App\Lib\Traits\ValidationTrait;

/**
Expand Down Expand Up @@ -75,6 +77,22 @@ public function initialize(array $config): void {
$this->setPrimaryLink('enrollment_flow_step_id');
$this->setRequiresCO(true);
$this->setAllowLookupPrimaryLink(['dispatch', 'display']);

// All the tabs share the same configuration in the ModelTable file
$this->setTabsConfig(
[
// Ordered list of Tabs
'tabs' => ['EnrollmentFlowSteps', 'CoreEnroller.InvitationAccepters'],
// 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
// XXX edit should go first.
'EnrollmentFlowSteps' => ['edit', 'view'],
'CoreEnroller.InvitationAccepters' => ['edit']
]
]
);

$this->setPermissions([
// Actions that operate over an entity (ie: require an $id)
Expand Down

0 comments on commit d27c81a

Please sign in to comment.