-# frozen_string_literal: true - insert = nil - subq = question.options.last.questions.first - if subq&.presentation == :next_to_title and subq.type == :string -insert = render :partial => "quby/v1/shared/inline_text_field", :locals => {:answer => @answer, :question => subq} = render :partial => "quby/v1/shared/main_label", :locals => {:question => question, :title_insert => insert} - show_values = question.show_values_in_mode? :paged .description-and-fields .description - unless question.description.blank? = Quby::MarkdownParser.new(question.description).html_safe .fields{:id => question.html_id} - question.options.each do |opt| - if opt.inner_title .inner-title = Quby::MarkdownParser.new(opt.description).html_safe - else - checked = @answer.send(opt.key) == 1 - next if( opt.hidden and not checked) .option{:for => question.key, :class => show_values ? "show_values" : nil} .radiocheckwrapper - handlers = '' - if question.uncheck_all_option == opt.key - handlers = "setAllCheckboxes(this.checked, '#{question.check_all_option}', '#{question.uncheck_all_option}', '#{question.key}', false);" - elsif question.check_all_option == opt.key - handlers = "setAllCheckboxes(this.checked, '#{question.check_all_option}', '#{question.uncheck_all_option}', '#{question.key}', true);" - else - handlers = "correctAllNothingCheckboxes(this.checked, '#{question.check_all_option}', '#{question.uncheck_all_option}');" - handlers += " handleDisableCheckboxSubQuestions(this);" - if question.maximum_checked_allowed - handlers += " handleMaximumCheckedAllowed(this, #{question.maximum_checked_allowed});" - attrs = {onClick: handlers, class: subquestion ? 'subinput' : '', data: {'field-key' => opt.key}} - if disabled - attrs[:disabled] = "" - attrs[:class] = question.type = check_box(:answer, "#{opt.key}", attrs) - if show_values .value= opt.value .labelwrapper %label{for: opt.view_id} %span = Quby::MarkdownParser.new(opt.description).html_safe - unless opt.questions.empty? .subquestions= render :partial => "quby/v1/paged/item", :collection => opt.questions, :locals => {:subquestion => true, :disabled => !checked}