Skip to content

Commit

Permalink
Remove spin.js and convert spinner to css animation; make spinner act… (
Browse files Browse the repository at this point in the history
#13, CO-2133)

* Remove spin.js and convert spinner to css animation; make spinner active on all links and buttons except those marked with the .nospin class; create page for matchgrid configuration; update breadcrumbs for configuration page; fix user profile dropdown (CO-2133)

* Remove the deprecated spin.js library (CO-2133)

* Color table heading links appropriately; remove extra print statement from filter buttons (NOJIRA / CO-2133)

* Link ID column of Matchgrid Records to edit/view for the record. Update the "link" column type to include the matchgrid_id when present. (CO-2133)

* Display matchgrid description (if present) on Manage matchgrid view. (CO-2133)

* Revert change to index.ctp for "link" column type. (CO-2133)

Co-authored-by: benno <benno@sphericalcowgroup.com>
  • Loading branch information
arlen and benno authored Sep 30, 2021
1 parent 119a4b5 commit 0ff7513
Show file tree
Hide file tree
Showing 20 changed files with 297 additions and 184 deletions.
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 @@ -536,6 +536,9 @@ msgstr "Clear"
msgid "match.op.clear.filters"
msgstr "{0,plural,=1{Clear Filter} other{Clear Filters}}"

msgid "match.op.configure"
msgstr "Configure"

msgid "match.op.configure.a"
msgstr "Configure {0}"

Expand Down
14 changes: 13 additions & 1 deletion app/src/Controller/MatchgridsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MatchgridsController extends StandardController {
public function beforeFilter(EventInterface $event) {
// Only certain actions require a matchgrid ID
if(in_array($this->request->getParam('action'),
['build', 'manage', 'pending', 'reconcile'])) {
['build', 'manage', 'configure', 'pending', 'reconcile'])) {
$this->Matchgrids->setRequiresMatchgrid(true);
}

Expand Down Expand Up @@ -102,6 +102,7 @@ public function isAuthorized(Array $user) {
'edit' => $platformAdmin,
'index' => $platformAdmin,
'manage' => $platformAdmin || $mgAdmin,
'configure' => $platformAdmin || $mgAdmin,
'pending' => $platformAdmin || $mgAdmin || $recMgr,
'reconcile' => $platformAdmin || $mgAdmin || $recMgr,
// We allow anyone to access select since we don't have a matchgrid context yet.
Expand All @@ -124,6 +125,17 @@ public function isAuthorized(Array $user) {
public function manage(string $id) {
$this->set('vv_title', __('match.op.manage.a', [$this->cur_mg->table_name]));
}

/**
* Configure a matchgrid. This is an index of items to configure for the matchgrid.
*
* @since COmanage Match v1.0.0
* @param String $id Matchgrid ID
*/

public function configure(string $id) {
$this->set('vv_title', __('match.op.configure.a', [$this->cur_mg->table_name]));
}

/**
* Display the set of pending requests.
Expand Down
2 changes: 1 addition & 1 deletion app/src/Model/Table/MatchgridsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function initialize(array $config): void {
]
]);

$this->setAllowLookupPrimaryLink(['build', 'manage', 'pending', 'reconcile']);
$this->setAllowLookupPrimaryLink(['build', 'manage', 'configure', 'pending', 'reconcile']);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/templates/MatchgridRecords/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ $enableSearch = true;
// force the model's table only to the one associated with the matchgrid
$indexColumns = [
'id' => [
'type' => 'echo',
'type' => 'link',
'sortable' => true
],
'sor' => [
Expand Down
116 changes: 116 additions & 0 deletions app/templates/Matchgrids/configure.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<?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);
?>
<div class="titleNavContainer">
<div class="pageTitle">
<h1><?= $vv_title; ?></h1>
</div>
</div>

<section class="inner-content">
<!-- Matchgrid Configuration -->
<?php
// Determining whether to render the configuration block is a bit tricky,
// basically we have to see if the user has any appropriate permission.
// This will generally be all-or-nothing, but that could change over time.

$renderConfig = false;

if(!empty($vv_cur_mg)) {
// Matchgrid specific models

$models = [
'matchgrid_settings' => 'settings',
'api_users' => 'vpn_key',
'attributes' => 'edit',
'attribute_groups' => 'storage',
'attribute_maps' => 'swap_horiz',
'rules' => 'assignment',
'systems_of_record' => 'gavel',
];

// We'll get most users simply by checking for build permission
$renderConfig = $vv_permissions['build'];

if(!$renderConfig) {
foreach(array_keys($models) as $m) {
if(isset($vv_menu_permissions[$m]) && $vv_menu_permissions[$m]===true) {
$renderConfig = true;
break;
}
}
}
}
?>
<?php if($renderConfig): ?>
<ul id="matchgrid-config-menu">
<?php
foreach($models as $model => $icon) {
if($vv_menu_permissions[$model]) {
print '<li>';

$linkContent = '<em class="material-icons" aria-hidden="true">' . $icon . '</em><span class="menu-title">'
. __('match.ct.'.\Cake\Utility\Inflector::camelize($model), [99])
. '</span>';

print $this->Html->link(
$linkContent,
['plugin' => null,
'controller' => $model,
'action' => 'index',
'?' => ['matchgrid_id' => $vv_cur_mg->id]],
['escape' => false]
);

print '</li>';
}
}

if($vv_permissions['build']) {
print '<li>';

$linkContent = '<em class="material-icons" aria-hidden="true">build</em><span class="menu-title">'
. __('match.op.build')
. '</span>';

print $this->Html->link(
$linkContent,
['controller' => 'Matchgrids',
'action' => 'build',
$vv_cur_mg->id],
['escape' => false,
'class' => 'nospin',
'confirm' => __('match.op.build.confirm')]
);
print '</li>';
}
?>
</ul>
<?php endif; // $renderConfig ?>
</section>
86 changes: 6 additions & 80 deletions app/templates/Matchgrids/manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
</div>

<section class="inner-content">
<?php if(!empty($vv_cur_mg->description)): ?>
<p class="matchgrid-description">
<?= $vv_cur_mg->description; ?>
</p>
<?php endif; ?>

<!-- Matchgrid Management -->
<div id="matchgrid-management" class="call-to-action-blocks">
<div class="call-to-action">
Expand All @@ -56,84 +62,4 @@
<div class="call-to-action-text"><?= __('match.in.matchgrid.reconcile'); ?></div>
</div>
</div>

<!-- Matchgrid Configuration -->
<?php
// Determining whether to render the configuration block is a bit tricky,
// basically we have to see if the user has any appropriate permission.
// This will generally be all-or-nothing, but that could change over time.

$renderConfig = false;

if(!empty($vv_cur_mg)) {
// Matchgrid specific models

$models = [
'matchgrid_settings' => 'settings',
'api_users' => 'vpn_key',
'attributes' => 'edit',
'attribute_groups' => 'storage',
'attribute_maps' => 'swap_horiz',
'rules' => 'assignment',
'systems_of_record' => 'gavel',
];

// We'll get most users simply by checking for build permission
$renderConfig = $vv_permissions['build'];

if(!$renderConfig) {
foreach(array_keys($models) as $m) {
if(isset($vv_menu_permissions[$m]) && $vv_menu_permissions[$m]===true) {
$renderConfig = true;
break;
}
}
}
}
?>
<?php if($renderConfig): ?>
<h2><?= __('match.ti.matchgrid.config'); ?></h2>
<ul id="matchgrid-config-menu">
<?php
foreach($models as $model => $icon) {
if($vv_menu_permissions[$model]) {
print '<li>';

$linkContent = '<em class="material-icons" aria-hidden="true">' . $icon . '</em><span class="menu-title">'
. __('match.ct.'.\Cake\Utility\Inflector::camelize($model), [99])
. '</span>';

print $this->Html->link(
$linkContent,
['plugin' => null,
'controller' => $model,
'action' => 'index',
'?' => ['matchgrid_id' => $vv_cur_mg->id]
],
['escape' => false]
);

print '</li>';
}
}

if($vv_permissions['build']) {
print '<li>';

$linkContent = '<em class="material-icons" aria-hidden="true">build</em><span class="menu-title">'
. __('match.op.build')
. '</span>';

print $this->Html->link(
$linkContent,
['controller' => 'Matchgrids',
'action' => 'build',
$vv_cur_mg->id],
['escape' => false,'confirm' => __('match.op.build.confirm')]
);
print '</li>';
}
?>
</ul>
<?php endif; // $renderConfig ?>
</section>
2 changes: 1 addition & 1 deletion app/templates/Matchgrids/reconcile.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
'referenceid' => (!empty($c['referenceid']) ? $c['referenceid'] : 'new')
],
'confirm' => __('match.op.assign.confirm'),
'class' => 'btn btn-primary']);
'class' => 'btn btn-primary nospin']);
?>
</td>
<?php endforeach; ?>
Expand Down
12 changes: 0 additions & 12 deletions app/templates/Matchgrids/select.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
<div class="co-grid-header row">
<div class="col"><?= __('match.ct.Matchgrids', [1]) ?></div>
<div class="col"><?= __('match.fd.description') ?></div>
<div class="col col-md-2"><?= __('match.fd.action') ?></div>
</div>
<?php foreach($vv_matchgrids as $mg): ?>
<?php
Expand Down Expand Up @@ -76,17 +75,6 @@
</div>
<div class="col">
<?= filter_var($mg['description'], FILTER_SANITIZE_SPECIAL_CHARS); ?>
</div>
<div class="col col-md-2">
<?php
if($canManageGrid) {
print $this->Html->link(__('match.op.manage'),
['controller' => 'Matchgrids',
'action' => 'manage',
$mg['id']],
['class' => 'btn btn-primary btn-sm']);
}
?>
</div>
</div>
<?php endforeach; // vv_matchgrids ?>
Expand Down
6 changes: 3 additions & 3 deletions app/templates/Standard/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ function _column_key($modelsName, $c, $tz=null) {
foreach($linkActions as $a) {
// Does this user have permission for this action?
if($vv_permissions[$a]) {
print $this->Html->link($label, ['action' => $a, $entity->id]);
print $this->Html->link($label, ['action' => $a, $entity->id]);
$linked = true;
break 2;
}
Expand Down Expand Up @@ -306,7 +306,7 @@ function _column_key($modelsName, $c, $tz=null) {
array_merge_recursive(['action' => 'delete'], $linkArgs),
// XXX should be configurable which field we put in, maybe displayField?
['confirm' => __($product.'.op.delete.confirm', [$entity->id]),
'class' => 'deletebutton']
'class' => 'deletebutton nospin']
);
}

Expand All @@ -329,7 +329,7 @@ function _column_key($modelsName, $c, $tz=null) {
array_merge_recursive(['action' => $a['action']], $linkArgs),
// XXX should be configurable which field we put in, maybe displayField?
['confirm' => __($confirmKey, [$entity->id]),
'class' => $a['class']]
'class' => $a['class'] . ' nospin']
);
} elseif(!empty($a['controller'])) {
// We're linking into a related controller
Expand Down
Loading

0 comments on commit 0ff7513

Please sign in to comment.