quby-compiler 0.6.1 → 0.6.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 204fe4926804a88d4ba8889a7dc644cf0e6e526f4f0535b066e78cc47fb1dee3
4
- data.tar.gz: 0fc9f69f7305608de6b1349c3b283da728bea6037689c8d4272012ec56cc23e7
3
+ metadata.gz: fdf056bcbbea1730c248d8cfb73d3fc7b51ff2f4ead55bd02781d6c81d1e5505
4
+ data.tar.gz: c974d4e4c67f8582325eaaf630ad71f4d7859a7835a15e125fb5407ad87e3b10
5
5
  SHA512:
6
- metadata.gz: 24e4d191808d82cd3185d7aa645579af39906b38d02c3bfef736a1d42b49c867086f9a7ac23c6275e7b8918655997edd7b1b1b5b5b3b6d91f47e2e9f89c984a6
7
- data.tar.gz: 0f888b7293af6f9e5a7dc35fc935c8008af5c61682756a78c8e00fcfa07e19c7de0148ea85971f36b3879f29f5ea3a5a65f8033dcca1f448a0c0a9c0fb772cd4
6
+ metadata.gz: 107f7a4d9cc66dd69c8acde899737d1111c82e1e4e520916a9325372d2f181e64795448b192ecd7d6073641d4bead30ec6d3bfcfd56d01b72fd4d1179f9e8568
7
+ data.tar.gz: 614dd011da028989a99c8c43fafce188c9662b205c15241e8df5489479afe1a433287eb984a2ed3a192716bc15ffe5fb29c8e84dfa6127b1f7a51544c550575e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # 0.6.2
2
+
3
+ * dsl:
4
+ * Add text option to info_blocks, so you can start with the key.
5
+ * Allow label for placeholder option.
6
+ * quby2.json
7
+ * Use . between panel/info_block key and default key for items, for more consistency. Remove double panel key for items with default key.
8
+ * Don't camelcase translation keys for quby2, no real benefit and was wrongly camelcasing html keys.
9
+
1
10
  # 0.6.1
2
11
 
3
12
  * Switch to oj for serializing, since JSON.serialize is dumb as ^%#$& (not serializing inner object)
@@ -29,6 +29,10 @@ module Quby
29
29
  info_block.items << Entities::Text.new('', html_content: value.to_s, key:)
30
30
  end
31
31
 
32
+ def text(key:, html: nil, md: nil, **options)
33
+ info_block.items << Entities::Text.new(key:, md:, html_content: html, **options)
34
+ end
35
+
32
36
  def question(key, **options, &block)
33
37
  options = default_question_options.merge(options).merge(questionnaire:)
34
38
 
@@ -53,7 +57,7 @@ module Quby
53
57
  def fallback_key
54
58
  raise "Item without key in #{info_block.key}" if questionnaire.translatable?
55
59
 
56
- "#{info_block.key}_item_#{info_block.items.size}"
60
+ "#{info_block.key}.item_#{info_block.items.size}"
57
61
  end
58
62
  end
59
63
  end
@@ -95,7 +95,7 @@ module Quby
95
95
  def fallback_key
96
96
  raise "Item without key in #{@panel.key}" if @questionnaire.translatable?
97
97
 
98
- "#{@panel.key}_item_#{@panel.items.size}"
98
+ "#{@panel.key}.item_#{@panel.items.size}"
99
99
  end
100
100
  end
101
101
  end
@@ -31,7 +31,7 @@ module Quby
31
31
  items.flat_map { |item|
32
32
  case item
33
33
  when Quby::Compiler::Entities::Text
34
- { "#{panel.key}.#{item.key}" => item.html }
34
+ { "#{item.key}" => item.html }
35
35
  when Quby::Compiler::Entities::Question
36
36
  questions_for_question(item).flat_map { |question|
37
37
  question_locale_values(question, panel:)
@@ -178,10 +178,11 @@ module Quby
178
178
  end
179
179
 
180
180
  def select_question(question)
181
+ placeholder = question.all_options.find(&:placeholder)
181
182
  {
182
183
  **base_question(question),
183
184
  children: children(question),
184
- placeholder: question.all_options.find { _1.placeholder }&.description,
185
+ placeholder: placeholder&.label || placeholder&.description,
185
186
  }.compact
186
187
  end
187
188
 
@@ -330,8 +331,7 @@ module Quby
330
331
  key.ends_with?("context_free_title") \
331
332
  || key.ends_with?("context_free_description") \
332
333
  || key == "short_description"
333
- } \
334
- .transform_keys! { |k| k.to_s.split('.').tap{ _1[-1] = _1[-1].camelize(:lower) }.join('.') }
334
+ }
335
335
  }
336
336
  end
337
337
 
@@ -1,5 +1,5 @@
1
1
  module Quby
2
2
  module Compiler
3
- VERSION = "0.6.1"
3
+ VERSION = "0.6.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quby-compiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Veldthuis