Skip to content

Commit

Permalink
Restored UI for current media in modal
Browse files Browse the repository at this point in the history
  • Loading branch information
orangejenny committed Sep 9, 2024
1 parent 004d097 commit 21df873
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ define([
old_ref: (ref.isMediaMatched()) ? ref.linkedObj.m_id : "",
replace_attachment: true
};
//uploadController.updateUploadFormUI(); // TODO: restore this - it updates the UI within the modal with the newly-uploaded file preview
};

return ref;
Expand Down Expand Up @@ -171,6 +170,25 @@ define([
$controlBlock.append($previewContainer);

$uploadContainer.html(multimedia_block());

var $uploaderModal = $("#" + SLUG_TO_UPLOADER_SLUG[widget.form]);
$uploaderModal.on('show.bs.modal', function (event) {
var ICONS = widget.mug.form.vellum.data.javaRosa.ICONS,
$existingFile = $uploaderModal.find(".hqm-existing");

// TODO: DRY up with the other place that has this code
if (widget.mediaRef.getUrl() && widget.mediaRef.isMediaMatched()) {
$existingFile.removeClass('hide');
$existingFile.find('.hqm-existing-controls').html(getPreviewUI(widget, objectMap, ICONS));
} else {
$existingFile.addClass('hide');
$existingFile.find('.hqm-existing-controls').empty();
}
$('.existing-media').tooltip({
placement: 'bottom',
});
});

$uploadContainer.find('.fd-mm-upload-trigger')
.append(getUploadButtonUI(widget, objectMap));
$uploadContainer.find('.fd-mm-path-input')
Expand Down

0 comments on commit 21df873

Please sign in to comment.