mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 19:03:30 -05:00
The ‘manage templates’ page was almost identical to the ‘send text messages’ page. This commit consolidates them into one and makes them all hang together. Part of this means tweaks to the javascript so that files upload as soon as you’ve chosen them.
26 lines
469 B
JavaScript
26 lines
469 B
JavaScript
(function(Modules) {
|
|
"use strict";
|
|
|
|
Modules.FileUpload = function() {
|
|
|
|
let $field;
|
|
|
|
this.submit = function() {
|
|
|
|
$field.parents('form').trigger('submit');
|
|
|
|
};
|
|
|
|
this.start = function(component) {
|
|
|
|
$field = $('.file-upload-field', component);
|
|
|
|
// Need to put the event on the container, not the input for it to work properly
|
|
$(component).on('change', '.file-upload-field', this.submit);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})(window.GOVUK.Modules);
|