module ExerciseInputHelper def render_exercise_input_layout(exercise) render "layouts/exercise_inputs/layouts/#{exercise.layout}", exercise: exercise end def render_exercise_input_form(exercise) render "layouts/exercise_inputs/forms/#{input_form_for(exercise)}_form", exercise: exercise end def render_exercise_input_editor(form, exercise) render "layouts/exercise_inputs/editors/#{exercise.editor}", form: form, exercise: exercise end def default_content_tag_id(exercise) exercise.custom? ? 'mu-custom-editor-default-value' : 'default_content' end def render_exercise_read_only_editor(exercise, content) render "layouts/exercise_inputs/read_only_editors/#{exercise.editor}", exercise: exercise, content: content end def input_form_for(exercise) if exercise&.input_kids? 'kids' else exercise.class.name.underscore end end def should_render_exercise_tabs?(exercise, &block) !exercise.hidden? && (exercise.queriable? || exercise.extra_visible? || block&.call) end def should_render_problem_tabs?(exercise, user) should_render_exercise_tabs?(exercise) { exercise.has_messages_for? user } end def should_render_read_only_exercise_tabs?(discussion) should_render_exercise_tabs?(discussion.exercise) { discussion.has_submission? } end def should_render_message_input?(exercise, organization = Organization.current) exercise.is_a?(Problem) && !exercise.hidden? && organization.raise_hand_enabled? end def should_render_need_help_dropdown?(assignment, organization = Organization.current) !assignment.solved? && organization.ask_for_help_enabled?(assignment.submitter) end def render_submit_button(assignment) options = submit_button_options(assignment.exercise) text = t(options.t) if options.t.present? waiting_text = t(options.waiting_t) if options.waiting_t.present? %Q{