Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

add simple confirmation dialog component #1209

Merged

Conversation

Blackbaud-AnthonyLopez
Copy link
Contributor

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 3f76d30
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/288579831

(Please note that this is a fully automated comment.)

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 755cf45
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/288580427

(Please note that this is a fully automated comment.)

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: c78a319
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/288610185

(Please note that this is a fully automated comment.)

@codecov-io
Copy link

codecov-io commented Oct 16, 2017

Codecov Report

Merging #1209 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #1209   +/-   ##
======================================
  Coverage     100%    100%           
======================================
  Files         355     362    +7     
  Lines        6635    6704   +69     
  Branches      854     863    +9     
======================================
+ Hits         6635    6704   +69
Impacted Files Coverage Δ
...nfirmation-dialog/confirmation-dialog.component.ts 100% <100%> (ø)
...onfirmation-dialog/confirmation-dialog.instance.ts 100% <100%> (ø)
.../confirmation-dialog/confirmation-dialog-config.ts 100% <100%> (ø)
...es/confirmation-dialog/confirmation-dialog-type.ts 100% <100%> (ø)
.../confirmation-dialog/confirmation-dialog.module.ts 100% <100%> (ø)
...confirmation-dialog/confirmation-dialog.service.ts 100% <100%> (ø)
.../confirmation-dialog/confirmation-dialog-button.ts 100% <100%> (ø)
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 97d5bb0...a0f5c96. Read the comment docs.

@blackbaud-sky-savage
Copy link
Collaborator

Tests passed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED

Commit: 6717c55
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/288627778

(Please note that this is a fully automated comment.)

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 03f60c0
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/290080272

(Please note that this is a fully automated comment.)

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 0fd44c3
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/290107152

(Please note that this is a fully automated comment.)

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 4cbabaf
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/290290073

(Please note that this is a fully automated comment.)

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: fb2b728
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/293177952

(Please note that this is a fully automated comment.)

@@ -0,0 +1,5 @@
export class ConfirmationDialogConfig {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefix with Sky, please.

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: e133baf
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/293302094

(Please note that this is a fully automated comment.)

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 3c7d854
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/293326838

(Please note that this is a fully automated comment.)

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: ed6d69f
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/293811381

(Please note that this is a fully automated comment.)

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 952b61f
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/294921404

(Please note that this is a fully automated comment.)

@Blackbaud-SteveBrush
Copy link
Member

@blackbaud-sky-savage retry

@blackbaud-sky-savage
Copy link
Collaborator

Tests passed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED

Commit: 952b61f
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/294943927

(Please note that this is a fully automated comment.)

templateUrl: './confirmation-dialog-form.component.html',
styleUrls: ['./confirmation-dialog-form.component.scss']
})
export class SkyConfirmationDialogFormComponent implements OnInit {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't think the suffix "form" is needed here, especially since you don't have just a SkyConfirmationDialogComponent. You can probably get away with removing the Form and -form suffixes, to avoid confusion.

public instance: SkyModalInstance) {}

public ngOnInit() {
if (!this.context.type) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more speculation, but I'm curious if the component should have to worry about the context's default values. Since you're preparing the config in the SkyConfirmationDialogInstance.open() method, maybe you could run the default-checks there?

Interested to hear your thoughts!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thought was that the component would check for all defaults and overrides so that anything that creates it wouldn't have to worry about checking the default values. I can't think of scenario now where the component might get created in a different way than through the service/instance, but if it were to then the default config checking might have to be done there too. If you think it makes more sense to move the checking to the SkyConfirmationDialogInstance.open() method, I'm perfectly fine with moving it there.

{
text: SkyResources.getString('confirm_dialog_default_ok_text'),
autofocus: true,
style: 'sky-btn sky-btn-primary sky-dialog-btn-1'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sold on the use of "style", here. At first glance, it appeared that the property would be setting inline CSS styles (much like ngStyle). You could go with the vanilla JavaScript classNames, but I'm open to your suggestions (https://developer.mozilla.org/en-US/docs/Web/API/Element/className).

Another idea would be to have a static buttonType property that would store the value as primary, default, or link, and then have your template govern the CSS class name, to separate the concerns a bit (the component doesn't really "care" about the class name, just what type it is).

<button
  *ngFor="let btn of buttons"
  type="button"
  class="sky-btn sky-confirmation-dialog-btn sky-btn-{{ btn.buttonType }}"
  (click)="instance.close(btn.text)"
  [attr.autofocus]="btn.autofocus ? 'autofocus' : null">
  {{ btn.text }}
</button>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of the buttonType property. For some reason, I had thought a button couldn't have both 'sky-btn' and 'sky-btn-link' or else the 'sky-btn-link' styling wouldn't show. But I see now that my thought was incorrect. I will replace the style property for buttonType. Thanks for the advice.

@@ -0,0 +1,22 @@
<sky-modal>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good idea to wrap your template in a div with a specific class so that other components can easily target its contents, such as:

<div class="sky-confirmation-dialog">
  // ...
</div>

import { SkyConfirmationDialogButton } from './confirmation-dialog-form.component';

export class SkyConfirmationDialogConfig {
public description: string;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind changing description to message, to better emulate the vanilla JavaScript's confirm method arguments? https://www.w3schools.com/jsref/met_win_confirm.asp

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 92ca371
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/299268395

(Please note that this is a fully automated comment.)

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 7cb85ec
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/301594590

(Please note that this is a fully automated comment.)

@Blackbaud-SteveBrush
Copy link
Member

@blackbaud-sky-savage retry

1 similar comment
@Blackbaud-SteveBrush
Copy link
Member

@blackbaud-sky-savage retry

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: a01e525
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/302024316

(Please note that this is a fully automated comment.)

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 4ad136c
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/303815754

(Please note that this is a fully automated comment.)

@Blackbaud-SteveBrush
Copy link
Member

@blackbaud-sky-savage retry

@blackbaud-sky-savage
Copy link
Collaborator

Tests passed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED

Commit: 4ad136c
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/304003244

(Please note that this is a fully automated comment.)

@Blackbaud-SteveBrush
Copy link
Member

@Blackbaud-AnthonyLopez This looks good to me!

I'm going to have @blackbaud-johnly take a quick look at the docs portion, if he doesn't mind.

Copy link
Contributor

@blackbaud-johnly blackbaud-johnly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've gone through and made some suggestions to tweak the docs. Please just let me know if anything doesn't make sense. I hope this helps. Thanks.

class="sky-btn sky-btn-primary sky-test-one-confirmation-dialog"
(click)="openOneBtnDialog()"
>
Open one button dialog
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"one-button" should be hyphenated

class="sky-btn sky-btn-primary sky-test-two-confirmation-dialog"
(click)="openTwoBtnDialog()"
>
Open two button dialog
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"two-button" should be hyphenated

class="sky-btn sky-btn-primary sky-test-three-confirmation-dialog"
(click)="openThreeBtnDialog()"
>
Open three button dialog
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"three-button" should be hyphenated

class="sky-btn sky-btn-primary sky-test-long-confirmation-dialog"
(click)="openLongDescriptionDialog()"
>
Open dialog long
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we put the adjective after the noun here? Should this be "Open long dialog"? And if so, what do we mean by "long"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blackbaud-johnly I was copying an existing example from the error-visual.component.html file. By "long", I mean a description that spans multiple lines. Would "Open dialog with long description" be better?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "Open dialog with long description sounds great.

@@ -0,0 +1,16 @@
<button type="button" class="sky-btn sky-btn-primary" (click)="openConfirmationDialog(1)">
OK dialog
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these labels be consistent with the terminology above? i.e., "One-button dialog," "Two-button dialog," and "Three-button dialog"? That strikes me as easier to process at a glance than "Yes no cancel dialog."

Also, if the fourth option here is a dialog with custom text on the buttons, is that what the "dialog long" option above is all about? If so, should "Open dialog long" be something like "Open dialog with custom button text"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blackbaud-johnly These button labels do not necessarily go with the above terminology. I was basing this wording off of the confirm dialog enum types (in the "SkyConfirmationDialogType types" further up on this page), which there are 3 currently (OK, YesCancel, and YesNoCancel). The last button, "Custom button text dialog", is just supposed to demonstrate how a user can supply their own custom button text to the dialog to change the defaults. I am fine with changing the text still.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Sorry about the confusion on my end. And thanks for the clarification. ... I'd go ahead and change the first three labels as suggested, and I'd change the last to "Dialog with custom button text" if that works for you.

name: 'Confirmation dialog',
icon: 'list-alt',
// tslint:disable-next-line
summary: `The confirmation dialog component allows users to confirm an action.`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "allows users to confirm an action" should be something like "launches simple confirmation dialogs in a consistent way in SKY UX applications" since that's what we say on the help topic for the service. If we want to emphasize confirming the action, I'd add "to allow users to confirm actions" to the opening sentence of the the first paragraph on the help topic and change this summary to "launches simple confirmation dialogs to allow users to confirm actions."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blackbaud-johnly I am not sure if you want me to keep the beginning part, "The confirmation dialog component". Right now, I have it as "The confirmation dialog component launches simple confirmation dialogs to allow users to confirm actions." Is that okay? I also updated the text in the first paragraph of the help topic.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks great to me. Sorry my initial feedback was unclear.

@@ -103,6 +103,22 @@
"_description": "Label for the reset button to change the color back to the initial color",
"message": "Reset"
},
"confirm_dialog_default_ok_text" : {
"_description": "Default text for confirm dialog's ok button",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"OK" should be capitalized

"message": "OK"
},
"confirm_dialog_default_yes_text" : {
"_description": "Default text for confirm dialog's yes button",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd capitalize "Yes"

"message": "Yes"
},
"confirm_dialog_default_no_text" : {
"_description": "Default text for confirm dialog's no button",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd capitalize "No"

"message": "No"
},
"confirm_dialog_default_cancel_text" : {
"_description": "Default text for confirm dialog's cancel button",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd capitalize "Cancel"

@Blackbaud-SteveBrush
Copy link
Member

@Blackbaud-AnthonyLopez Let me know if you have any questions regarding John's docs feedback.

@blackbaud-sky-savage
Copy link
Collaborator

Tests failed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 3e44829
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/305016692

(Please note that this is a fully automated comment.)

@blackbaud-sky-savage
Copy link
Collaborator

Tests passed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED

Commit: d0179fe
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/305296656

(Please note that this is a fully automated comment.)

@Blackbaud-AnthonyLopez
Copy link
Contributor Author

@Blackbaud-SteveBrush I made all of the updates from John's docs review.

@blackbaud-sky-savage
Copy link
Collaborator

Tests passed. Automated cross-browser testing via BrowserStack and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED

Commit: a0f5c96
Build details: https://travis-ci.org/blackbaud-sky-savage/skyux2/builds/305325835

(Please note that this is a fully automated comment.)

@Blackbaud-SteveBrush Blackbaud-SteveBrush merged commit b5ea1ca into blackbaud:master Nov 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants