quby-compiler 0.5.16 → 0.5.18
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 +18 -0
- data/lib/quby/compiler/dsl/merge(values(:v_1, :v_2), values(v_4).rb +16 -0
- data/lib/quby/compiler/dsl/questionnaire_builder.rb +10 -0
- data/lib/quby/compiler/entities/question.rb +4 -0
- data/lib/quby/compiler/entities/question_option.rb +2 -0
- data/lib/quby/compiler/entities/questionnaire.rb +3 -0
- data/lib/quby/compiler/entities/sexp_variables.rb +1 -1
- data/lib/quby/compiler/outputs/quby_frontend_v1_serializer.rb +1 -1
- data/lib/quby/compiler/outputs/quby_frontend_v2_serializer.rb +9 -4
- data/lib/quby/compiler/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 168356d0b927759c32a749e4ada4abd56817009e2f232bfc88acaceb95d7ac7d
|
4
|
+
data.tar.gz: 6d9d11e31936ff6dc2ab8a78e17709a07bdef35135bbbfebc8e7ec8a59ab0140
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b0a3ec50fdbc0b2c2c48e9c64c75439239acfa8bfbb534f17d479a8c97ccac39ad25516ed498904fefd9b82085fdaeb86563553b784e84a12b10dc396d1d39b
|
7
|
+
data.tar.gz: 48551cd16d4d780348ed7e3634fee6515dfece2a3d13c4a6eb9f6b4fd02beef1036f66481894b648474683d3da09dcf3188dbfb483f85fcde48a54bba9ca2f4b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
# 0.5.18
|
2
|
+
|
3
|
+
* add footer (quby2 only)
|
4
|
+
* fix sexp_variable, op needs to be number for float/integer scalars
|
5
|
+
|
6
|
+
# 0.5.17
|
7
|
+
|
8
|
+
* Add option#label.
|
9
|
+
* quby.json
|
10
|
+
* Add option#label to option#description just in case.
|
11
|
+
* quby2.json:
|
12
|
+
* Pass options#hidden.
|
13
|
+
* Allow hr tags in prose.
|
14
|
+
* Allow all prose tags in question#description, except headers.
|
15
|
+
* Allow css_vars to be defined on questionnaire and question level.
|
16
|
+
* Add option#label
|
17
|
+
* quby2.json: Add option#label (without fallback for now, until quby2 0.9.7 is deployed everywhere).
|
18
|
+
|
1
19
|
# 0.5.16
|
2
20
|
|
3
21
|
* add integer as split_to_units option, with units and conversions as attributes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
merge(values(:v_1, :v_2), values(v_4).recode(1 => 3)).sum
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
divide(value(:v_2), multiply(value(:v_1), value(:v_1)))
|
6
|
+
|
7
|
+
w / l * l
|
8
|
+
|
9
|
+
|
10
|
+
sexp_variable :key1 do
|
11
|
+
foo = values(:v_1, :v_2)
|
12
|
+
bar = recode(foo, 1 => 3)
|
13
|
+
bla = merge(foo, bar)
|
14
|
+
sum(bla)
|
15
|
+
|
16
|
+
end
|
@@ -71,6 +71,10 @@ module Quby
|
|
71
71
|
@questionnaire.short_description = description
|
72
72
|
end
|
73
73
|
|
74
|
+
def footer(footer)
|
75
|
+
@questionnaire.footer = footer
|
76
|
+
end
|
77
|
+
|
74
78
|
def sbg_key(sbg_key)
|
75
79
|
@questionnaire.sbg_key = sbg_key
|
76
80
|
end
|
@@ -140,6 +144,12 @@ module Quby
|
|
140
144
|
@questionnaire.extra_css += value
|
141
145
|
end
|
142
146
|
|
147
|
+
# css_vars("option-gap-y" => 1)
|
148
|
+
def css_vars(value)
|
149
|
+
@questionnaire.css_vars ||= {}
|
150
|
+
@questionnaire.css_vars.merge!(value)
|
151
|
+
end
|
152
|
+
|
143
153
|
def allow_switch_to_bulk(value=true)
|
144
154
|
@questionnaire.allow_switch_to_bulk = value
|
145
155
|
end
|
@@ -30,6 +30,9 @@ module Quby
|
|
30
30
|
# How should we display this question
|
31
31
|
attr_accessor :as
|
32
32
|
|
33
|
+
# extra styling options
|
34
|
+
attr_accessor :css_vars
|
35
|
+
|
33
36
|
# To hide old questions
|
34
37
|
attr_accessor :hidden
|
35
38
|
validates :hidden, inclusion: {in: [true, false, nil], message: "must be boolean"}
|
@@ -164,6 +167,7 @@ module Quby
|
|
164
167
|
@cols = options[:cols] || 40
|
165
168
|
@default_invisible = options[:default_invisible] || false
|
166
169
|
@labels ||= []
|
170
|
+
@css_vars = options[:css_vars]
|
167
171
|
|
168
172
|
@col_span = options[:col_span] || 1
|
169
173
|
@row_span = options[:row_span] || 1
|
@@ -12,6 +12,7 @@ module Quby
|
|
12
12
|
attr_reader :key
|
13
13
|
attr_reader :value
|
14
14
|
validates :value, numericality: {allow_nil: true} # nil for checkbox questions.
|
15
|
+
attr_reader :label
|
15
16
|
attr_reader :description, :context_free_description
|
16
17
|
attr_reader :questions
|
17
18
|
# for scale/radio/checbox questions, piece of of html that is rendered between the options
|
@@ -32,6 +33,7 @@ module Quby
|
|
32
33
|
@key = key
|
33
34
|
@question = question
|
34
35
|
@value = options[:value]
|
36
|
+
@label = options[:label]
|
35
37
|
@description = options[:description]
|
36
38
|
@context_free_description = options[:context_free_description]
|
37
39
|
@questions = []
|
@@ -40,6 +40,7 @@ module Quby
|
|
40
40
|
@license = :unknown
|
41
41
|
@layout_version = nil
|
42
42
|
@extra_css = ""
|
43
|
+
@css_vars = nil
|
43
44
|
@allow_switch_to_bulk = false
|
44
45
|
@panels = []
|
45
46
|
@flags = {}.with_indifferent_access
|
@@ -64,6 +65,7 @@ module Quby
|
|
64
65
|
attr_accessor :description
|
65
66
|
attr_accessor :outcome_description
|
66
67
|
attr_accessor :short_description
|
68
|
+
attr_accessor :footer
|
67
69
|
attr_writer :roqua_keys
|
68
70
|
attr_accessor :sbg_key # not required to be unique
|
69
71
|
attr_accessor :sbg_domains
|
@@ -77,6 +79,7 @@ module Quby
|
|
77
79
|
attr_writer :leave_page_alert
|
78
80
|
attr_reader :fields
|
79
81
|
attr_accessor :extra_css
|
82
|
+
attr_accessor :css_vars
|
80
83
|
attr_accessor :allow_switch_to_bulk
|
81
84
|
attr_reader :license
|
82
85
|
attr_accessor :licensor
|
@@ -192,7 +192,7 @@ module Quby
|
|
192
192
|
{
|
193
193
|
key: option.key,
|
194
194
|
value: option.value,
|
195
|
-
description: option.description,
|
195
|
+
description: option.label ? "#{option.label} #{option.description}" : option.description,
|
196
196
|
context_free_description: option.context_free_description,
|
197
197
|
questions: option.questions.map {|question| question_as_json(question)},
|
198
198
|
inner_title: option.inner_title,
|
@@ -18,6 +18,7 @@ module Quby
|
|
18
18
|
language: language || "nl",
|
19
19
|
description: description,
|
20
20
|
shortDescription: short_description,
|
21
|
+
footer: footer,
|
21
22
|
defaultAnswerValue: Services::TransformQuby1ValuesIntoQuby2Values.run!(@questionnaire, default_answer_value),
|
22
23
|
panels: panels.map { panel(_1) },
|
23
24
|
questions: questions,
|
@@ -25,7 +26,8 @@ module Quby
|
|
25
26
|
validations: validations,
|
26
27
|
visibilityRules: visibility_rules.as_json,
|
27
28
|
sexpVariables: sexp_variables,
|
28
|
-
|
29
|
+
cssVars: css_vars,
|
30
|
+
}.compact
|
29
31
|
end
|
30
32
|
|
31
33
|
def panel(panel)
|
@@ -149,6 +151,7 @@ module Quby
|
|
149
151
|
description: handle_html(question.description, type: :question_description),
|
150
152
|
contextDescription: handle_html(question.context_description, type: :prose, v1_markdown: false),
|
151
153
|
type: question_type(question),
|
154
|
+
cssVars: question.css_vars,
|
152
155
|
hidden: question.hidden?,
|
153
156
|
displayModes: question.display_modes,
|
154
157
|
viewSelector: question.view_selector,
|
@@ -215,8 +218,10 @@ module Quby
|
|
215
218
|
type: 'option',
|
216
219
|
key: option.key,
|
217
220
|
value: option.question.type != :check_box && option.value,
|
221
|
+
label: option.label, # TODO fallback on description and empty description if no label (after quby2 has been deployed)
|
218
222
|
description: option.question.type == :select ? option.description : handle_html(option.description),
|
219
|
-
questions: option.question.type != :select && option.questions.map{ question(_1) },
|
223
|
+
questions: option.question.type != :select && option.questions.map{ question(_1) },
|
224
|
+
hidden: option.hidden.presence,
|
220
225
|
viewId: option.view_id
|
221
226
|
}.compact
|
222
227
|
end
|
@@ -252,9 +257,9 @@ module Quby
|
|
252
257
|
when :simple
|
253
258
|
html_sanitizer.sanitize(html, tags: %w[strong em sup sub br span], attributes: %w[class])
|
254
259
|
when :question_description
|
255
|
-
html_sanitizer.sanitize(html, tags: %w[strong em b i u sup sub p span br ul ol li], attributes: %w[class])
|
260
|
+
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])
|
256
261
|
when :prose
|
257
|
-
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], attributes: %w[href class target])
|
262
|
+
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])
|
258
263
|
end
|
259
264
|
elsif v1_markdown
|
260
265
|
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.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marten Veldthuis
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-04-22 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: activemodel
|
@@ -150,6 +150,7 @@ files:
|
|
150
150
|
- lib/quby/compiler/dsl/charting/overview_chart_builder.rb
|
151
151
|
- lib/quby/compiler/dsl/charting/radar_chart_builder.rb
|
152
152
|
- lib/quby/compiler/dsl/helpers.rb
|
153
|
+
- lib/quby/compiler/dsl/merge(values(:v_1, :v_2), values(v_4).rb
|
153
154
|
- lib/quby/compiler/dsl/panel_builder.rb
|
154
155
|
- lib/quby/compiler/dsl/question_builder.rb
|
155
156
|
- lib/quby/compiler/dsl/questionnaire_builder.rb
|