|
|
@ -1,9 +1,6 @@ |
|
|
|
class CaseLogsController < ApplicationController |
|
|
|
class CaseLogsController < ApplicationController |
|
|
|
skip_before_action :verify_authenticity_token, if: :json_api_request? |
|
|
|
skip_before_action :verify_authenticity_token, if: :json_api_request? |
|
|
|
before_action :authenticate, if: :json_api_request? |
|
|
|
before_action :authenticate, if: :json_api_request? |
|
|
|
# rubocop:disable Style/ClassVars |
|
|
|
|
|
|
|
@@form_handler = FormHandler.instance |
|
|
|
|
|
|
|
# rubocop:enable Style/ClassVars |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def index |
|
|
|
def index |
|
|
|
@completed_case_logs = CaseLog.where(status: 2) |
|
|
|
@completed_case_logs = CaseLog.where(status: 2) |
|
|
@ -42,13 +39,13 @@ class CaseLogsController < ApplicationController |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def edit |
|
|
|
def edit |
|
|
|
@form = @@form_handler.get_form("2021_2022") |
|
|
|
@form = FormHandler.instance.get_form("2021_2022") |
|
|
|
@case_log = CaseLog.find(params[:id]) |
|
|
|
@case_log = CaseLog.find(params[:id]) |
|
|
|
render :edit |
|
|
|
render :edit |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def submit_form |
|
|
|
def submit_form |
|
|
|
form = @@form_handler.get_form("2021_2022") |
|
|
|
form = FormHandler.instance.get_form("2021_2022") |
|
|
|
@case_log = CaseLog.find(params[:id]) |
|
|
|
@case_log = CaseLog.find(params[:id]) |
|
|
|
previous_page = params[:case_log][:previous_page] |
|
|
|
previous_page = params[:case_log][:previous_page] |
|
|
|
questions_for_page = form.questions_for_page(previous_page) |
|
|
|
questions_for_page = form.questions_for_page(previous_page) |
|
|
@ -76,14 +73,14 @@ class CaseLogsController < ApplicationController |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def check_answers |
|
|
|
def check_answers |
|
|
|
form = @@form_handler.get_form("2021_2022") |
|
|
|
form = FormHandler.instance.get_form("2021_2022") |
|
|
|
@case_log = CaseLog.find(params[:case_log_id]) |
|
|
|
@case_log = CaseLog.find(params[:case_log_id]) |
|
|
|
current_url = request.env["PATH_INFO"] |
|
|
|
current_url = request.env["PATH_INFO"] |
|
|
|
subsection = current_url.split("/")[-2] |
|
|
|
subsection = current_url.split("/")[-2] |
|
|
|
render "form/check_answers", locals: { subsection: subsection, form: form } |
|
|
|
render "form/check_answers", locals: { subsection: subsection, form: form } |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
form = @@form_handler.get_form("2021_2022") |
|
|
|
form = FormHandler.instance.get_form("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 |_errors = {}| |
|
|
|
define_method(page_key) do |_errors = {}| |
|
|
|
@case_log = CaseLog.find(params[:case_log_id]) |
|
|
|
@case_log = CaseLog.find(params[:case_log_id]) |
|
|
|