|
|
@ -1,4 +1,5 @@ |
|
|
|
class CaseLogsController < ApplicationController |
|
|
|
class CaseLogsController < ApplicationController |
|
|
|
|
|
|
|
|
|
|
|
def index |
|
|
|
def index |
|
|
|
@submitted_case_logs = CaseLog.where(status: 1) |
|
|
|
@submitted_case_logs = CaseLog.where(status: 1) |
|
|
|
@in_progress_case_logs = CaseLog.where(status: 0) |
|
|
|
@in_progress_case_logs = CaseLog.where(status: 0) |
|
|
@ -17,7 +18,7 @@ class CaseLogsController < ApplicationController |
|
|
|
def edit |
|
|
|
def edit |
|
|
|
@form = Form.new(2021, 2022) |
|
|
|
@form = Form.new(2021, 2022) |
|
|
|
@case_log = CaseLog.find(params[:id]) |
|
|
|
@case_log = CaseLog.find(params[:id]) |
|
|
|
render :edit, locals: { form: @form } |
|
|
|
render :edit |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def next_page |
|
|
|
def next_page |
|
|
@ -31,10 +32,6 @@ class CaseLogsController < ApplicationController |
|
|
|
redirect_to(send("case_log_#{next_page}_path", @case_log)) |
|
|
|
redirect_to(send("case_log_#{next_page}_path", @case_log)) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def page_params(questions_for_page) |
|
|
|
|
|
|
|
params.permit(questions_for_page) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
form = Form.new(2021, 2022) |
|
|
|
form = Form.new(2021, 2022) |
|
|
|
form.all_pages.map do |page_key, page_info| |
|
|
|
form.all_pages.map do |page_key, page_info| |
|
|
|
define_method(page_key) do |
|
|
|
define_method(page_key) do |
|
|
@ -42,4 +39,10 @@ class CaseLogsController < ApplicationController |
|
|
|
render "form/page", locals: { case_log_id: @case_log.id, form: form, page_key: page_key, page_info: page_info } |
|
|
|
render "form/page", locals: { case_log_id: @case_log.id, form: form, page_key: page_key, page_info: page_info } |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def page_params(questions_for_page) |
|
|
|
|
|
|
|
params.permit(questions_for_page) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|