diff --git a/app/controllers/assets_controller.rb b/app/controllers/assets_controller.rb index 85a28583d..057e449ff 100644 --- a/app/controllers/assets_controller.rb +++ b/app/controllers/assets_controller.rb @@ -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 diff --git a/app/javascript/vue/shared/content/attachments/context_menu.vue b/app/javascript/vue/shared/content/attachments/context_menu.vue index bb50a66e4..ee1aa9d76 100644 --- a/app/javascript/vue/shared/content/attachments/context_menu.vue +++ b/app/javascript/vue/shared/content/attachments/context_menu.vue @@ -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() { diff --git a/app/views/assets/_asset_list.html.erb b/app/views/assets/_asset_list.html.erb index 2956b2c7d..cfa09d650 100644 --- a/app/views/assets/_asset_list.html.erb +++ b/app/views/assets/_asset_list.html.erb @@ -4,7 +4,7 @@ data-asset-updated-at="<%= asset.updated_at.to_i %>" data-asset-order="1" > - <%= image_tag asset.medium_preview || rails_blob_path(asset.file, disposition: 'attachment') %> + <%= file_extension_icon_html(asset) %> <%= link_to rails_blob_path(asset.file, disposition: 'attachment'), class: "file-preview-link file-name", id: "modal_link#{asset.id}",