forked from wintercms/winter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into wip/support-uploading-packages
- Loading branch information
Showing
13 changed files
with
15 additions
and
60 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 |
---|---|---|
|
@@ -9,20 +9,12 @@ import { delegate } from 'jquery-events-to-dom-events'; | |
* | ||
* Functions: | ||
* - Adds the "render" jQuery event to Snowboard requests that widgets use to initialise. | ||
* - Hooks into the main jQuery AJAX workflow events of the original AJAX framework (`ajaxPromise` at the beginning | ||
* of an AJAX request, `ajaxDone`/`ajaxRedirected`/`ajaxFail` at the end of the beginning of an AJAX requests) | ||
* and simulates comparable Snowboard events to allow Snowboard functionality that acts on AJAX events to | ||
* to function in the Backend (Flash messages, loader bar) | ||
* - Ensures the CSRF token is included in requests. | ||
* | ||
* @copyright 2021 Winter. | ||
* @author Ben Thomson <[email protected]> | ||
*/ | ||
export default class Handler extends Snowboard.Singleton { | ||
construct() { | ||
this.requests = []; | ||
} | ||
|
||
/** | ||
* Event listeners. | ||
* | ||
|
@@ -54,42 +46,6 @@ export default class Handler extends Snowboard.Singleton { | |
|
||
// Add "render" event for backwards compatibility | ||
window.jQuery(document).trigger('render'); | ||
|
||
// Add global events for AJAX queries and route them to the Snowboard global events and | ||
// necessary UI functionality | ||
delegate('ajaxPromise', ['event', 'context']); | ||
delegate('ajaxDone', ['event', 'context', 'data']); | ||
delegate('ajaxRedirected', ['event']); | ||
delegate('ajaxFail', ['event', 'context', 'textStatus']); | ||
|
||
document.addEventListener('$ajaxPromise', (event) => { | ||
this.requests[event.target] = Promise.withResolvers(); | ||
this.snowboard.globalEvent('ajaxStart', this.requests[event.target].promise, { | ||
element: event.target, | ||
options: {}, | ||
}); | ||
}); | ||
document.addEventListener('$ajaxDone', (event) => { | ||
this.requests[event.target].resolve(event.detail.data); | ||
this.snowboard.globalEvent('ajaxDone', event.detail.data, { | ||
element: event.target, | ||
options: {}, | ||
}); | ||
}); | ||
document.addEventListener('$ajaxRedirected', (event) => { | ||
this.requests[event.target].resolve(); | ||
this.snowboard.globalEvent('ajaxDone', event.detail.data, { | ||
element: event.target, | ||
options: {}, | ||
}); | ||
}); | ||
document.addEventListener('$ajaxFail', (event) => { | ||
this.requests[event.target].reject(event.detail.textStatus); | ||
this.snowboard.globalEvent('ajaxDone', event.detail.data, { | ||
element: event.target, | ||
options: {}, | ||
}); | ||
}); | ||
} | ||
|
||
/** | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 3 additions & 3 deletions
6
modules/backend/formwidgets/codeeditor/assets/js/build-min.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
modules/backend/formwidgets/fileupload/assets/css/fileupload.css
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.