Browse Source

refactor

CLDC-1324
Kat 2 years ago
parent
commit
33a46d3608
  1. 2
      app/controllers/form_controller.rb
  2. 4
      app/controllers/lettings_logs_controller.rb
  3. 4
      app/controllers/logs_controller.rb
  4. 6
      app/controllers/sales_logs_controller.rb

2
app/controllers/form_controller.rb

@ -13,7 +13,7 @@ class FormController < ApplicationController
session[:errors] = session[:fields] = nil
redirect_to(successful_redirect_path)
else
redirect_path = @log.status == "not_started" ? "#{@log.model_name.param_key}s_new_#{@page.id}_path" : "#{@log.model_name.param_key}_#{@page.id}_path"
redirect_path = @log.not_started? ? "#{@log.model_name.param_key}s_new_#{@page.id}_path" : "#{@log.model_name.param_key}_#{@page.id}_path"
mandatory_questions_with_no_response.map do |question|
@log.errors.add question.id.to_sym, question.unanswered_error_message
end

4
app/controllers/lettings_logs_controller.rb

@ -89,10 +89,6 @@ class LettingsLogsController < LogsController
private
def new_log_request?
request.path.include?("new-log")
end
def permitted_log_params
params.require(:lettings_log).permit(LettingsLog.editable_fields)
end

4
app/controllers/logs_controller.rb

@ -69,4 +69,8 @@ private
def search_term
params["search"]
end
def new_log_request?
request.path.include?("new-log")
end
end

6
app/controllers/sales_logs_controller.rb

@ -47,10 +47,4 @@ class SalesLogsController < LogsController
def permitted_log_params
params.require(:sales_log).permit(SalesLog.editable_fields)
end
private
def new_log_request?
request.path.include?("new-log")
end
end

Loading…
Cancel
Save