diff --git a/app/controllers/quiz_controller.rb b/app/controllers/quiz_controller.rb
index ded3f47..0a8ce09 100644
--- a/app/controllers/quiz_controller.rb
+++ b/app/controllers/quiz_controller.rb
@@ -51,8 +51,7 @@ class QuizController < ApplicationController
:radio,
:text,
checkbox: [],
- live_code: [:later, :html, :css, :js],
- live_code_text: [:later, :html, :css, :js, :text]
+ live_code: [:later, :html, :css, :js, :text]
)
end
diff --git a/app/validators/answer_format_validator.rb b/app/validators/answer_format_validator.rb
index 4a46672..4d62810 100644
--- a/app/validators/answer_format_validator.rb
+++ b/app/validators/answer_format_validator.rb
@@ -36,37 +36,12 @@ class AnswerFormatValidator < ActiveModel::EachValidator
record.errors[attribute] << (options[:message] || live_code_error_message(value))
end
- def live_code_text record, attribute, value
- return if value.present? && live_code_text_value_check(value)
-
- record.errors[attribute] << (options[:message] || live_code_text_error_message(value))
- end
-
#################################
- def live_code_text_error_message value
- return 'You must write code in one of the above textareas to progress.' if value.nil?
-
- code_present = value.values_at(:html, :css, :js).join.present?
- reason_present = value[:text].present?
- later_present = value.keys.count == 1
- return 'Please check that you will come back to complete the code example.' if later_present
- return 'You must write code in one of the above textareas to progress.' unless code_present
- return 'You must provide an answer in the reason field.' unless reason_present
- end
-
def live_code_error_message value
if value.present? && value.keys.count == 1
return "Please check that you will come back to complete the code example."
end
- "You must write code in one of the above textareas to progress."
- end
-
- def live_code_text_value_check value
- later_present = value[:later].present? && value.keys.count == 1
- code_present = value.values_at(:html, :css, :js).join.present?
- reason_present = value[:text].present?
-
- later_present || (code_present && reason_present)
+ "You must write comments or code in one of the textareas to progress."
end
end
diff --git a/app/views/quiz/_live_code.html.erb b/app/views/quiz/_live_code.html.erb
index 897125b..918f0ec 100644
--- a/app/views/quiz/_live_code.html.erb
+++ b/app/views/quiz/_live_code.html.erb
@@ -30,9 +30,12 @@