mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-25 00:03:27 +08:00
Merge pull request #4156 from okriuchykhin/ok_SCI_6879
Fix switching between views on experiment canvas [SCI-6879]
This commit is contained in:
commit
ef5d6e634b
3 changed files with 14 additions and 13 deletions
|
@ -13,21 +13,19 @@ class CanvasController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def full_zoom
|
def full_zoom
|
||||||
render partial: 'canvas/full_zoom',
|
@my_modules = @my_modules.left_outer_joins(:designated_users, :task_comments)
|
||||||
locals: { experiment: @experiment, my_modules: @my_modules },
|
.select('COUNT(DISTINCT users.id) as designated_users_count')
|
||||||
:content_type => 'text/html'
|
.select('COUNT(DISTINCT comments.id) as task_comments_count')
|
||||||
|
.select('my_modules.*').group(:id)
|
||||||
|
render partial: 'canvas/full_zoom', locals: { experiment: @experiment, my_modules: @my_modules }
|
||||||
end
|
end
|
||||||
|
|
||||||
def medium_zoom
|
def medium_zoom
|
||||||
render partial: 'canvas/medium_zoom',
|
render partial: 'canvas/medium_zoom', locals: { experiment: @experiment, my_modules: @my_modules }
|
||||||
locals: { experiment: @experiment, my_modules: @my_modules },
|
|
||||||
:content_type => 'text/html'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def small_zoom
|
def small_zoom
|
||||||
render partial: 'canvas/small_zoom',
|
render partial: 'canvas/small_zoom', locals: { experiment: @experiment, my_modules: @my_modules }
|
||||||
locals: { experiment: @experiment, my_modules: @my_modules },
|
|
||||||
:content_type => 'text/html'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
@ -195,7 +193,7 @@ class CanvasController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_vars
|
def load_vars
|
||||||
@experiment = Experiment.find_by_id(params[:id])
|
@experiment = Experiment.preload(user_assignments: %i(user user_role)).find_by(id: params[:id])
|
||||||
unless @experiment
|
unless @experiment
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render_404 and return }
|
format.html { render_404 and return }
|
||||||
|
@ -203,7 +201,10 @@ class CanvasController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@my_modules = @experiment.my_modules.active.preload(outputs: :to, user_assignments: %i(user user_role))
|
@my_modules = @experiment.my_modules
|
||||||
|
.active
|
||||||
|
.preload(:tags, outputs: :to, user_assignments: %i(user user_role))
|
||||||
|
.preload(:my_module_status, :my_module_group)
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_edit_canvas
|
def check_edit_canvas
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title">
|
<h3 class="panel-title">
|
||||||
<%= link_to_if can_read_experiment?(my_module.experiment), my_module.name, protocols_my_module_path(my_module), title: my_module.name %>
|
<%= link_to_if can_read_experiment?(experiment), my_module.name, protocols_my_module_path(my_module), title: my_module.name %>
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -10,6 +10,6 @@
|
||||||
data-module-y="<%= my_module.y %>"
|
data-module-y="<%= my_module.y %>"
|
||||||
data-module-conns="<%= construct_module_connections(my_module) %>">
|
data-module-conns="<%= construct_module_connections(my_module) %>">
|
||||||
<span>
|
<span>
|
||||||
<%= link_to_if can_read_experiment?(my_module.experiment), my_module.name[0], protocols_my_module_path(my_module), title: my_module.name %>
|
<%= link_to_if can_read_experiment?(experiment), my_module.name[0], protocols_my_module_path(my_module), title: my_module.name %>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue