Sha256: e56aebf3159e458490688b3c3d78a9c5cb5f4fd5f0a4a21a46ac0fbe3dce6e07

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 KB

Contents

-# frozen_string_literal: true
- questions = []
- panel.items.select{ |item| item.is_a? ::Quby::Questionnaires::Entities::Question}.each do |question|
  - next if (question.hidden?) && answer.send(question.key).blank?
  - 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

7 entries across 7 versions & 1 rubygems

Version Path
quby-5.6.5 app/views/quby/v1/shared/_backbone_panel.html.haml
quby-5.6.3 app/views/quby/v1/shared/_backbone_panel.html.haml
quby-5.6.2 app/views/quby/v1/shared/_backbone_panel.html.haml
quby-5.6.1 app/views/quby/v1/shared/_backbone_panel.html.haml
quby-5.6.0 app/views/quby/v1/shared/_backbone_panel.html.haml
quby-5.5.0 app/views/quby/v1/shared/_backbone_panel.html.haml
quby-5.4.0 app/views/quby/v1/shared/_backbone_panel.html.haml