scinote-web/app/controllers/my_module_status_flow_controller.rb

24 lines
713 B
Ruby
Raw Normal View History

2020-07-22 15:45:56 +08:00
# frozen_string_literal: true
class MyModuleStatusFlowController < ApplicationController
2020-07-22 17:39:34 +08:00
before_action :load_my_module
before_action :check_view_permissions
2020-07-22 15:45:56 +08:00
def show
2020-07-27 22:36:21 +08:00
my_module_statuses = @my_module.my_module_status_flow.my_module_statuses.sort_by_position
2020-07-22 17:39:34 +08:00
render json: { html: render_to_string(partial: 'my_modules/modals/status_flow_modal_body.html.erb',
locals: { my_module_statuses: my_module_statuses }) }
end
private
def load_my_module
@my_module = MyModule.find_by(id: params[:my_module_id])
render_404 unless @my_module
end
def check_view_permissions
render_403 unless can_read_experiment?(@my_module.experiment)
2020-07-22 15:45:56 +08:00
end
end