quby-compiler 0.5.25 → 0.5.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/quby/compiler/dsl/questions/base.rb +30 -0
- data/lib/quby/compiler/dsl/questions/float_question_builder.rb +1 -0
- data/lib/quby/compiler/dsl/questions/integer_question_builder.rb +1 -0
- data/lib/quby/compiler/dsl/questions/radio_question_builder.rb +1 -0
- data/lib/quby/compiler/dsl/questions/select_question_builder.rb +1 -0
- data/lib/quby/compiler/entities/question.rb +2 -0
- data/lib/quby/compiler/entities/visibility_rule.rb +2 -0
- data/lib/quby/compiler/outputs/quby_frontend_v2_serializer.rb +3 -3
- data/lib/quby/compiler/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb03f5addb141e1e202837e24ca40e98f9e9c8e2560eccfbdd3685dbe88d2f4a
|
4
|
+
data.tar.gz: 4d5b0f40b267fc8e2b538edcb0e7af777fb63df221aa982f8fb8a8f2c334491f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdc2a846329dd4f32cbbdaf6b29eac0112d02777c1105773321c864addef32158005b1660ad6012ae83ccfeea0d5e5e18c730b6737b911a432d5f9ca768f0c10
|
7
|
+
data.tar.gz: be50d806c0711d615bf3dc2de53d1646253e945345c73f984e8111b4cf0af2edc93dca50ecaa5157e9fdd8d3c011b8efee00a7018c5d2587f9b291ab99c1b0ee
|
data/CHANGELOG.md
CHANGED
@@ -83,6 +83,36 @@ module Quby
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
+
module CompareVisibilityRule
|
87
|
+
def compare_value(op:, value:, show_questions: [], hide_questions: [])
|
88
|
+
raise "unknown op #{op} for #{@question.key}" unless %i[gt gteq lt lteq eq].include?(op)
|
89
|
+
condition = {
|
90
|
+
type: 'numeric_compare',
|
91
|
+
field_key: @question.key,
|
92
|
+
op:,
|
93
|
+
value:
|
94
|
+
}
|
95
|
+
show_questions.each do |show_key|
|
96
|
+
@question.visibility_rules << Entities::VisibilityRule.new(
|
97
|
+
condition:,
|
98
|
+
action: {
|
99
|
+
type: 'show_question',
|
100
|
+
field_key: show_key
|
101
|
+
}
|
102
|
+
)
|
103
|
+
end
|
104
|
+
hide_questions.each do |hide_key|
|
105
|
+
@question.visibility_rules << Entities::VisibilityRule.new(
|
106
|
+
condition:,
|
107
|
+
action: {
|
108
|
+
type: 'hide_question',
|
109
|
+
field_key: hide_key
|
110
|
+
}
|
111
|
+
)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
86
116
|
module Labeling
|
87
117
|
def label(value)
|
88
118
|
@question.labels << value
|
@@ -69,6 +69,7 @@ module Quby
|
|
69
69
|
|
70
70
|
# Structuring
|
71
71
|
attr_accessor :validations
|
72
|
+
attr_reader :visibility_rules # Quby2 only
|
72
73
|
attr_accessor :dependencies
|
73
74
|
|
74
75
|
# To display unit for number items
|
@@ -150,6 +151,7 @@ module Quby
|
|
150
151
|
@display_modes = options[:display_modes]
|
151
152
|
@presentation = options[:presentation]
|
152
153
|
@validations = []
|
154
|
+
@visibility_rules = []
|
153
155
|
@parent = options[:parent]
|
154
156
|
@hidden = options[:hidden]
|
155
157
|
@table = options[:table]
|
@@ -4,6 +4,8 @@ module Quby
|
|
4
4
|
class VisibilityRule
|
5
5
|
def self.from(question)
|
6
6
|
[].tap do |rules|
|
7
|
+
rules.concat question.visibility_rules
|
8
|
+
|
7
9
|
# Transform "default invisible" into just being hidden by itself,
|
8
10
|
# since any other question showing it will take precedence anyway.
|
9
11
|
if question.default_invisible
|
@@ -331,11 +331,11 @@ module Quby
|
|
331
331
|
if layout_version == :v2
|
332
332
|
case type
|
333
333
|
when :simple
|
334
|
-
html_sanitizer.sanitize(html, tags: %w[strong em sup sub br span], attributes: %w[class])
|
334
|
+
html_sanitizer.sanitize(html, tags: %w[strong em sup sub br span img], attributes: %w[class src alt width height])
|
335
335
|
when :question_description
|
336
|
-
html_sanitizer.sanitize(html, tags: %w[strong em b i u sup sub pre blockquote p span br ul ol li a], attributes: %w[class])
|
336
|
+
html_sanitizer.sanitize(html, tags: %w[strong em b i u sup sub pre blockquote p span br ul ol li a img], attributes: %w[class href target src alt width height])
|
337
337
|
when :prose
|
338
|
-
html_sanitizer.sanitize(html, tags: %w[strong em b i u sup sub pre blockquote p span br ul ol li a h1 h2 h3 h4 hr], attributes: %w[href class target])
|
338
|
+
html_sanitizer.sanitize(html, tags: %w[strong em b i u sup sub pre blockquote p span br ul ol li a img h1 h2 h3 h4 hr], attributes: %w[href class target src alt width height])
|
339
339
|
end
|
340
340
|
elsif v1_markdown
|
341
341
|
Quby::Compiler::MarkdownParser.new(html).to_html
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quby-compiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marten Veldthuis
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-07-
|
10
|
+
date: 2025-07-29 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: activemodel
|