Skip to content

Commit

Permalink
Layout Improvements for Match Reconciliation view (CO-1838). Signific…
Browse files Browse the repository at this point in the history
…ant cleanup of CSS and JavaScript files to remove legacy markup from Registry. Ensure topbox layout is consistent across views.
  • Loading branch information
arlen committed Dec 5, 2019
1 parent 552509e commit 715ac35
Show file tree
Hide file tree
Showing 9 changed files with 162 additions and 1,353 deletions.
7 changes: 5 additions & 2 deletions app/src/Locale/en_US/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ msgstr "Permission"
msgid "match.fd.query"
msgstr "Query"

msgid "match.fd.referenceid"
msgstr "Reference ID"
msgid "match.fd.referenceids"
msgstr "Reference IDs"

msgid "match.fd.referenceid_method"
msgstr "Reference ID Assignment Method"
Expand Down Expand Up @@ -434,6 +434,9 @@ msgstr "Platform"
msgid "match.op.add.a"
msgstr "Add New {0}"

msgid "match.op.assign.confirm"
msgstr "Are you sure you wish to assign this Reference ID?"

msgid "match.op.AttributeMappings.install.nicknames.en"
msgstr "Install English Nicknames"

Expand Down
15 changes: 2 additions & 13 deletions app/src/Template/Element/javascript.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,6 @@
// END DESKTOP MENU DRAWER BEHAVIOR

// USER MENU BEHAVIORS
// Toggle the global search box
$("#global-search label").click(function (e) {
e.stopPropagation();
if ($("#global-search-box").is(":visible")) {
$("#global-search-box").hide();
$("#global-search-box").attr("aria-expanded","false");
} else {
$("#global-search-box").show();
$("#global-search-box").attr("aria-expanded","true");
}
});

