glib-web 6.10.1 → 6.10.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: 50357c0c3002870707a68fad3a956248fb13cfb638395068ab970c0a7ee930ed
4
- data.tar.gz: d04d1755a167f4d46c18aec66c958050c324192ee847b0ab0ed930ffd7ab2f7e
3
+ metadata.gz: a644c2f81a6edaeaf5bb946f57402098bab2f8e841392a57568a76244856be89
4
+ data.tar.gz: 03ab9e4058180c9ecd70f14d6a26e488ca56dcdc1388175393f24c8ed5d4176b
5
5
  SHA512:
6
- metadata.gz: b72912d4e0dbe1fceb6d2180c292c390567a1c0d5ccc8e5f80bd20fa579d48b87cb0455a7ea3849469e24fbdb6ca90d5059e4c2799de0e0ab0dd15aa3c1e9430
7
- data.tar.gz: fd855eb185f11b6d6e73becf6ab91ef1de85c78e957ae653e6f7a6e6bc9cb07eaa869f5f01142d8e73f674553dc621c4ebc517ce1b8bb4f76359a1571ca5bb60
6
+ metadata.gz: 13fb675a42739c4d67d50b26a359a6cc4136fc695c0f2730d2c21e721b193f955335a39bcab550704bc29cbfb3073569154b7c08b45924de5c576036842fb965
7
+ data.tar.gz: 1610d45e4b2e60d70475115ca741929585939c847108f46e7b5c209cbc5bff7292720ad85e3eced53f43a43efd2c9bb5756ac3067bab586fe0db17a07177efb0
@@ -909,23 +909,41 @@ class Glib::JsonUi::ViewBuilder
909
909
  # width: 220,
910
910
  # height: 100
911
911
  #
912
- # @note The field deliberately has no pre-populated value: a saved
913
- # signature is a signed id that cannot be redrawn from the canvas.
914
- # Resize it via `components_set`/`logics_set` with `width`/`height`.
912
+ # @note A saved signature is a signed id that cannot be redrawn from the
913
+ # canvas: when a record is re-edited the field pre-populates `value`
914
+ # with the existing attachment's signed id (the component renders a
915
+ # read-only preview instead of ink). An untouched field therefore
916
+ # re-submits that same signed id, so consumers should treat a
917
+ # same-signed-id re-attach as "no change". Resize it via
918
+ # `components_set`/`logics_set` with `width`/`height`.
915
919
  #
916
920
  # @see app/views/json_ui/garage/test_page/fields_sign.json.jbuilder Garage examples
917
921
  class Sign < AbstractField
918
922
  string :directUploadUrl
919
923
  required :directUploadUrl
920
924
 
921
- # Enables the Type tab. `name` is the param the typed name is submitted
922
- # under; `value` pre-populates it; `label`/`placeholder` decorate the
923
- # text input in the dialog.
924
- hash :typedName, required: [:name], optional: [:value, :label, :placeholder]
925
+ # URL of an already-attached signature image to display as a read-only
926
+ # preview (typically `file_url(attachment)` when re-editing a record
927
+ # that has a drawn signature). Pair with `prop:` so the field also
928
+ # submits the existing signed id when left untouched.
929
+ string :fileUrl
930
+
931
+ # Enables the Type tab. `value` pre-populates the previously typed
932
+ # name; `label`/`placeholder` decorate the text input in the dialog.
933
+ # `name` is still accepted but unused: the typed name is submitted
934
+ # through the field's own param (single-param contract), and the
935
+ # server routes it to the name attribute.
936
+ hash :typedName, optional: [:name, :value, :label, :placeholder]
925
937
 
926
938
  # Override
927
- # Signature field doesn't have default value
928
- def value(value)
939
+ # A stored signature is an attachment -- submit its signed id (mirrors
940
+ # File#determine_value) so re-editing a signed submission pre-fills the
941
+ # field with the existing blob's signed id instead of serializing the
942
+ # whole attachment proxy.
943
+ def determine_value(context, prop)
944
+ if (value = context.field_value(prop)).attached?
945
+ value.signed_id || ''
946
+ end
929
947
  end
930
948
  end
931
949
 
@@ -1,5 +1,8 @@
1
1
  json.title 'Test Page (Fields Sign)'
2
2
 
3
+ # 60x20 ink stand-in used by the pre-filled examples.
4
+ preview_data_uri = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAAUCAYAAADRA14pAAAAoklEQVR4nO2XUQrAIAxDcwjvf9WNfQzG1NFqUt1mwL8a8hBtxfYzYXSAaC1glVJK2RohOXAJdCS4FNgCGw0tA7YAjQCXAHsBoqAPbzpwa3A19OkLpjkjsAL66gmWOTOo0gtvOJXe/VcP9JpH3DvmewBLkdeUKfaLD09xqSaid7bkqilrS57pKHJCYmWq9uFZQD2ZLLkeB49ZQO/qybX+w1/XDujJvn2bufeCAAAAAElFTkSuQmCC'
5
+
3
6
  page = json_ui_page json
4
7
 
5
8
  render 'json_ui/garage/test_page/header', json: json, page: page
@@ -26,7 +29,10 @@ page.body(
26
29
  id: 'signature_main',
27
30
  name: 'user[signature]',
28
31
  label: 'Your signature',
29
- typedName: { name: 'user[signature_name]', label: 'Type your full name', placeholder: 'Full name' },
32
+ # Single-param contract: the typed name is submitted through the
33
+ # field's own param, so typedName carries only the input's
34
+ # decoration and pre-filled value.
35
+ typedName: { label: 'Type your full name', placeholder: 'Full name' },
30
36
  directUploadUrl: glib_direct_uploads_url,
31
37
  width: 320,
32
38
  height: 160,
@@ -148,6 +154,46 @@ page.body(
148
154
  width: 220,
149
155
  height: 100
150
156
  )
157
+
158
+ form.spacer height: 12
159
+ form.hr width: 'matchParent'
160
+ form.spacer height: 12
161
+
162
+ form.h2 text: 'Pre-filled (re-edit)'
163
+ form.spacer height: 8
164
+ form.label text: 'A saved signature: value carries the signed id, fileUrl renders the preview.'
165
+ form.spacer height: 8
166
+ form.fields_sign(
167
+ id: 'signature_prefilled',
168
+ name: 'user[signature_prefilled]',
169
+ # A stand-in for the signed id the Sign builder derives from
170
+ # `prop:` on a re-edit (see Sign#determine_value).
171
+ value: 'prefilled-signed-id',
172
+ fileUrl: preview_data_uri,
173
+ typedName: { label: 'Type your full name', placeholder: 'Full name' },
174
+ directUploadUrl: glib_direct_uploads_url,
175
+ width: 320,
176
+ height: 160
177
+ )
178
+
179
+ form.spacer height: 12
180
+ form.hr width: 'matchParent'
181
+ form.spacer height: 12
182
+
183
+ form.h2 text: 'Read-only (pre-filled)'
184
+ form.spacer height: 8
185
+ form.label text: 'A saved signature on a read-only field: the preview shows, the edit overlay does not.'
186
+ form.spacer height: 8
187
+ form.fields_sign(
188
+ id: 'signature_readonly',
189
+ name: 'user[signature_readonly]',
190
+ value: 'readonly-signed-id',
191
+ fileUrl: preview_data_uri,
192
+ directUploadUrl: glib_direct_uploads_url,
193
+ width: 320,
194
+ height: 160,
195
+ readOnly: true
196
+ )
151
197
  end
152
198
  )
153
199
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.10.1
4
+ version: 6.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-09-05 00:00:00.000000000 Z
11
+ date: 2026-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activestorage