From 9ced7368dd70d50013ce54e3297510cf523fc8e4 Mon Sep 17 00:00:00 2001 From: Arlen Johnson Date: Tue, 19 Nov 2024 16:37:11 -0500 Subject: [PATCH 1/7] Add special "Start" and "Copy" (flow url) buttons to Enrollment Flow configuration views (CFM-428) --- .../EnrollmentAttributes/columns.inc | 1 + app/resources/locales/en_US/operation.po | 3 ++ app/templates/EnrollmentFlows/fields-nav.inc | 42 ------------------ .../element/subnavigation/navBar.php | 43 +++++++++++++++++++ app/webroot/css/co-base.css | 10 ++++- app/webroot/js/comanage/comanage.js | 32 ++++++++++++++ 6 files changed, 88 insertions(+), 43 deletions(-) delete mode 100644 app/templates/EnrollmentFlows/fields-nav.inc diff --git a/app/plugins/CoreEnroller/templates/EnrollmentAttributes/columns.inc b/app/plugins/CoreEnroller/templates/EnrollmentAttributes/columns.inc index 8281f4cb9..26fcceba5 100644 --- a/app/plugins/CoreEnroller/templates/EnrollmentAttributes/columns.inc +++ b/app/plugins/CoreEnroller/templates/EnrollmentAttributes/columns.inc @@ -91,6 +91,7 @@ $action_args['vv_attr_id'] = $vv_user['username']; $action_args['vv_actions_type'] = 'mvea-add-menu'; $action_args['vv_actions_title'] = __d('operation', 'add.attribute'); $action_args['vv_actions_icon'] = 'add_circle'; +$action_args['vv_actions_icon_class'] = 'material-symbols-outlined'; $action_args['vv_actions_class'] = 'mvea-add-menu'; $actionOrderDefault = $this->Menu->getMenuOrder('Default'); foreach ($attributes as $attr => $hr_name) { diff --git a/app/resources/locales/en_US/operation.po b/app/resources/locales/en_US/operation.po index f28b3fd72..1bcc9824a 100644 --- a/app/resources/locales/en_US/operation.po +++ b/app/resources/locales/en_US/operation.po @@ -117,6 +117,9 @@ msgstr "Continue" msgid "copy" msgstr "Copy" +msgid "copy.flowUrl" +msgstr "Copy Enrollment Flow URL" + msgid "copy.value" msgstr "Copy value" diff --git a/app/templates/EnrollmentFlows/fields-nav.inc b/app/templates/EnrollmentFlows/fields-nav.inc deleted file mode 100644 index 7e551480d..000000000 --- a/app/templates/EnrollmentFlows/fields-nav.inc +++ /dev/null @@ -1,42 +0,0 @@ - 'play_arrow', - 'order' => 'Default', - 'label' => __d('operation', 'EnrollmentFlows.start'), - 'link' => [ - 'action' => 'start', - $vv_obj->id - ], - 'class' => '' -]; - -$subnav = [ - 'name' => 'enrollment_flow', - 'active' => 'properties' -]; \ No newline at end of file diff --git a/app/templates/element/subnavigation/navBar.php b/app/templates/element/subnavigation/navBar.php index 7f39ee922..5ce0609ed 100644 --- a/app/templates/element/subnavigation/navBar.php +++ b/app/templates/element/subnavigation/navBar.php @@ -52,6 +52,49 @@ element('subnavigation/supertitle') ?> element('subnavigation/statusBadge') ?> + + id; + if($vv_controller != 'EnrollmentFlows') { + $enrollmentFlowId = $vv_primary_link_obj->id; + } + + $startButtonUrl = $this->Url->build( + ['controller' => 'enrollment_flows', + 'action' => 'start', + $enrollmentFlowId + ], + ['fullBase' => true] + ); + ?> +
+ + play_arrow + + + + +
+ diff --git a/app/webroot/css/co-base.css b/app/webroot/css/co-base.css index 05012797f..2873ba849 100644 --- a/app/webroot/css/co-base.css +++ b/app/webroot/css/co-base.css @@ -26,7 +26,6 @@ /* HTML, BODY, HEADINGS, ANCHORS, FONTS */ @import url("fonts/opensans/stylesheet.css"); -@import url("fonts.material-symbols.material-symbols.css"); @import url("fonts/material-symbols/stylesheet.css"); html * { @@ -1781,6 +1780,15 @@ li[data-pc-section="emptymessage"] { color: var(--cmg-color-txt-soft); background-color: unset; } +/* ENROLLMENT FLOWS */ +.enrollment-flow-top-buttons { + display: flex; + gap: 0.5em; + font-size: 0.9em; +} +.enrollment-flow-top-buttons a { + padding: 0.5em 1em; +} /* ENROLLMENT FLOWS: ATTRIBUTE COLLECTOR */ body.attributecollectors main, body.basicattributecollectors main { diff --git a/app/webroot/js/comanage/comanage.js b/app/webroot/js/comanage/comanage.js index 2d599837c..5a8e48086 100644 --- a/app/webroot/js/comanage/comanage.js +++ b/app/webroot/js/comanage/comanage.js @@ -270,6 +270,38 @@ function clearTopSearch(formObj) { formObj.submit(); } +/** + * COmanage Registry Copy to Clipboard (for static, non-vuejs buttons) + * @param val {string} String to copy + * @param clickedObj {object} DOM object clicked, typically a button containing both text and an icon + * @param copyTxt {string} aria-label describing what to copy + * @param successTxt {string} aria-label success message after copy + * @param errorTxt {string} error message if browser can't copy + */ +async function copyValStatic( + val, + clickedObj, + copyTxt, + successTxt, + errorTxt +) { + try { + // remove extra white spaces and trim the value + let valWithNormalizedSpaces = val.replace(/\s+/g, ' ').trim(); + // copy to clipboard + await navigator.clipboard.writeText(valWithNormalizedSpaces); + // provide feedback + $(clickedObj).find('em').text('thumb_up'); + $(clickedObj).attr('aria-label', successTxt); + // reset feedback + setTimeout(() => $(clickedObj).find('em').text('content_copy'), 1200); + setTimeout(() => $(clickedObj).attr('aria-label', copyTxt), 3000); + } catch($e) { + // this will be rendered if browser is not on HTTPS + alert(errorTxt + "\n" + $e); + } +} + /** * COmanage Registry API AJAX Calls: general function for making an ajax call to Registry API v.2 * @param url {string} API Url From 17af5a77e5421a2939a3351c2b163ed543526540 Mon Sep 17 00:00:00 2001 From: Arlen Johnson Date: Wed, 20 Nov 2024 09:53:30 -0500 Subject: [PATCH 2/7] Improve "Cannot copy" message for javascript clipboard (CFM-428) --- app/resources/locales/en_US/error.po | 4 ++-- app/src/View/Helper/VueHelper.php | 2 +- app/templates/element/subnavigation/navBar.php | 2 +- .../js/comanage/components/common/copy-value-button.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/resources/locales/en_US/error.po b/app/resources/locales/en_US/error.po index 3586723f3..dfcad93d6 100644 --- a/app/resources/locales/en_US/error.po +++ b/app/resources/locales/en_US/error.po @@ -54,8 +54,8 @@ msgstr "Username \"{0}\" not found in api_users table" msgid "auto.viewvar.type.unknown" msgstr "Unknown Auto View Var Type {0}" -msgid "copy.error" -msgstr "Could not copy." +msgid "copy.javascript.clipboard" +msgstr "Could not copy. (Note: This feature requires HTTPS.)" msgid "coid" msgstr "CO ID not found" diff --git a/app/src/View/Helper/VueHelper.php b/app/src/View/Helper/VueHelper.php index 552218571..ceef8a5a8 100644 --- a/app/src/View/Helper/VueHelper.php +++ b/app/src/View/Helper/VueHelper.php @@ -47,7 +47,7 @@ class VueHelper extends Helper { 'SuspendableStatusEnum.S' ], 'error' => [ - 'copy.error' + 'copy.javascript.clipboard' ], 'field' => [ 'email', diff --git a/app/templates/element/subnavigation/navBar.php b/app/templates/element/subnavigation/navBar.php index 5ce0609ed..c98de8631 100644 --- a/app/templates/element/subnavigation/navBar.php +++ b/app/templates/element/subnavigation/navBar.php @@ -87,7 +87,7 @@ this, '', '', - '')" + '')" class="btn btn-sm btn-primary" > content_copy diff --git a/app/webroot/js/comanage/components/common/copy-value-button.js b/app/webroot/js/comanage/components/common/copy-value-button.js index 9b88e1017..be6277a80 100644 --- a/app/webroot/js/comanage/components/common/copy-value-button.js +++ b/app/webroot/js/comanage/components/common/copy-value-button.js @@ -54,7 +54,7 @@ export default { setTimeout(() => this.ariaLabel = this.txt['copy.value'], 2200); } catch($e) { // this will be rendered if browser is not on HTTPS - alert(this.txt["copy.error"] + "\n" + $e); + alert(this.txt["copy.javascript.clipboard"] + "\n" + $e); } } }, From 6820a17cf2199c3cb3f898309ba0d78bdbeab394 Mon Sep 17 00:00:00 2001 From: Arlen Johnson Date: Wed, 20 Nov 2024 13:07:15 -0500 Subject: [PATCH 3/7] Make upper buttons more generic (CFM-428) --- .../element/subnavigation/navBar.php | 44 +----------- .../element/subnavigation/upperButtons.php | 71 +++++++++++++++++++ app/webroot/css/co-base.css | 4 +- 3 files changed, 74 insertions(+), 45 deletions(-) create mode 100644 app/templates/element/subnavigation/upperButtons.php diff --git a/app/templates/element/subnavigation/navBar.php b/app/templates/element/subnavigation/navBar.php index c98de8631..6f4268e58 100644 --- a/app/templates/element/subnavigation/navBar.php +++ b/app/templates/element/subnavigation/navBar.php @@ -52,49 +52,7 @@ element('subnavigation/supertitle') ?> element('subnavigation/statusBadge') ?> - - id; - if($vv_controller != 'EnrollmentFlows') { - $enrollmentFlowId = $vv_primary_link_obj->id; - } - - $startButtonUrl = $this->Url->build( - ['controller' => 'enrollment_flows', - 'action' => 'start', - $enrollmentFlowId - ], - ['fullBase' => true] - ); - ?> -
- - play_arrow - - - - -
- + element('subnavigation/upperButtons') ?> diff --git a/app/templates/element/subnavigation/upperButtons.php b/app/templates/element/subnavigation/upperButtons.php new file mode 100644 index 000000000..61c90a81e --- /dev/null +++ b/app/templates/element/subnavigation/upperButtons.php @@ -0,0 +1,71 @@ +id; + if($vv_controller != 'EnrollmentFlows') { + $enrollmentFlowId = $vv_primary_link_obj->id; + } + + $startButtonUrl = $this->Url->build( + ['controller' => 'enrollment_flows', + 'action' => 'start', + $enrollmentFlowId + ], + ['fullBase' => true] + ); + ?> +
+ + play_arrow + + + + +
+ \ No newline at end of file diff --git a/app/webroot/css/co-base.css b/app/webroot/css/co-base.css index 2873ba849..f782348d3 100644 --- a/app/webroot/css/co-base.css +++ b/app/webroot/css/co-base.css @@ -1781,12 +1781,12 @@ li[data-pc-section="emptymessage"] { background-color: unset; } /* ENROLLMENT FLOWS */ -.enrollment-flow-top-buttons { +.upper-buttons { display: flex; gap: 0.5em; font-size: 0.9em; } -.enrollment-flow-top-buttons a { +.upper-buttons a { padding: 0.5em 1em; } /* ENROLLMENT FLOWS: ATTRIBUTE COLLECTOR */ From 7a6b66fdde99da0583ed799890dab3dbcbac4e9f Mon Sep 17 00:00:00 2001 From: Arlen Johnson Date: Wed, 20 Nov 2024 13:18:35 -0500 Subject: [PATCH 4/7] Shorten test block for applying upper buttons (CFM-428) --- .../element/subnavigation/upperButtons.php | 77 ++++++++++--------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/app/templates/element/subnavigation/upperButtons.php b/app/templates/element/subnavigation/upperButtons.php index 61c90a81e..e7c83ab9c 100644 --- a/app/templates/element/subnavigation/upperButtons.php +++ b/app/templates/element/subnavigation/upperButtons.php @@ -28,44 +28,45 @@ */ // Special "Start" and "Copy" buttons for Enrollment Flow configuration views. -// This element can be expanded to other views if needed. +// This element can be expanded to other views if needed. if( - $vv_controller == 'EnrollmentFlows' || - $vv_controller == 'EnrollmentFlowSteps' || - $vv_controller == 'Petitions' -): + $vv_controller != 'EnrollmentFlows' && + $vv_controller != 'EnrollmentFlowSteps' && + $vv_controller != 'Petitions' +) { + return; +} - $enrollmentFlowId = $vv_obj->id; - if($vv_controller != 'EnrollmentFlows') { - $enrollmentFlowId = $vv_primary_link_obj->id; - } +$enrollmentFlowId = $vv_obj->id; +if($vv_controller != 'EnrollmentFlows') { + $enrollmentFlowId = $vv_primary_link_obj->id; +} + +$startButtonUrl = $this->Url->build( + ['controller' => 'enrollment_flows', + 'action' => 'start', + $enrollmentFlowId + ], + ['fullBase' => true] +); +?> +
+ + play_arrow + + - $startButtonUrl = $this->Url->build( - ['controller' => 'enrollment_flows', - 'action' => 'start', - $enrollmentFlowId - ], - ['fullBase' => true] - ); - ?> -
- - play_arrow - - - - -
- \ No newline at end of file + +
\ No newline at end of file From 4ff470cd721b14f7be78306517446cac6556af0c Mon Sep 17 00:00:00 2001 From: Arlen Johnson Date: Thu, 21 Nov 2024 11:04:29 -0500 Subject: [PATCH 5/7] De-emphasize "Copy URL" and move it to the left of "Start" (CFM-428) --- app/resources/locales/en_US/operation.po | 3 +++ .../element/subnavigation/upperButtons.php | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/resources/locales/en_US/operation.po b/app/resources/locales/en_US/operation.po index 1bcc9824a..687fda9fe 100644 --- a/app/resources/locales/en_US/operation.po +++ b/app/resources/locales/en_US/operation.po @@ -120,6 +120,9 @@ msgstr "Copy" msgid "copy.flowUrl" msgstr "Copy Enrollment Flow URL" +msgid "copy.url" +msgstr "Copy URL" + msgid "copy.value" msgstr "Copy value" diff --git a/app/templates/element/subnavigation/upperButtons.php b/app/templates/element/subnavigation/upperButtons.php index e7c83ab9c..397c38603 100644 --- a/app/templates/element/subnavigation/upperButtons.php +++ b/app/templates/element/subnavigation/upperButtons.php @@ -51,11 +51,6 @@ ); ?>
- - play_arrow - - - + + + play_arrow + +
\ No newline at end of file From 50f7aa41ccd983479f11d6801f65fb61d0124759 Mon Sep 17 00:00:00 2001 From: Arlen Johnson Date: Thu, 21 Nov 2024 11:11:49 -0500 Subject: [PATCH 6/7] Remove "Copy URL" button (CFM-428) --- .../element/subnavigation/upperButtons.php | 18 ++--------- app/webroot/js/comanage/comanage.js | 32 ------------------- 2 files changed, 3 insertions(+), 47 deletions(-) diff --git a/app/templates/element/subnavigation/upperButtons.php b/app/templates/element/subnavigation/upperButtons.php index 397c38603..60f3bdeb2 100644 --- a/app/templates/element/subnavigation/upperButtons.php +++ b/app/templates/element/subnavigation/upperButtons.php @@ -27,8 +27,10 @@ * */ -// Special "Start" and "Copy" buttons for Enrollment Flow configuration views. +// Special "Start" button for Enrollment Flow configuration views. // This element can be expanded to other views if needed. +/* XXX Should we want a "Copy URL" button for enrollment flow "Start", look at + commit 4ff470cd72 for the needed additions to this file and to comanage.js. */ if( $vv_controller != 'EnrollmentFlows' && $vv_controller != 'EnrollmentFlowSteps' && @@ -51,20 +53,6 @@ ); ?>
- - play_arrow diff --git a/app/webroot/js/comanage/comanage.js b/app/webroot/js/comanage/comanage.js index 5a8e48086..2d599837c 100644 --- a/app/webroot/js/comanage/comanage.js +++ b/app/webroot/js/comanage/comanage.js @@ -270,38 +270,6 @@ function clearTopSearch(formObj) { formObj.submit(); } -/** - * COmanage Registry Copy to Clipboard (for static, non-vuejs buttons) - * @param val {string} String to copy - * @param clickedObj {object} DOM object clicked, typically a button containing both text and an icon - * @param copyTxt {string} aria-label describing what to copy - * @param successTxt {string} aria-label success message after copy - * @param errorTxt {string} error message if browser can't copy - */ -async function copyValStatic( - val, - clickedObj, - copyTxt, - successTxt, - errorTxt -) { - try { - // remove extra white spaces and trim the value - let valWithNormalizedSpaces = val.replace(/\s+/g, ' ').trim(); - // copy to clipboard - await navigator.clipboard.writeText(valWithNormalizedSpaces); - // provide feedback - $(clickedObj).find('em').text('thumb_up'); - $(clickedObj).attr('aria-label', successTxt); - // reset feedback - setTimeout(() => $(clickedObj).find('em').text('content_copy'), 1200); - setTimeout(() => $(clickedObj).attr('aria-label', copyTxt), 3000); - } catch($e) { - // this will be rendered if browser is not on HTTPS - alert(errorTxt + "\n" + $e); - } -} - /** * COmanage Registry API AJAX Calls: general function for making an ajax call to Registry API v.2 * @param url {string} API Url From 06a0bc164ab6bbc2092a9fb8edeb7ddccd7d5199 Mon Sep 17 00:00:00 2001 From: Arlen Johnson Date: Thu, 21 Nov 2024 11:21:11 -0500 Subject: [PATCH 7/7] Trivial clean up to comment (CFM-428) --- app/templates/element/subnavigation/upperButtons.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/templates/element/subnavigation/upperButtons.php b/app/templates/element/subnavigation/upperButtons.php index 60f3bdeb2..7d6bb930a 100644 --- a/app/templates/element/subnavigation/upperButtons.php +++ b/app/templates/element/subnavigation/upperButtons.php @@ -29,8 +29,6 @@ // Special "Start" button for Enrollment Flow configuration views. // This element can be expanded to other views if needed. -/* XXX Should we want a "Copy URL" button for enrollment flow "Start", look at - commit 4ff470cd72 for the needed additions to this file and to comanage.js. */ if( $vv_controller != 'EnrollmentFlows' && $vv_controller != 'EnrollmentFlowSteps' &&