Skip to content

Commit

Permalink
feat: Enable/Disable Messaging File Upload (#10)
Browse files Browse the repository at this point in the history
* feat: Ignore session time out window when removing files from upload

* fix: File list in table (messages)

* fix: internal support for message attachment styling

* feat: Correlation ID for handling documents
  • Loading branch information
wadedvsa authored and JoshuaLicense committed Jul 23, 2024
1 parent 08a4614 commit 4732389
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
7 changes: 6 additions & 1 deletion assets/_js/components/fileUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ OLCS.fileUpload = (function(document, $, undefined) {
}

var deleteResponse = OLCS.normaliseResponse(function(response) {
if (OLCS.modal.isVisible()) {
if (OLCS.modal.isVisible(true)) {
OLCS.modal.updateBody(response.body);
} else {
F.render(mainBodySelector, response.body);
Expand All @@ -80,6 +80,7 @@ OLCS.fileUpload = (function(document, $, undefined) {
var name = $(container).data("group");
var containerIndex = $(container).index(containerSelector);
var sectionIdVal = form.find("[name='sectionId']").val();
var correlationId = form.find("[name='correlationId']").val();
var security = document.getElementById("security");
var url = form.attr("action") ? form.attr("action") : window.location.pathname;
uploadInProgress = true;
Expand Down Expand Up @@ -129,6 +130,10 @@ OLCS.fileUpload = (function(document, $, undefined) {
fd.append("sectionId",sectionIdVal);
}

if (correlationId) {
fd.append("correlationId", correlationId);
}

fd.append(name + "[file]", file);
fd.append(name + "[upload]", "Upload");
fd.append(security.name, security.value);
Expand Down
6 changes: 4 additions & 2 deletions assets/_js/components/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ OLCS.modal = (function(document, $, undefined) {
*/
var selector = '.modal';
var wrapper = '.modal__wrapper';
var noSessionWrapper = 'div:not(#sessionTimeoutModal).modal__wrapper';
var overlay = '.overlay';
var header = '.modal__title';
var content = '.modal__content';
Expand Down Expand Up @@ -155,8 +156,9 @@ OLCS.modal = (function(document, $, undefined) {

};

exports.isVisible = function() {
return $(wrapper).is(':visible');
exports.isVisible = function(ignoreSessionWindow) {
var relevantWrapper = ignoreSessionWindow === true ? noSessionWrapper : wrapper;
return $(relevantWrapper).is(':visible');
};

exports.updateBody = function(body) {
Expand Down
12 changes: 12 additions & 0 deletions assets/_styles/core/forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,18 @@ input.govuk-input,
}
}

td {
.file-uploader {
ul {
margin-left: 0;

li {
width: auto;
}
}
}
}

.attach-action {

[type="file"] {
Expand Down

0 comments on commit 4732389

Please sign in to comment.