mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-16 06:06:56 +08:00
26 lines
883 B
Ruby
26 lines
883 B
Ruby
# frozen_string_literal: true
|
|
|
|
class MyModuleStatusFlowController < ApplicationController
|
|
before_action :load_my_module
|
|
before_action :check_view_permissions
|
|
|
|
def show
|
|
my_module_statuses = @my_module.my_module_status_flow
|
|
.my_module_statuses
|
|
.preload(:my_module_status_implications, next_status: :my_module_status_conditions)
|
|
.sort_by_position
|
|
render json: { html: render_to_string(partial: 'my_modules/modals/status_flow_modal_body',
|
|
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_my_module?(@my_module)
|
|
end
|
|
end
|