Skip to content

Commit

Permalink
Subnavigation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Oct 3, 2024
1 parent 80b200f commit c40380f
Show file tree
Hide file tree
Showing 23 changed files with 378 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,34 @@
namespace FileConnector\Controller;

use App\Controller\StandardPluginController;
use Cake\Event\EventInterface;
use Cake\Http\Response;

class FileSourcesController extends StandardPluginController {
public $paginate = [
'order' => [
'FileSources.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(EventInterface $event) {
$link = $this->getPrimaryLink(true);

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

return parent::beforeRender($event);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

use App\Controller\StandardEnrollerController;
use App\Lib\Enum\PetitionStatusEnum;
use Cake\Event\EventInterface;
use Cake\Http\Response;

class AttributeCollectorsController extends StandardEnrollerController {
public $paginate = [
Expand All @@ -39,6 +41,27 @@ class AttributeCollectorsController extends StandardEnrollerController {
]
];

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

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

if(!empty($link->value)) {
$this->set('vv_bc_parent_obj', $this->AttributeCollectors->EnrollmentFlowSteps->get($link->value));
$this->set('vv_bc_parent_displayfield', $this->AttributeCollectors->EnrollmentFlowSteps->getDisplayField());
$this->set('vv_bc_parent_primarykey', $this->AttributeCollectors->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 @@ -51,6 +51,14 @@ class EnrollmentAttributesController extends StandardEnrollerController {
public function beforeRender(\Cake\Event\EventInterface $event) {
$this->set('vv_supported_attributes', $this->EnrollmentAttributes->supportedAttributes());

$link = $this->getPrimaryLink(true);

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

$ret = parent::beforeRender($event);

// Override the auto-generated title
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
class AttributeCollectorsTable 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\TabTrait;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@
class EnrollmentAttributesTable 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\ValidationTrait;
use \App\Lib\Traits\TabTrait;

use \App\Lib\Traits\LayoutTrait;

/**
* Perform Cake Model initialization.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ $indexColumns = [
'label' => [
'type' => 'link',
'sortable' => true,
'class' => 'cm-modal-link nospin', // launch this in a modal
'dataAttrs' => [
['data-cm-modal-title', __d('operation', 'EnrollmentAttributes', 1)]
]
Expand Down
25 changes: 25 additions & 0 deletions app/src/Controller/EnrollmentFlowStepsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
namespace App\Controller;

// XXX not doing anything with Log yet
use Cake\Event\EventInterface;
use Cake\Http\Response;
use Cake\Log\Log;

class EnrollmentFlowStepsController extends StandardPluggableController {
Expand All @@ -38,4 +40,27 @@ class EnrollmentFlowStepsController extends StandardPluggableController {
'EnrollmentFlowSteps.ordr' => '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(EventInterface $event) {
// Pull the Person name for breadcrumb rendering

$link = $this->getPrimaryLink(true);

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

return parent::beforeRender($event);
}
}
28 changes: 25 additions & 3 deletions app/src/Controller/ExternalIdentitiesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@

namespace App\Controller;

// XXX not doing anything with Log yet
use Cake\Log\Log;
use Cake\ORM\TableRegistry;
use Cake\Event\EventInterface;
use Cake\Http\Response;

// Use extend MVEAController for breadcrumb rendering. ExternalIdentities is
// sort of an MVEA, so maybe it makes sense to treat it as such.
Expand All @@ -45,4 +44,27 @@ class ExternalIdentitiesController extends MVEAController {
'Names.family'
]
];

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

public function beforeRender(EventInterface $event) {
// Pull the Person name for breadcrumb rendering

$link = $this->getPrimaryLink(true);

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

return parent::beforeRender($event);
}
}
1 change: 1 addition & 0 deletions app/src/Controller/GroupMembersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public function beforeRender(EventInterface $event) {
if(!empty($link->value)) {
$this->set('vv_bc_parent_obj', $this->GroupMembers->Groups->get($link->value));
$this->set('vv_bc_parent_displayfield', $this->GroupMembers->Groups->getDisplayField());
$this->set('vv_bc_parent_primarykey', $this->GroupMembers->Groups->getPrimaryKey());
}

return parent::beforeRender($event);
Expand Down
1 change: 1 addition & 0 deletions app/src/Controller/GroupNestingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function beforeRender(\Cake\Event\EventInterface $event) {
if(!empty($link->value)) {
$this->set('vv_bc_parent_obj', $this->GroupNestings->Groups->get($link->value));
$this->set('vv_bc_parent_displayfield', $this->GroupNestings->Groups->getDisplayField());
$this->set('vv_bc_parent_primarykey', $this->GroupNestings->Groups->getPrimaryKey());
}

// We need to calculate the available set of groups for nesting. We do this
Expand Down
1 change: 1 addition & 0 deletions app/src/Controller/JobHistoryRecordsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function beforeRender(\Cake\Event\EventInterface $event) {
if(!empty($link->value)) {
$this->set('vv_bc_parent_obj', $this->JobHistoryRecords->Jobs->get($link->value));
$this->set('vv_bc_parent_displayfield', $this->JobHistoryRecords->Jobs->getDisplayField());
$this->set('vv_bc_parent_primarykey', $this->JobHistoryRecords->Jobs->getPrimaryKey());
}

return parent::beforeRender($event);
Expand Down
25 changes: 24 additions & 1 deletion app/src/Controller/PetitionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@
namespace App\Controller;

// XXX not doing anything with Log yet
use Cake\Event\EventInterface;
use Cake\Http\Response;
use Cake\Log\Log;
use Cake\ORM\TableRegistry;
use Cake\Utility\Inflector;
use \App\Lib\Util\StringUtilities;
use \App\Lib\Enum\EnrollmentActorEnum;
use \App\Lib\Enum\SuspendableStatusEnum;
use \App\Lib\Util\StringUtilities;

class PetitionsController extends StandardController {
use \App\Lib\Traits\EnrollmentControllerTrait;
Expand All @@ -49,6 +51,27 @@ class PetitionsController extends StandardController {
// Cached copy of the next step information
private $nextStep = null;

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

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

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

return parent::beforeRender($event);
}

/**
* Calculate authorization for the current request.
*
Expand Down
1 change: 1 addition & 0 deletions app/src/Controller/StandardPluginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public function beforeRender(\Cake\Event\EventInterface $event) {

$this->set('vv_bc_parent_obj', $parentObj);
$this->set('vv_bc_parent_displayfield', $parentDisplayField);
$this->set('vv_bc_parent_primarykey', $parentTable->getPrimaryKey());

// Override the title set in StandardController. Since that was set in edit()
// which is called before the rendering hooks, this title will take precedence.
Expand Down
1 change: 0 additions & 1 deletion app/src/Model/Table/EnrollmentFlowStepsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class EnrollmentFlowStepsTable extends Table {
use \App\Lib\Traits\AutoViewVarsTrait;
use \App\Lib\Traits\ChangelogBehaviorTrait;
use \App\Lib\Traits\CoLinkTrait;
use \App\Lib\Traits\LayoutTrait;
use \App\Lib\Traits\PermissionsTrait;
use \App\Lib\Traits\PluggableModelTrait;
use \App\Lib\Traits\PrimaryLinkTrait;
Expand Down
6 changes: 3 additions & 3 deletions app/src/Model/Table/ExternalIdentityRolesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ class ExternalIdentityRolesTable extends Table {
use \App\Lib\Traits\PermissionsTrait;
use \App\Lib\Traits\PrimaryLinkTrait;
use \App\Lib\Traits\QueryModificationTrait;
use \App\Lib\Traits\TableMetaTrait;
use \App\Lib\Traits\ValidationTrait;
use \App\Lib\Traits\SearchFilterTrait;
use \App\Lib\Traits\TabTrait;
use \App\Lib\Traits\TableMetaTrait;
use \App\Lib\Traits\ValidationTrait;

/**
* Perform Cake Model initialization.
Expand Down Expand Up @@ -91,7 +91,7 @@ public function initialize(array $config): void {
->setDependent(true)
->setCascadeCallbacks(true);

$this->setDisplayField('id');
$this->setDisplayField('title');

$this->setPrimaryLink('external_identity_id');
$this->setRequiresCO(true);
Expand Down
2 changes: 1 addition & 1 deletion app/src/Model/Table/PersonRolesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function initialize(array $config): void {
// render in index mode for the same use case/context
// XXX edit should go first.
'People' => ['edit', 'view'],
'PersonRoles' => ['edit','view','index'],
'PersonRoles' => ['edit', 'view', 'index'],
'ExternalIdentities' => ['index'],
],
// What model will have a counter-badge after the tab title
Expand Down
Loading

0 comments on commit c40380f

Please sign in to comment.