glib-web 3.16.2 → 3.16.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d5b87ed40b6899921ff69c27b36f7a7fdbd5bda372cc66e862fa118e5b3829e
4
- data.tar.gz: d48ca7297c13cb43a969e274bf3090cd72bfed50dda1fa150de961db3cb53dfa
3
+ metadata.gz: 26d2c5c409ff911326efa81f445217d859f62b5350630c28185ca4e8a0ef85ad
4
+ data.tar.gz: edb315e653b13110b2cdfb896bdbc20e980adc593155ecb8527951a8cfaf232f
5
5
  SHA512:
6
- metadata.gz: 93ec58c318c1568c69dcd7007b1cff9effd8a7048e885cf10df17c3065c7ad64d37220d8c30e9a44af01d592664f18d617832da3b88297e779893954f6aa95aa
7
- data.tar.gz: 1aecb33728606c762df28283bfab3b21399748f27b9a709158a13859e8cd147031eee7cdfd71ada6d10f56fe13450f8f1615f175fb1648363fefbc03402dcec9
6
+ metadata.gz: '05778a76d110933cd70d86343d645d680b19c48df67027affcfdd59a89cbfa7d74489826d116f450c881a9bb67059fbc83f04b22dd80edf228649e9515da0f89'
7
+ data.tar.gz: eb2db140e67e307c7cdd5a52ea48887bb5414b4949e6fa154a490822ea64863cfbe85369fc1695036976e49db0009015adb7593f600d53768ef856cbea820441
@@ -48,9 +48,6 @@ class Glib::JsonUi::ViewBuilder
48
48
  # Override
49
49
  def created
50
50
  if @prop && (form = page.current_form)
51
- association = form.nested_associations.last
52
- context = association || form
53
-
54
51
  context.field_assert_respond_to(@prop)
55
52
 
56
53
  @name ||= context.field_name(@prop, @multiple || false)
@@ -61,7 +58,7 @@ class Glib::JsonUi::ViewBuilder
61
58
 
62
59
  if form.current_dynamic_group.nil?
63
60
  # This is not relevant inside a dynamic group
64
- @value ||= context.field_value(@prop)
61
+ @value ||= determine_value(context, @prop)
65
62
  end
66
63
  end
67
64
  json.name @name
@@ -78,6 +75,16 @@ class Glib::JsonUi::ViewBuilder
78
75
  # json.validation @validation if @validation
79
76
  end
80
77
 
78
+ # To be overridden
79
+ def determine_value(context, prop)
80
+ context.field_value(prop)
81
+ end
82
+
83
+ def context
84
+ form = page.current_form
85
+ association = form.nested_associations.last
86
+ @context ||= association || form
87
+ end
81
88
  end
82
89
 
83
90
  class Text < AbstractField
@@ -168,6 +175,8 @@ class Glib::JsonUi::ViewBuilder
168
175
  bool :multiple, cache: true
169
176
  # bool :manualEntry
170
177
  hash :append
178
+
179
+ panels_builder :accessory, :header, :footer
171
180
  end
172
181
 
173
182
  class TimeZone < AbstractField
@@ -274,8 +283,17 @@ class Glib::JsonUi::ViewBuilder
274
283
 
275
284
  json.set! :buttonLabels, @buttonLabels
276
285
 
286
+ if @prop && context
287
+ json.fileTitle context.field_value(@prop).blob&.filename
288
+ end
289
+
277
290
  super
278
291
  end
292
+
293
+ @Override
294
+ def determine_value(context, prop)
295
+ context.field_value(prop)&.signed_id || ''
296
+ end
279
297
  end
280
298
 
281
299
  class MultiUpload < AbstractField
@@ -310,9 +328,9 @@ class Glib::JsonUi::ViewBuilder
310
328
  json.placeholder @placeholder if @placeholder
311
329
  json.hint @hint if @hint
312
330
 
313
- if @prop && (form = page.current_form)
314
- association = form.nested_associations.last
315
- context = association || form
331
+ if @prop && context
332
+ # association = form.nested_associations.last
333
+ # context = association || form
316
334
 
317
335
  @files ||= context.field_value(@prop, collect_ids: false).to_a.map { |file| { name: file.blob&.filename, signed_id: file.signed_id } }
318
336
  end
@@ -60,8 +60,29 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
60
60
  options << { type: 'divider' }
61
61
  end
62
62
 
63
- form.fields_select name: 'user[language]', width: 'matchParent', label: 'Primary Language', options: options, value: 'nl'
64
- form.fields_select name: 'user[languages][]', width: 'matchParent', label: 'Primary Language', options: options, value: ['ja', 'de'], multiple: true
63
+ form.fields_select \
64
+ name: 'user[language]',
65
+ width: 'matchParent',
66
+ label: 'Primary Language',
67
+ options: options,
68
+ value: 'nl',
69
+ accessory: ->(accessory) do
70
+ accessory.header padding: { x: 16, y: 10 }, childViews: ->(header) do
71
+ header.label text: 'Header'
72
+ end
73
+ accessory.footer padding: { x: 16, y: 10 }, childViews: ->(header) do
74
+ header.label text: 'Footer'
75
+ end
76
+ # footer.label text: 'TEST123'
77
+ end
78
+
79
+ form.fields_select \
80
+ name: 'user[languages][]',
81
+ width: 'matchParent',
82
+ label: 'Primary Language',
83
+ options: options,
84
+ value: ['ja', 'de'],
85
+ multiple: true
65
86
 
66
87
  form.spacer height: 20
67
88
  form.h2 text: 'Select fields with empty values'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.16.2
4
+ version: 3.16.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''