Merge pull request #6382 from G-Chubinidze/gc_SCI_9433

Missing file preview [SCI-9433]
This commit is contained in:
Martin Artnik 2023-11-03 11:16:30 +01:00 committed by GitHub
commit 93861a1b22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 19 deletions

View file

@ -36,19 +36,8 @@ class AssetsController < ApplicationController
def toggle_view_mode
@asset.view_mode = toggle_view_mode_params[:view_mode]
@asset.save!(touch: false)
gallery_view_id = if @assoc.is_a?(Step)
@assoc.id
elsif @assoc.is_a?(Result)
@assoc.my_module.id
end
render json: {
html: render_to_string(
partial: 'assets/asset', locals: {
asset: @asset,
gallery_view_id: gallery_view_id
}
)
}
render json: AssetSerializer.new(@asset, scope: { user: current_user }).as_json
end
def load_asset

View file

@ -139,12 +139,6 @@
type: 'PATCH',
dataType: 'json',
data: { asset: { view_mode: viewMode } }
}).done(data => {
this.$nextTick(function() {
$(`.asset[data-asset-id=${this.attachment.id}] img`)
.replaceWith($(data.html).find(`.asset[data-asset-id=${this.attachment.id}] img`));
ActiveStoragePreviews.reloadPreview(`.asset[data-asset-id=${this.attachment.id}] img`);
})
});
},
deleteAttachment() {