-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring the JavaScript used to confirm the license granted for a (#…
…1910) dataset
- Loading branch information
1 parent
cebd7d8
commit 94cb55d
Showing
3 changed files
with
34 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
class WorksWizardReview { | ||
static bind(elementSelector) { | ||
let built; | ||
const root = document.querySelector(elementSelector); | ||
|
||
if (root) { | ||
built = new WorksWizardReview(root); | ||
} | ||
|
||
return built; | ||
} | ||
|
||
static handleClick(event) { | ||
const message = "You're about to grant license for this dataset. Are you sure?"; | ||
const input = window.confirm(message); | ||
|
||
if (input === false) { | ||
event.preventDefault(); | ||
} | ||
} | ||
|
||
constructor(root) { | ||
this.root = root; | ||
|
||
if (this.root) { | ||
const handleClick = WorksWizardReview.handleClick.bind(this); | ||
this.root.addEventListener('click', handleClick); | ||
} | ||
} | ||
} | ||
|
||
export default WorksWizardReview; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters