mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-01 20:48:23 +08:00
Merge pull request #456 from okriuchykhin/ok_SCI_951
Fix missing preview images in task and protocol management [SCI-951]
This commit is contained in:
commit
9909f9dcff
4 changed files with 10 additions and 18 deletions
|
@ -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();
|
||||
Comments.initialize();
|
||||
})
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
|
@ -262,10 +262,14 @@ class Protocol < ActiveRecord::Base
|
|||
)
|
||||
asset2.created_by = current_user
|
||||
asset2.last_modified_by = current_user
|
||||
asset2.file_processing = true if asset.is_image?
|
||||
asset2.save
|
||||
|
||||
step2.assets << asset2
|
||||
asset2.file.delay.reprocess!(:medium)
|
||||
if asset.is_image?
|
||||
asset2.file.delay.reprocess!(:large)
|
||||
asset2.file.delay.reprocess!(:medium)
|
||||
end
|
||||
assets_to_clone << [asset.id, asset2.id]
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue