Files
notifications-admin/app/assets/javascripts/fileUpload.js
Chris Hill-Scott 97a3bf9225 Remove the ‘manage templates’ page
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.
2016-02-22 13:39:02 +00:00

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);