Skip to content

Improve access to related models (CO-2229) #57

Merged
merged 3 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/resources/locales/en_US/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -810,3 +810,6 @@ msgstr "Matchgrid Configuration"

msgid "match.ti.matchgrid"
msgstr "Matchgrid: {0}"

msgid "match.ti.properties"
msgstr "Properties"
96 changes: 96 additions & 0 deletions app/src/View/Helper/AlertHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?php
/**
* COmanage Match Alert Helper
*
* 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 Match v1.1.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

declare(strict_types=1);

namespace App\View\Helper;

use \Cake\View\Helper;
use phpDocumentor\Reflection\Types\Boolean;

/**
* Helper which will produce Bootstrap based alert
*
* @param string $message Alert message
* @param string $type Define the type of Alert. The value should be one of
* [success,warning,danger,info]. Defaults to 'warning'
* @param boolean $dismissable Can the Alert be dismissed? Defaults to false.
* @param string|null $title Title to display (typically "Success", "Error", or "Warning"). Defaults to null.
* @param boolean $dis_text_dark Disable dark-text fonts for light|info color mode.
* @return mixed - a constructed HTML block
* @since COmanage Registry v5.0.0
*/
class AlertHelper extends Helper {

public $helpers = ['Html'];

public function alert(
string $message,
string $type = 'warning',
bool $dismissable = false,
string $title = null ) {

$closeButton = '';
$dismissableClass = '';
if($dismissable) {
$closeButton = '
<span class="alert-button">
<button type="button" class="btn-close nospin" data-bs-dismiss="alert" aria-label="Close"></button>
</span>
';
$dismissableClass = ' alert-dismissible';
}

$titleMarkup = '';
if(!empty($title)) {
$titleMarkup = '<span class="alert-title-text">' . $title . '</span>';
}

return '
<div class="alert alert-' . $type . $dismissableClass . ' co-alert" role="alert">
<div class="alert-body d-flex align-items-center">
<span class="alert-title d-flex align-items-center">
' . $this->getAlertIcon($type) . $titleMarkup . '
</span>
<span class="alert-message">
' . $message . '
</span>
' . $closeButton . '
</div>
</div>
';
}

public function getAlertIcon(string $type) {
switch($type) {
case('success'): return '<span class="material-icons-outlined alert-icon">check_circle</span>';
case('info'): return '<span class="material-icons-outlined alert-icon">info</span>';
default: return '<span class="material-icons-outlined alert-icon">report_problem</span>';
}
}

}
5 changes: 5 additions & 0 deletions app/templates/AttributeMappings/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,9 @@ $topLinks = [
'icon' => 'file_download',
'label' => __('match.op.AttributeMappings.install.nicknames.en')
]
];

$subnav = [
'name' => 'attribute_map',
'active' => 'mappings'
];
34 changes: 34 additions & 0 deletions app/templates/AttributeMappings/fields-nav.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* COmanage Match Attribute Mappings 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 Match v1.1.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

// XXX: If fields.inc can become configuration only, move the contents of this file into fields.inc
$topLinks = [];

$subnav = [
'name' => 'attribute_map',
'active' => 'mappings'
];
34 changes: 34 additions & 0 deletions app/templates/AttributeMaps/fields-nav.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* COmanage Match Attribute Maps 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 Match v1.1.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

// XXX: If fields.inc can become configuration only, move the contents of this file into fields.inc
$topLinks = [];

