mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-20 23:16:15 +08:00
Fix image preview after saving of report [SCI-951]
This commit is contained in:
parent
08aa882155
commit
0f860496a7
|
@ -163,8 +163,11 @@ function processResult(ev, resultTypeEnum, editMode) {
|
|||
var nameValid = textValidator(ev, $nameInput, 0,
|
||||
<%= Constants::NAME_MAX_LENGTH %>);
|
||||
var $fileInput = $form.find("#result_asset_attributes_file");
|
||||
var filesValid = filesValidator(ev, $fileInput, FileTypeEnum.FILE,
|
||||
editMode);
|
||||
var filesValid = true;
|
||||
if ($fileInput.val()) {
|
||||
filesValid = filesValidator(ev, $fileInput, FileTypeEnum.FILE,
|
||||
editMode);
|
||||
}
|
||||
|
||||
if(nameValid && filesValid) {
|
||||
// Local file uploading
|
||||
|
|
|
@ -63,8 +63,6 @@ function formAjaxResultAsset($form) {
|
|||
|
||||
toggleResultEditButtons(true);
|
||||
expandResult($newResult);
|
||||
$imgs = $newResult.find("img");
|
||||
reloadImages($imgs);
|
||||
initPreviewModal();
|
||||
})
|
||||
.on("ajax:error", function(e, data) {
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
/*
|
||||
* By adding unique attribute to image's src, we
|
||||
* force browser to reload/update cached image
|
||||
* (useful for AJAX calls).
|
||||
*/
|
||||
function reloadImages(imgs) {
|
||||
_.each(imgs, function (img) {
|
||||
var src = $(img).attr("src");
|
||||
src = src.split("?", 1);
|
||||
src += "?timestamp=" + new Date().getTime();
|
||||
$(img).attr("src", src);
|
||||
});
|
||||
}
|
Loading…
Reference in a new issue