Skip to content

Commit

Permalink
Add special "Start" button to Enrollment Flow views (CFM-428) (#251)
Browse files Browse the repository at this point in the history
* Add special "Start" and "Copy" (flow url) buttons to Enrollment Flow configuration views (CFM-428)

* Improve "Cannot copy" message for javascript clipboard (CFM-428)

* Make upper buttons more generic (CFM-428)

* Shorten test block for applying upper buttons (CFM-428)

* De-emphasize "Copy URL" and move it to the left of "Start" (CFM-428)

* Remove "Copy URL" button (CFM-428)

* Trivial clean up to comment (CFM-428)
  • Loading branch information
arlen authored Nov 21, 2024
1 parent 89bb59d commit 814d1e1
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions app/resources/locales/en_US/error.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions app/resources/locales/en_US/operation.po
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ msgstr "Continue"
msgid "copy"
msgstr "Copy"

msgid "copy.flowUrl"
msgstr "Copy Enrollment Flow URL"

msgid "copy.url"
msgstr "Copy URL"

msgid "copy.value"
msgstr "Copy value"

Expand Down
2 changes: 1 addition & 1 deletion app/src/View/Helper/VueHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class VueHelper extends Helper {
'SuspendableStatusEnum.S'
],
'error' => [
'copy.error'
'copy.javascript.clipboard'
],
'field' => [
'email',
Expand Down
42 changes: 0 additions & 42 deletions app/templates/EnrollmentFlows/fields-nav.inc

This file was deleted.

1 change: 1 addition & 0 deletions app/templates/element/subnavigation/navBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<?= $this->element('subnavigation/supertitle') ?>
<?= $this->element('subnavigation/statusBadge') ?>
</div>
<?= $this->element('subnavigation/upperButtons') ?>
</div>

<!-- Flash Messages are placed below supertitle when subnavigation exists. -->
Expand Down
58 changes: 58 additions & 0 deletions app/templates/element/subnavigation/upperButtons.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
/**
* COmanage Registry Subnavigation Upper Buttons Element
*
* 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 Registry v5.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*
*
*/

// Special "Start" button for Enrollment Flow configuration views.
// This element can be expanded to other views if needed.
if(
$vv_controller != 'EnrollmentFlows' &&
$vv_controller != 'EnrollmentFlowSteps' &&
$vv_controller != 'Petitions'
) {
return;
}

$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]
);
?>
<div class="upper-buttons">
<a href="<?= $startButtonUrl ?>" class="btn btn-sm btn-tertiary">
<em class="material-symbols">play_arrow</em>
<?= __d('operation', 'EnrollmentFlows.start') ?>
</a>
</div>
10 changes: 9 additions & 1 deletion app/webroot/css/co-base.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 * {
Expand Down Expand Up @@ -1781,6 +1780,15 @@ li[data-pc-section="emptymessage"] {
color: var(--cmg-color-txt-soft);
background-color: unset;
}
/* ENROLLMENT FLOWS */
.upper-buttons {
display: flex;
gap: 0.5em;
font-size: 0.9em;
}
.upper-buttons a {
padding: 0.5em 1em;
}
/* ENROLLMENT FLOWS: ATTRIBUTE COLLECTOR */
body.attributecollectors main,
body.basicattributecollectors main {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
},
Expand Down

0 comments on commit 814d1e1

Please sign in to comment.