Fix image preview after saving of report [SCI-951]

This commit is contained in:
Oleksii Kriuchykhin 2017-01-26 14:42:14 +01:00
parent 08aa882155
commit 0f860496a7
3 changed files with 5 additions and 17 deletions

View file

@ -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

View file

@ -63,8 +63,6 @@ function formAjaxResultAsset($form) {
toggleResultEditButtons(true);
expandResult($newResult);
$imgs = $newResult.find("img");
reloadImages($imgs);
initPreviewModal();
})
.on("ajax:error", function(e, data) {

View file

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