From 049ad5eca762022bf51d3e08e8586056c90fc2a8 Mon Sep 17 00:00:00 2001 From: Arlen Johnson Date: Tue, 16 Jun 2020 00:01:09 -0400 Subject: [PATCH] Improve breadcrumbs for Reconciliation view (CO-1839) and generally --- app/src/Locale/en_US/default.po | 4 +++ app/src/Template/Element/breadcrumbs.ctp | 36 +++++++++++++++++++----- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/app/src/Locale/en_US/default.po b/app/src/Locale/en_US/default.po index 034457bd9..24393629d 100644 --- a/app/src/Locale/en_US/default.po +++ b/app/src/Locale/en_US/default.po @@ -132,6 +132,10 @@ msgstr "{0,plural,=1{System of Record} other{Systems of Record}}" msgid "match.ct.Rules" msgstr "{0,plural,=1{Rule} other{Rules}}" +### Actions +msgid "match.ac.PendingRequests" +msgstr "{0,plural,=1{Pending Request} other{Pending Requests}}" + ### Enumerations msgid "match.en.ConfidenceModeEnum.C" msgstr "Canonical" diff --git a/app/src/Template/Element/breadcrumbs.ctp b/app/src/Template/Element/breadcrumbs.ctp index 9832c1c2b..e7f33be00 100644 --- a/app/src/Template/Element/breadcrumbs.ctp +++ b/app/src/Template/Element/breadcrumbs.ctp @@ -46,8 +46,18 @@ if($this->request->getRequestTarget(false) != '/') { ['controller' => 'matchgrids', 'action' => 'select'] ); - - if(!empty($vv_cur_mg) + + if($modelsName != 'Matchgrids' && $modelsName != 'Permissions' && $modelsName != 'ApiUsers' + || ($modelsName == 'Matchgrids' && ($action == 'reconcile' || $action == 'pending'))) { + // Link to matchgrids listing where appropriate + $this->Breadcrumbs->add( + __('match.ct.Matchgrids', [99]), + ['controller' => 'matchgrids', + 'action' => 'index' ] + ); + } + + if(!empty($vv_cur_mg) && ($modelsName != 'Matchgrids' || $action != 'manage')) { // Link to matchgrid if set $this->Breadcrumbs->add( @@ -57,7 +67,7 @@ if($this->request->getRequestTarget(false) != '/') { $vv_cur_mg->id ] ); } - + if(!empty($vv_primary_link_obj) && !empty($vv_primary_link_model) && $vv_primary_link_model != 'Matchgrids') { @@ -84,9 +94,11 @@ if($this->request->getRequestTarget(false) != '/') { } if($action != 'index' - && ($modelsName != 'Matchgrids' && $action != 'pending')) { + && !($modelsName == 'Matchgrids' && $action == 'pending')) { + // Default parent is index, to which we might need to append the Primary Link ID - + $crumbLinkText = 'match.ct.'.$modelsName; + $target = [ 'controller' => Inflector::dasherize($modelsName), 'action' => 'index' @@ -95,9 +107,19 @@ if($this->request->getRequestTarget(false) != '/') { if(!empty($vv_primary_link) && !empty($vv_primary_link_obj->id)) { $target[$vv_primary_link] = $vv_primary_link_obj->id; } - + + // Non-index special cases + if ($modelsName == 'Matchgrids' && $action == 'reconcile') { + $crumbLinkText = 'match.ac.PendingRequests'; + $target = [ + 'controller' => Inflector::dasherize($modelsName), + 'action' => 'pending', + $vv_cur_mg->id // will always be set for reconcile + ]; + } + $this->Breadcrumbs->add( - __('match.ct.'.$modelsName, [99]), + __($crumbLinkText, [99]), $target ); }