quby-compiler 0.5.16 → 0.5.17
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 +13 -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 +6 -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 +2 -0
- data/lib/quby/compiler/outputs/quby_frontend_v1_serializer.rb +1 -1
- data/lib/quby/compiler/outputs/quby_frontend_v2_serializer.rb +7 -3
- 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: 4be07e6f3fabe1a0b02fbc36ea63c5ccd964519aedb08d0adaf9b6196f4f9830
|
4
|
+
data.tar.gz: 382ea4dc3bd640a7d2e92b9bb27ad1bd5b1176129eb93e84fc71ad954bb691f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e699567c3318dcc2b4cf9d7b2b44e7c05cacab8783f17e5631bfcee12d1de690aba8ab8ae3e9da93bab07be680a26f4fe9ca735af8c27ea7bbd72b79146aad9
|
7
|
+
data.tar.gz: 8ffbc7c1374528de5edefd0e35cab356c07e98b0e2f6436b0291510be9d0751971261846c7b98300290fc12689dd6a961816de16b1cebf0ff90bf6f0bce70d29
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
# 0.5.17
|
2
|
+
|
3
|
+
* Add option#label.
|
4
|
+
* quby.json
|
5
|
+
* Add option#label to option#description just in case.
|
6
|
+
* quby2.json:
|
7
|
+
* Pass options#hidden.
|
8
|
+
* Allow hr tags in prose.
|
9
|
+
* Allow all prose tags in question#description, except headers.
|
10
|
+
* Allow css_vars to be defined on questionnaire and question level.
|
11
|
+
* Add option#label
|
12
|
+
* quby2.json: Add option#label (without fallback for now, until quby2 0.9.7 is deployed everywhere).
|
13
|
+
|
1
14
|
# 0.5.16
|
2
15
|
|
3
16
|
* 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
|
@@ -140,6 +140,12 @@ module Quby
|
|
140
140
|
@questionnaire.extra_css += value
|
141
141
|
end
|
142
142
|
|
143
|
+
# css_vars("option-gap-y" => 1)
|
144
|
+
def css_vars(value)
|
145
|
+
@questionnaire.css_vars ||= {}
|
146
|
+
@questionnaire.css_vars.merge!(value)
|
147
|
+
end
|
148
|
+
|
143
149
|
def allow_switch_to_bulk(value=true)
|
144
150
|
@questionnaire.allow_switch_to_bulk = value
|
145
151
|
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
|
@@ -77,6 +78,7 @@ module Quby
|
|
77
78
|
attr_writer :leave_page_alert
|
78
79
|
attr_reader :fields
|
79
80
|
attr_accessor :extra_css
|
81
|
+
attr_accessor :css_vars
|
80
82
|
attr_accessor :allow_switch_to_bulk
|
81
83
|
attr_reader :license
|
82
84
|
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,
|
@@ -25,6 +25,7 @@ module Quby
|
|
25
25
|
validations: validations,
|
26
26
|
visibilityRules: visibility_rules.as_json,
|
27
27
|
sexpVariables: sexp_variables,
|
28
|
+
cssVars: css_vars,
|
28
29
|
}
|
29
30
|
end
|
30
31
|
|
@@ -149,6 +150,7 @@ module Quby
|
|
149
150
|
description: handle_html(question.description, type: :question_description),
|
150
151
|
contextDescription: handle_html(question.context_description, type: :prose, v1_markdown: false),
|
151
152
|
type: question_type(question),
|
153
|
+
cssVars: question.css_vars,
|
152
154
|
hidden: question.hidden?,
|
153
155
|
displayModes: question.display_modes,
|
154
156
|
viewSelector: question.view_selector,
|
@@ -215,8 +217,10 @@ module Quby
|
|
215
217
|
type: 'option',
|
216
218
|
key: option.key,
|
217
219
|
value: option.question.type != :check_box && option.value,
|
220
|
+
label: option.label, # TODO fallback on description and empty description if no label (after quby2 has been deployed)
|
218
221
|
description: option.question.type == :select ? option.description : handle_html(option.description),
|
219
|
-
questions: option.question.type != :select && option.questions.map{ question(_1) },
|
222
|
+
questions: option.question.type != :select && option.questions.map{ question(_1) },
|
223
|
+
hidden: option.hidden.presence,
|
220
224
|
viewId: option.view_id
|
221
225
|
}.compact
|
222
226
|
end
|
@@ -252,9 +256,9 @@ module Quby
|
|
252
256
|
when :simple
|
253
257
|
html_sanitizer.sanitize(html, tags: %w[strong em sup sub br span], attributes: %w[class])
|
254
258
|
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])
|
259
|
+
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
260
|
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])
|
261
|
+
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
262
|
end
|
259
263
|
elsif v1_markdown
|
260
264
|
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.17
|
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-16 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
|