-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: UHF-10903: Update application copy modal to use new dialog (#1563)
* UHF-10903: New dialog form * UHF-10903: Refactor application copy to custom controller. * UHF-10903: Add custom selector option for dialogs. * UHF-10903: Update tests for new copy functionality. * UHF-10903: Rename method + 1 error * UHF-10903: Fix typo * UHF-10903: Refactor createDialog to support object argument.
- Loading branch information
1 parent
02b60d3
commit 469a507
Showing
15 changed files
with
428 additions
and
578 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
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
36 changes: 36 additions & 0 deletions
36
public/modules/custom/grants_handler/js/application-copy-dialog.js
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,36 @@ | ||
(function (Drupal) { | ||
Drupal.behaviors.copyApplicationModalForm = { | ||
attach: function (context, settings) { | ||
const triggerButton = document.getElementById('copy-application-button'); | ||
|
||
triggerButton.addEventListener('click', function (event) { | ||
|
||
event.preventDefault(); | ||
|
||
const htmlContent = drupalSettings.grants_handler.htmlContent; | ||
const copyUrl = drupalSettings.grants_handler.copyUrl; | ||
|
||
Drupal.dialogFunctions.createDialog({ | ||
dialogContent: htmlContent, | ||
actionButtonText: Drupal.t('Copy application', [], { context: 'grants_handler' }), | ||
backButtonText: Drupal.t('Close', [], { context: 'grants_handler' }), | ||
closeButtonText: Drupal.t('Close', [], { context: 'grants_handler' }), | ||
actionButtonCallback: () => { | ||
// Redirect to a new URL | ||
window.location.href = copyUrl; | ||
/* | ||
We probably should handle the whole copy process here, but for | ||
now we just redirect to the copy URL. | ||
Much better UX would be to show spinner here while copying | ||
application and then redirect when it's ready | ||
*/ | ||
}, | ||
dialogTitle: Drupal.t('Copy application', [], { context: 'grants_handler' }), | ||
customSelector: 'application-copy-dialog' | ||
}) | ||
}); | ||
}, | ||
}; | ||
})(Drupal); |
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
Oops, something went wrong.