Sha256: d8c0c1f7061c1295e0360a4073df087b0d157a27786aaa2aaaa058e85b19019c
Contents?: true
Size: 964 Bytes
Versions: 26
Compression:
Stored size: 964 Bytes
Contents
-# frozen_string_literal: true - questions = [] - panel.items.select{ |item| item.is_a? ::Quby::Questionnaires::Entities::Question}.each do |question| - question_hash = question.as_json - question_hash[:options]&.map do |option| - if question.type == :check_box - option[:startChosen] = (answer.send(question.key)[option[:key].to_s] == 1) - else - option[:startChosen] = (answer.send(question.key).to_s == option[:key].to_s) - questions << question_hash :javascript $(function() { Quby.currentPanelQuestions = new Quby.Collections.Questions; var questions = #{raw questions.as_json.to_json}; var initializer = new Quby.Logic.InitQuestions(questions); Quby.currentPanelQuestions = initializer.initializeQuestions(); Quby.questions.addQuestions(Quby.currentPanelQuestions); panelProps = {panelId: '#{panel_id}', questions: Quby.currentPanelQuestions} Quby.panels.add(new Quby.Models.Panel(panelProps)); });
Version data entries
26 entries across 26 versions & 1 rubygems