// Toggle the custom user panel in the user menu
$("#user-panel-toggle").click(function(e) {
Expand All @@ -129,8 +118,8 @@

// Hide custom user menu items on click outside
$(document).on('click', function (e) {
if ($(e.target).closest("#user-panel, #global-search-box").length === 0) {
$("#user-panel, #global-search-box").hide();
if ($(e.target).closest("#user-panel").length === 0) {
$("#user-panel").hide();
}
});

Expand Down
2 changes: 1 addition & 1 deletion app/src/Template/Layout/default.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ if(isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'M
</div>

<header id="banner">
<div id="collaborationTitle">
<div id="siteTitle">
<?= $this->Html->link(__('match.meta.match'),'/'); ?>
</div>

Expand Down
2 changes: 1 addition & 1 deletion app/src/Template/Matchgrids/manage.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ declare(strict_types = 1);

<!-- Matchgrid Management Menu -->
<section class="inner-content">
<ul id="configuration-menu" class="three-col">
<ul id="matchgrid-management">
<?php if($vv_permissions['build']): ?>
<li>
<em class="material-icons" aria-hidden="true">check_circle</em>
Expand Down
121 changes: 83 additions & 38 deletions app/src/Template/Matchgrids/reconcile.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,41 @@
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

declare(strict_types = 1);
declare(strict_types = 1);

// extract the attribute field names into a simple array
$fieldNames = array();
foreach ($vv_candidates as $candidate) {
$fieldNames = array_keys($candidate);
break;
}

// remove "referenceid" - it is given special treatment and should not be included in our structure
array_splice($fieldNames, array_search('referenceid',$fieldNames), 1);

// build the data for the candidates into a structure for generating the view:
// attribute field name | attribute values | do the values match?
$canAttr = array();
for($i = 0; $i < count($fieldNames); $i++) {

// put the field name in the first column
$canAttr[$i][0] = $fieldNames[$i];

// put all the values for the current attribute into the second column
$canAttr[$i][1] = array();
foreach($vv_candidates as $c) {
foreach($c as $key => $val) {
if($key == $fieldNames[$i]) {
$canAttr[$i][1][] = $val;
}
}
}

// Test for content and equality between the row's attribute values and
// set the third "match?" column to true (1) if non-empty equality found
$canAttr[$i][2] = !empty($canAttr[$i][1][0]) && count(array_unique($canAttr[$i][1])) === 1 ? 1 : 0;

}
?>

<div class="titleNavContainer">
Expand All @@ -34,40 +68,51 @@ declare(strict_types = 1);
</div>
</div>

<table>
<tr>
<th><?= __('match.fd.referenceid'); ?></th>
<th><?= __('match.ct.attributes', [99]); ?></th>
<th><?= __('match.fd.action'); ?></th>
</tr>
<?php foreach($vv_candidates as $c): ?>
<tr>
<td>
<?= (!empty($c['referenceid']) ? $c['referenceid'] : __('match.op.new')); ?>
</td>
<td>
<ul>
<?php
foreach($c as $k => $v) {
print "<li><b>" . $k . "</b>: " . $v . "</li>";
}
?>
</ul>
</td>
<td>
<?=
$this->Form->postLink(__('match.op.reconcile.assign'),
['action' => 'reconcile',
$vv_cur_mg->id],
['data' => [
'rowid' => $vv_request['id'],
// Default value needs to be the literal string "new" and not a localized text string
'referenceid' => (!empty($c['referenceid']) ? $c['referenceid'] : 'new')
],
'confirm' => 'Are you sure?', // XXX better text
'class' => 'linkbutton']);
?>
</td>
</tr>
<?php endforeach; // $vv_candidates ?>
</table>

<table id="reconcile-table" class="side-by-side">
<tbody>
<tr>
<td class="empty"></td>
<th class="strong-header" colspan="<?= count($vv_candidates); ?>">
<h2><?= __('match.fd.referenceids'); ?></h2>
</th>
</tr>
<tr>
<td class="empty"></td>
<?php foreach($vv_candidates as $c): ?>
<th class="reference-ids">
<?= (!empty($c['referenceid']) ? '<a href="#" title="' . $c['referenceid'] . '">' . substr($c['referenceid'],0,7) . '</a>...' : __('match.op.new')); ?>
</th>
<?php endforeach; ?>
</tr>
<tr>
<th class="strong-header"><h2><?= __('match.ct.attributes', [99]); ?></h2></th>
<?php foreach($vv_candidates as $c): ?>
<th>
<?=
$this->Form->postLink(__('match.op.reconcile.assign'),
['action' => 'reconcile',
$vv_cur_mg->id],
['data' => [
'rowid' => $vv_request['id'],
// Default value needs to be the literal string "new" and not a localized text string
'referenceid' => (!empty($c['referenceid']) ? $c['referenceid'] : 'new')
],
'confirm' => __('match.op.assign.confirm'),
'class' => 'linkbutton']);
?>
</th>
<?php endforeach; ?>
</tr>

<?php for($i = 0; $i < count($canAttr); $i++): ?>
<?php $matchClass = $canAttr[$i][2] ? ' class="match"' : ''; ?>
<tr<?= $matchClass ?>>
<td class="attr-title"><?= $canAttr[$i][0] ?></td>
<?php foreach($canAttr[$i][1] as $key => $val): ?>
<td><?= $val; ?></td>
<?php endforeach; ?>
</tr>
<?php endfor; ?>
</tbody>
</table>
19 changes: 11 additions & 8 deletions app/src/Template/Standard/add-edit-view.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,22 @@ $tableName = \Cake\Utility\Inflector::tableize($this->name);
<h1><?= $vv_title; ?></h1>
</div>
</div>

<?php
// XXX this doesn't work yet because we don't include fields.inc until later
// either create a second file to include earlier, or use a function to emit
// the fields (which would be more consistent with how Views render...)
if(!empty($banners)) {
foreach($banners as $b): ?>
<div class="co-info-topbox">
<em class="material-icons">info</em>
<?php print $b; ?>
</div>
<?php endforeach; // $banners
}
?>
<?php if(!empty($banners)): ?>
<?php foreach($banners as $b): ?>
<div class="co-info-topbox">
<em class="material-icons">info</em>
<?php print $b; ?>
</div>
<?php endforeach; // $banners ?>
<?php endif; // $banners ?>


<?php
if($action == 'add' || $action == 'edit') {
// By default, the form will POST to the current controller
Expand Down
33 changes: 16 additions & 17 deletions app/src/Template/Standard/index.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,6 @@ function _column_key($modelsName, $c, $tz=null) {
<h1><?= $vv_title; ?></h1>
</div>

<?php
if(!empty($banners)) {
foreach($banners as $b): ?>
<div class="co-info-topbox">
<em class="material-icons">info</em>
<?php print $b; ?>
</div>
<?php endforeach; // $banners
}
?>

<?php if($vv_permissions['add']): ?>
<ul id="topLinks">
<li>
Expand All @@ -134,13 +123,23 @@ function _column_key($modelsName, $c, $tz=null) {
<?php endif; ?>
</div>
<?php if(!empty($indexBanners)): ?>
<?php foreach($indexBanners as $b): ?>
<div class="co-info-topbox">
<em class="material-icons">info</em>
<?php print $b; ?>
</div>
<?php endforeach; // $indexBanners ?>
<?php foreach($indexBanners as $b): ?>
<div class="co-info-topbox">
<em class="material-icons">info</em>
<?php print $b; ?>
</div>
<?php endforeach; // $indexBanners ?>
<?php endif; // $indexBanners ?>

<?php if(!empty($banners)): ?>
<?php foreach($banners as $b): ?>
<div class="co-info-topbox">
<em class="material-icons">info</em>
<?php print $b; ?>
</div>
<?php endforeach; // $banners ?>
<?php endif; // $banners ?>

<div class="table-container">
<table id="<?= $tableName . '-table'; ?>">
<tr>
Expand Down
Loading

0 comments on commit 715ac35

Please sign in to comment.