-# frozen_string_literal: true %label.main(for="answer_#{question.key}") = render :partial => "quby/v1/shared/main_label", :locals => {:question => question} - subq = question.options.last.questions.first - if subq&.presentation == :next_to_title and subq.type == :string = render :partial => "quby/v1/shared/inline_text_field", :locals => {:answer => @answer, :question => subq} .description-and-fields .description - unless question.description.blank? = Quby::MarkdownParser.new(question.description).html_safe .fields{:id => question.html_id, :class => "options#{question.options.size}"} - question.options.each do |opt| - next if opt.inner_title - checked = @answer.send(opt.key) == 1 - next if( opt.hidden and not checked) - cls = ["optionwidth#{question.options.size}"] - cls << "show_values" if question.show_values_in_mode? :bulk .option{ :for => question.key, :class => cls} .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] = "" = check_box(:answer, "#{opt.key}", attrs) - if question.show_values_in_mode? :bulk .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/bulk/item", :collection => opt.questions, :locals => {:subquestion => true, :disabled => !checked}