$subnav = [
'name' => 'attribute_map',
'active' => 'properties'
];
68 changes: 40 additions & 28 deletions app/templates/Matchgrids/configure.php
Original file line number Diff line number Diff line change
@@ -1,38 +1,50 @@
<?php
/**
* COmanage Match Matchgrid Configure Template
*
* 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 http://www.internet2.edu/comanage COmanage Project
* @package match
* @since COmanage Match v1.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

declare(strict_types = 1);
/**
* COmanage Match Matchgrid Configure Template
*
* 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 http://www.internet2.edu/comanage COmanage Project
* @package match
* @since COmanage Match v1.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

declare(strict_types = 1);

// $flashArgs pass banner messages to the flash element container
$flashArgs = [];
if(!empty($indexBanners)) {
$flashArgs['vv_index_banners'] = $indexBanners;
}
if(!empty($banners)) {
$flashArgs['vv_banners'] = $banners;
}
?>
<div class="titleNavContainer">

<div class="pageTitleContainer">
<div class="pageTitle">
<h1><?= $vv_title; ?></h1>
</div>
</div>

<?= $this->element('flash', $flashArgs); ?>

<?= __('match.meta.version', [chop(file_get_contents(CONFIG . DS . "VERSION"))]); ?>

<section class="inner-content">
Expand Down
2 changes: 1 addition & 1 deletion app/templates/Matchgrids/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
declare(strict_types = 1);

?>
<div class="titleNavContainer">
<div class="pageTitleContainer">
<div class="pageTitle">
<h1><?= $vv_title; ?></h1>
</div>
Expand Down
13 changes: 12 additions & 1 deletion app/templates/Matchgrids/manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,17 @@
*/

declare(strict_types = 1);

// $flashArgs pass banner messages to the flash element container
$flashArgs = [];
if(!empty($indexBanners)) {
$flashArgs['vv_index_banners'] = $indexBanners;
}
if(!empty($banners)) {
$flashArgs['vv_banners'] = $banners;
}
?>
<div class="titleNavContainer">
<div class="pageTitleContainer">
<div class="pageTitle">
<h1><?= $vv_title; ?></h1>
</div>
Expand Down Expand Up @@ -63,6 +72,8 @@
</p>
<?php endif; ?>

<?= $this->element('flash', $flashArgs); ?>

<!-- Matchgrid Management -->
<div id="matchgrid-management" class="call-to-action-blocks">
<div class="call-to-action">
Expand Down
13 changes: 12 additions & 1 deletion app/templates/Matchgrids/pending.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,25 @@
*/

declare(strict_types = 1);

// $flashArgs pass banner messages to the flash element container
$flashArgs = [];
if(!empty($indexBanners)) {
$flashArgs['vv_index_banners'] = $indexBanners;
}
if(!empty($banners)) {
$flashArgs['vv_banners'] = $banners;
}
?>

<div class="titleNavContainer">
<div class="pageTitleContainer">
<div class="pageTitle">
<h1><?= $vv_title; ?></h1>
</div>
</div>

<?= $this->element('flash', $flashArgs); ?>

<h2><?= __('match.rs.pending', [count($vv_pending)]); ?></h2>

<table>
Expand Down
12 changes: 11 additions & 1 deletion app/templates/Matchgrids/reconcile.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,23 @@
}
}
$canAttr = array_merge($canAttr, $tempArr);

// $flashArgs pass banner messages to the flash element container
$flashArgs = [];
if(!empty($indexBanners)) {
$flashArgs['vv_index_banners'] = $indexBanners;
}
if(!empty($banners)) {
$flashArgs['vv_banners'] = $banners;
}
?>

<div class="titleNavContainer">
<div class="pageTitleContainer">
<div class="pageTitle">
<h1><?= __('match.op.reconcile.requests'); ?></h1>
</div>
</div>
<?= $this->element('flash', $flashArgs); ?>
<div class="view-controls">
<span class="view-controls-title"><?= __('match.op.highlight'); ?></span>
<div class="form-check form-check-inline">
Expand Down
2 changes: 1 addition & 1 deletion app/templates/Matchgrids/select.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

use \App\Lib\Enum\PermissionEnum;
?>
<div class="titleNavContainer">
<div class="pageTitleContainer">
<div class="pageTitle">
<h1><?= $vv_title; ?></h1>
</div>
Expand Down
5 changes: 5 additions & 0 deletions app/templates/RuleAttributes/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,9 @@ $indexColumns = [
'class' => 'SearchTypeEnum',
'sortable' => true
]
];

$subnav = [
'name' => 'rule',
'active' => 'attributes'
];
Loading