glib-web 3.16.0 → 3.16.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d5b87ed40b6899921ff69c27b36f7a7fdbd5bda372cc66e862fa118e5b3829e
|
4
|
+
data.tar.gz: d48ca7297c13cb43a969e274bf3090cd72bfed50dda1fa150de961db3cb53dfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93ec58c318c1568c69dcd7007b1cff9effd8a7048e885cf10df17c3065c7ad64d37220d8c30e9a44af01d592664f18d617832da3b88297e779893954f6aa95aa
|
7
|
+
data.tar.gz: 1aecb33728606c762df28283bfab3b21399748f27b9a709158a13859e8cd147031eee7cdfd71ada6d10f56fe13450f8f1615f175fb1648363fefbc03402dcec9
|
@@ -311,11 +311,13 @@ class Glib::JsonUi::ViewBuilder
|
|
311
311
|
json.hint @hint if @hint
|
312
312
|
|
313
313
|
if @prop && (form = page.current_form)
|
314
|
-
|
315
|
-
|
314
|
+
association = form.nested_associations.last
|
315
|
+
context = association || form
|
316
316
|
|
317
|
-
|
317
|
+
@files ||= context.field_value(@prop, collect_ids: false).to_a.map { |file| { name: file.blob&.filename, signed_id: file.signed_id } }
|
318
318
|
end
|
319
|
+
|
320
|
+
json.files @files if @files.present?
|
319
321
|
end
|
320
322
|
end
|
321
323
|
|
@@ -34,8 +34,6 @@ class Glib::JsonUi::ViewBuilder
|
|
34
34
|
|
35
35
|
def field_assert_respond_to(prop)
|
36
36
|
self.class.field_assert_respond_to(@model, prop)
|
37
|
-
# # Identify a prop being used on a nil model or incorrect model.
|
38
|
-
# raise "Invalid property `#{prop}` on '#{@model.class}'" unless @model.respond_to?(prop)
|
39
37
|
end
|
40
38
|
|
41
39
|
def self.field_assert_respond_to(model, prop)
|
@@ -74,12 +72,12 @@ class Glib::JsonUi::ViewBuilder
|
|
74
72
|
"#{name}[#{prop}]#{suffix}"
|
75
73
|
end
|
76
74
|
|
77
|
-
def field_value(prop)
|
78
|
-
self.class.field_value(@model, prop)
|
75
|
+
def field_value(prop, collect_ids: true)
|
76
|
+
self.class.field_value(@model, prop, collect_ids: collect_ids)
|
79
77
|
end
|
80
78
|
|
81
|
-
def self.field_value(model, prop)
|
82
|
-
if is_array_association?(model, prop)
|
79
|
+
def self.field_value(model, prop, collect_ids:)
|
80
|
+
if is_array_association?(model, prop) && collect_ids
|
83
81
|
model.send(prop)&.map { |record| record.id }
|
84
82
|
else
|
85
83
|
model.send(prop)
|
@@ -384,8 +382,8 @@ class Glib::JsonUi::ViewBuilder
|
|
384
382
|
@delegate_class.field_name(@model, prop, multiple, page)
|
385
383
|
end
|
386
384
|
|
387
|
-
def field_value(prop)
|
388
|
-
@delegate_class.field_value(@model, prop)
|
385
|
+
def field_value(prop, collect_ids: true)
|
386
|
+
@delegate_class.field_value(@model, prop, collect_ids: collect_ids)
|
389
387
|
end
|
390
388
|
|
391
389
|
def field_label(prop, args)
|
@@ -41,7 +41,7 @@ page.form options.merge(childViews: ->(form) do
|
|
41
41
|
name: 'user[multi][]',
|
42
42
|
accepts: { fileType: 'image', maxFileSize: 5000 },
|
43
43
|
directUploadUrl: rails_direct_uploads_url,
|
44
|
-
uploadTitle: '
|
44
|
+
uploadTitle: 'Files uploaded:',
|
45
45
|
uploadFailedText: '(UPLOAD FAILED)',
|
46
46
|
files: [
|
47
47
|
{ name: 'File (Example)', signed_id: ActiveStorage::Attachment.last&.signed_id }
|