mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-02 13:12:13 +08:00
Add gallery view after image update [SCI-5286] (#2993)
* Add gallery view after image update [SCI-5286]
This commit is contained in:
parent
edd774b045
commit
6bd021d88a
1 changed files with 16 additions and 4 deletions
|
@ -35,8 +35,11 @@ class AssetsController < ApplicationController
|
|||
def toggle_view_mode
|
||||
@asset.view_mode = toggle_view_mode_params[:view_mode]
|
||||
if @asset.save(touch: false)
|
||||
gallery_view_id = @assoc.id if @assoc.class == Step
|
||||
|
||||
gallery_view_id = if @assoc.is_a?(Step)
|
||||
@assoc.id
|
||||
elsif @assoc.is_a?(Result)
|
||||
@assoc.my_module.id
|
||||
end
|
||||
html = render_to_string(partial: 'assets/asset.html.erb', locals: {
|
||||
asset: @asset,
|
||||
gallery_view_id: gallery_view_id
|
||||
|
@ -102,10 +105,19 @@ class AssetsController < ApplicationController
|
|||
@asset.post_process_file(@asset.team)
|
||||
@asset.step&.protocol&.update(updated_at: Time.zone.now)
|
||||
|
||||
render_html = if @asset.step || @asset.result
|
||||
render_html = if [Result, Step].include?(@assoc.class)
|
||||
gallery_view_id = if @assoc.is_a?(Step)
|
||||
@assoc.id
|
||||
elsif @assoc.is_a?(Result)
|
||||
@assoc.my_module.id
|
||||
end
|
||||
|
||||
render_to_string(
|
||||
partial: 'assets/asset.html.erb',
|
||||
locals: { asset: @asset },
|
||||
locals: {
|
||||
asset: @asset,
|
||||
gallery_view_id: gallery_view_id
|
||||
},
|
||||
formats: :html
|
||||
)
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue