glib-web 5.0.4 → 5.0.5

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.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/glib/json_ui/view_builder/fields.rb +6 -2
  3. data/app/models/concerns/glib/enum_symbolization.rb +26 -0
  4. data/app/models/glib/application_record.rb +1 -0
  5. data/app/views/json_ui/garage/test_page/_header.json.jbuilder +31 -28
  6. data/app/views/json_ui/garage/test_page/auth.json.jbuilder +2 -1
  7. data/app/views/json_ui/garage/test_page/auto_validate.json.jbuilder +2 -1
  8. data/app/views/json_ui/garage/test_page/browsers.json.jbuilder +2 -1
  9. data/app/views/json_ui/garage/test_page/calendar.json.jbuilder +2 -1
  10. data/app/views/json_ui/garage/test_page/carousel.json.jbuilder +2 -1
  11. data/app/views/json_ui/garage/test_page/charts.json.jbuilder +2 -1
  12. data/app/views/json_ui/garage/test_page/column.json.jbuilder +2 -1
  13. data/app/views/json_ui/garage/test_page/commands.json.jbuilder +2 -1
  14. data/app/views/json_ui/garage/test_page/components.json.jbuilder +2 -1
  15. data/app/views/json_ui/garage/test_page/cookies.json.jbuilder +2 -1
  16. data/app/views/json_ui/garage/test_page/custom.json.jbuilder +2 -1
  17. data/app/views/json_ui/garage/test_page/dialog.json.jbuilder +2 -1
  18. data/app/views/json_ui/garage/test_page/dirty_state.json.jbuilder +2 -1
  19. data/app/views/json_ui/garage/test_page/fields.json.jbuilder +2 -1
  20. data/app/views/json_ui/garage/test_page/fields_captcha.json.jbuilder +2 -1
  21. data/app/views/json_ui/garage/test_page/fields_creditCard.json.jbuilder +2 -1
  22. data/app/views/json_ui/garage/test_page/fields_date_time.json.jbuilder +2 -1
  23. data/app/views/json_ui/garage/test_page/fields_dynamicSelect.json.jbuilder +2 -1
  24. data/app/views/json_ui/garage/test_page/fields_location.json.jbuilder +2 -1
  25. data/app/views/json_ui/garage/test_page/fields_otp.json.jbuilder +2 -1
  26. data/app/views/json_ui/garage/test_page/fields_phone.json.jbuilder +2 -1
  27. data/app/views/json_ui/garage/test_page/fields_radio.json.jbuilder +293 -0
  28. data/app/views/json_ui/garage/test_page/fields_rating.json.jbuilder +2 -1
  29. data/app/views/json_ui/garage/test_page/fields_richText.json.jbuilder +2 -1
  30. data/app/views/json_ui/garage/test_page/fields_select.json.jbuilder +3 -2
  31. data/app/views/json_ui/garage/test_page/fields_sign.json.jbuilder +2 -1
  32. data/app/views/json_ui/garage/test_page/fields_stripeExternalAccount.json.jbuilder +2 -1
  33. data/app/views/json_ui/garage/test_page/fields_stripeToken.json.jbuilder +2 -1
  34. data/app/views/json_ui/garage/test_page/fields_text.json.jbuilder +312 -0
  35. data/app/views/json_ui/garage/test_page/fields_timer.json.jbuilder +2 -1
  36. data/app/views/json_ui/garage/test_page/fields_upload.json.jbuilder +66 -4
  37. data/app/views/json_ui/garage/test_page/fields_url_fragment.json.jbuilder +2 -1
  38. data/app/views/json_ui/garage/test_page/flow.json.jbuilder +2 -1
  39. data/app/views/json_ui/garage/test_page/form.json.jbuilder +2 -1
  40. data/app/views/json_ui/garage/test_page/form_dynamic.json.jbuilder +2 -1
  41. data/app/views/json_ui/garage/test_page/forms.json.jbuilder +2 -1
  42. data/app/views/json_ui/garage/test_page/grid.json.jbuilder +2 -1
  43. data/app/views/json_ui/garage/test_page/horizontal.json.jbuilder +2 -1
  44. data/app/views/json_ui/garage/test_page/http.json.jbuilder +2 -1
  45. data/app/views/json_ui/garage/test_page/image.json.jbuilder +26 -2
  46. data/app/views/json_ui/garage/test_page/lifecycle.json.jbuilder +2 -1
  47. data/app/views/json_ui/garage/test_page/list.json.jbuilder +2 -1
  48. data/app/views/json_ui/garage/test_page/list_editable.json.jbuilder +2 -1
  49. data/app/views/json_ui/garage/test_page/lists_append.json.jbuilder +2 -1
  50. data/app/views/json_ui/garage/test_page/logics_set.json.jbuilder +0 -1
  51. data/app/views/json_ui/garage/test_page/multimedia_video.json.jbuilder +2 -1
  52. data/app/views/json_ui/garage/test_page/pagination.json.jbuilder +2 -1
  53. data/app/views/json_ui/garage/test_page/panels.json.jbuilder +2 -1
  54. data/app/views/json_ui/garage/test_page/panels_bulkEdit2.json.jbuilder +2 -1
  55. data/app/views/json_ui/garage/test_page/popovers.json.jbuilder +2 -1
  56. data/app/views/json_ui/garage/test_page/progressCircle.json.jbuilder +2 -1
  57. data/app/views/json_ui/garage/test_page/responsive.json.jbuilder +2 -1
  58. data/app/views/json_ui/garage/test_page/scroll.json.jbuilder +2 -1
  59. data/app/views/json_ui/garage/test_page/selectable.json.jbuilder +2 -1
  60. data/app/views/json_ui/garage/test_page/sheets.json.jbuilder +2 -1
  61. data/app/views/json_ui/garage/test_page/snackbars.json.jbuilder +2 -1
  62. data/app/views/json_ui/garage/test_page/split.json.jbuilder +2 -1
  63. data/app/views/json_ui/garage/test_page/storage_items.json.jbuilder +2 -1
  64. data/app/views/json_ui/garage/test_page/switch.json.jbuilder +56 -0
  65. data/app/views/json_ui/garage/test_page/tabBar.json.jbuilder +144 -0
  66. data/app/views/json_ui/garage/test_page/table.json.jbuilder +2 -1
  67. data/app/views/json_ui/garage/test_page/timeline.json.jbuilder +2 -1
  68. data/app/views/json_ui/garage/test_page/timeouts.json.jbuilder +9 -3
  69. data/app/views/json_ui/garage/test_page/ul.json.jbuilder +2 -1
  70. data/app/views/json_ui/garage/test_page/vertical.json.jbuilder +2 -1
  71. data/app/views/json_ui/garage/test_page/web.json.jbuilder +2 -1
  72. data/app/views/json_ui/garage/test_page/window.json.jbuilder +2 -1
  73. data/app/views/json_ui/garage/test_page/windows.json.jbuilder +2 -1
  74. data/lib/glib/json_crawler/router.rb +39 -0
  75. data/lib/glib/test_helpers.rb +68 -2
  76. metadata +6 -1
@@ -2,9 +2,10 @@ json.title 'Test Page (Fields Timer)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body(
6
8
  childViews: ->(body) do
7
- render 'json_ui/garage/test_page/header', view: body
8
9
 
9
10
  body.panels_responsive(
10
11
  padding: glib_json_padding_body,
@@ -2,9 +2,12 @@ json.title 'Test Page (Fields Upload)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ html_mode = params[:html_mode].present?
6
+
7
+ render 'json_ui/garage/test_page/header', json: json, page: page
8
+
5
9
  page.body(
6
10
  childViews: ->(body) do
7
- render 'json_ui/garage/test_page/header', view: body
8
11
 
9
12
  image = OpenStruct.new(
10
13
  url: 'https://picsum.photos/id/11/100/60',
@@ -20,7 +23,7 @@ page.body(
20
23
 
21
24
  base_props = {
22
25
  accepts: accepts,
23
- directUploadUrl: glib_direct_uploads_url,
26
+ directUploadUrl: html_mode ? nil : glib_direct_uploads_url,
24
27
  styleClass: 'pb-2',
25
28
  value: image&.signed_id
26
29
  }
@@ -71,6 +74,34 @@ page.body(
71
74
  form.hr width: 'matchParent'
72
75
  form.spacer height: 12
73
76
 
77
+ form.h2 text: 'PlaceholderView avatar'
78
+ form.spacer height: 8
79
+ form.panels_flow(
80
+ styleClass: 'align-center',
81
+ xs: { gap: { all: 4 } },
82
+ childViews: ->(flow) do
83
+ flow.fields_upload(
84
+ base_props.merge(
85
+ name: 'user[file_avatar]',
86
+ id: 'fields_upload_avatar',
87
+ placeholderView: { type: 'avatar', url: image&.url, width: 64, height: 64 }
88
+ )
89
+ )
90
+ flow.button(
91
+ text: 'Trigger',
92
+ onClick: ->(action) { action.components_invoke targetId: 'fields_upload_avatar', name: 'trigger' }
93
+ )
94
+ flow.button(
95
+ text: 'Reset',
96
+ onClick: ->(action) { action.components_invoke targetId: 'fields_upload_avatar', name: 'reset' }
97
+ )
98
+ end
99
+ )
100
+
101
+ form.spacer height: 12
102
+ form.hr width: 'matchParent'
103
+ form.spacer height: 12
104
+
74
105
  form.h2 text: 'InputView variants'
75
106
  form.spacer height: 8
76
107
  form.label text: 'Outlined text-field input'
@@ -115,7 +146,7 @@ page.body(
115
146
  label: 'Upload files',
116
147
  width: 320,
117
148
  multiProgressView: { files: [] },
118
- multiple: true
149
+ # multiple: false
119
150
  )
120
151
  )
121
152
 
@@ -128,11 +159,42 @@ page.body(
128
159
  id: 'fields_upload_multiple',
129
160
  label: 'Choose files',
130
161
  width: 320,
131
- inputView: { multiple: true },
162
+ inputView: {},
132
163
  multiple: true
133
164
  )
134
165
  )
135
166
 
167
+ form.spacer height: 12
168
+ form.hr width: 'matchParent'
169
+ form.spacer height: 12
170
+
171
+ form.h2 text: 'ClipboardView'
172
+ form.spacer height: 8
173
+ form.label text: 'Default clipboard icon'
174
+ form.spacer height: 4
175
+ form.fields_upload(
176
+ base_props.merge(
177
+ name: 'user[file_clipboard]',
178
+ id: 'fields_upload_clipboard',
179
+ label: 'Paste image',
180
+ width: 320,
181
+ clipboardView: {}
182
+ )
183
+ )
184
+
185
+ form.spacer height: 12
186
+ form.label text: 'Custom clipboard icon'
187
+ form.spacer height: 4
188
+ form.fields_upload(
189
+ base_props.merge(
190
+ name: 'user[file_clipboard_custom]',
191
+ id: 'fields_upload_clipboard_custom',
192
+ label: 'Paste image',
193
+ width: 320,
194
+ clipboardView: { icon: 'content_paste' }
195
+ )
196
+ )
197
+
136
198
  form.spacer height: 12
137
199
  form.fields_submit text: 'submit'
138
200
  end
@@ -2,9 +2,10 @@ json.title 'Test Page (Fields URL Fragment)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body(
6
8
  childViews: ->(body) do
7
- render 'json_ui/garage/test_page/header', view: body
8
9
 
9
10
  body.panels_responsive(
10
11
  padding: glib_json_padding_body,
@@ -2,8 +2,9 @@ json.title 'Test Page (Flow)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body childViews: ->(body) do
6
- render 'json_ui/garage/test_page/header', view: body
7
8
 
8
9
  body.panels_responsive padding: glib_json_padding_body, childViews: ->(res) do
9
10
  res.h2 text: 'Overview'
@@ -2,8 +2,9 @@ json.title 'Test Page (Form)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body childViews: ->(body) do
6
- render 'json_ui/garage/test_page/header', view: body
7
8
 
8
9
  body.panels_responsive padding: glib_json_padding_body, childViews: ->(res) do
9
10
  res.h2 text: 'Form'
@@ -2,8 +2,9 @@ json.title 'Test Page (Form)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body childViews: ->(body) do
6
- render 'json_ui/garage/test_page/header', view: body
7
8
 
8
9
  body.panels_responsive padding: glib_json_padding_body, childViews: ->(res) do
9
10
  res.h2 text: 'Form'
@@ -2,9 +2,10 @@ json.title 'Test Page (Forms)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body(
6
8
  childViews: ->(body) do
7
- render 'json_ui/garage/test_page/header', view: body
8
9
  body.panels_responsive(
9
10
  padding: glib_json_padding_body,
10
11
  childViews: ->(res) do
@@ -2,8 +2,9 @@ json.title 'Test Page (Grid)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body childViews: ->(body) do
6
- render 'json_ui/garage/test_page/header', view: body
7
8
 
8
9
  body.panels_responsive padding: glib_json_padding_body, childViews: ->(res) do
9
10
  res.h2 text: 'Overview'
@@ -2,8 +2,9 @@ json.title 'Test Page (Horizontal)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body childViews: ->(body) do
6
- render 'json_ui/garage/test_page/header', view: body
7
8
 
8
9
  body.panels_responsive padding: glib_json_padding_body, childViews: ->(res) do
9
10
  res.h2 text: 'Overview'
@@ -2,9 +2,10 @@ json.title 'Test Page (HTTP)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body(
6
8
  childViews: ->(body) do
7
- render 'json_ui/garage/test_page/header', view: body
8
9
  body.panels_responsive(
9
10
  padding: glib_json_padding_body,
10
11
  childViews: ->(res) do
@@ -4,9 +4,10 @@ page = json_ui_page json
4
4
 
5
5
  small_image_url = 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSGQpSWjtELISLBlmugOZ6wzl1JamYXQvbFeYywpfg3E8b8DrO0Kg&s'
6
6
 
7
+ render 'json_ui/garage/test_page/header', json: json, page: page
8
+
7
9
  page.body(
8
10
  childViews: ->(body) do
9
- render 'json_ui/garage/test_page/header', view: body
10
11
 
11
12
  body.panels_responsive(
12
13
  padding: glib_json_padding_body,
@@ -24,7 +25,10 @@ page.body(
24
25
  width: 320,
25
26
  height: 200,
26
27
  url: glib_json_image_standard_url,
27
- fit: :clip
28
+ fit: :clip,
29
+ onClick: ->(action) do
30
+ action.dialogs_alert message: 'Image clicked'
31
+ end
28
32
  )
29
33
 
30
34
  res.spacer height: 12
@@ -83,6 +87,26 @@ page.body(
83
87
  )
84
88
  end
85
89
  )
90
+ flow.spacer width: 6
91
+ flow.button(
92
+ text: 'Height clip',
93
+ onClick: ->(action) do
94
+ action.components_set(
95
+ targetId: 'image_main',
96
+ data: { width: nil, height: 200, url: glib_json_image_standard_url, fit: :clip }
97
+ )
98
+ end
99
+ )
100
+ flow.spacer width: 6
101
+ flow.button(
102
+ text: 'Height crop',
103
+ onClick: ->(action) do
104
+ action.components_set(
105
+ targetId: 'image_main',
106
+ data: { width: nil, height: 160, url: small_image_url, fit: :crop }
107
+ )
108
+ end
109
+ )
86
110
  end
87
111
  )
88
112
 
@@ -14,8 +14,9 @@ foreground: ->(action) do
14
14
  action.snackbars_alert message: 'page.onForeground'
15
15
  end
16
16
 
17
+ render 'json_ui/garage/test_page/header', json: json, page: page
18
+
17
19
  page.body childViews: ->(body) do
18
- render 'json_ui/garage/test_page/header', view: body
19
20
 
20
21
  body.panels_responsive width: 'matchParent', childViews: ->(res) do
21
22
  res.button \
@@ -2,9 +2,10 @@ json.title 'Test Page (List)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body(
6
8
  childViews: ->(body) do
7
- render 'json_ui/garage/test_page/header', view: body
8
9
  body.panels_responsive(
9
10
  padding: glib_json_padding_body,
10
11
  childViews: ->(res) do
@@ -27,8 +27,9 @@ page.header(
27
27
  end
28
28
  )
29
29
 
30
+ render 'json_ui/garage/test_page/header', json: json, page: page
31
+
30
32
  page.body childViews: ->(body) do
31
- render 'json_ui/garage/test_page/header', view: body
32
33
 
33
34
  body.panels_form \
34
35
  width: 'matchParent',
@@ -2,9 +2,10 @@ json.title 'Test Page (Lists Append)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body(
6
8
  childViews: ->(body) do
7
- render 'json_ui/garage/test_page/header', view: body
8
9
  body.panels_responsive(
9
10
  padding: glib_json_padding_body,
10
11
  childViews: ->(res) do
@@ -4,7 +4,6 @@ page = json_ui_page json
4
4
 
5
5
  page.form(
6
6
  childViews: ->(body) do
7
- render 'json_ui/garage/test_page/header', view: body
8
7
  body.panels_responsive(
9
8
  padding: glib_json_padding_body,
10
9
  childViews: ->(res) do
@@ -2,9 +2,10 @@ json.title 'Test Page (Multimedia Video)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body(
6
8
  childViews: ->(body) do
7
- render 'json_ui/garage/test_page/header', view: body
8
9
 
9
10
  body.panels_responsive(
10
11
  padding: glib_json_padding_body,
@@ -2,8 +2,9 @@ json.title 'Test Page (Pagination)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body childViews: ->(body) do
6
- render 'json_ui/garage/test_page/header', view: body
7
8
 
8
9
  body.panels_responsive padding: glib_json_padding_body, childViews: ->(res) do
9
10
  res.h2 text: 'Overview'
@@ -2,9 +2,10 @@ json.title 'Test Page (Panels Actions)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body(
6
8
  childViews: ->(body) do
7
- render 'json_ui/garage/test_page/header', view: body
8
9
  body.panels_responsive(
9
10
  padding: glib_json_padding_body,
10
11
  childViews: ->(res) do
@@ -53,9 +53,10 @@ default_cells = [
53
53
 
54
54
  import_settings = { submitUrl: json_ui_garage_url(path: 'forms/bulk_edit_post2'), paramName: 'user' }
55
55
 
56
+ render 'json_ui/garage/test_page/header', json: json, page: page
57
+
56
58
  page.body(
57
59
  childViews: ->(body) do
58
- render 'json_ui/garage/test_page/header', view: body
59
60
  body.panels_responsive(
60
61
  padding: glib_json_padding_body,
61
62
  childViews: ->(res) do
@@ -2,9 +2,10 @@ json.title 'Test Page (Popovers)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body(
6
8
  childViews: ->(body) do
7
- render 'json_ui/garage/test_page/header', view: body
8
9
  body.panels_responsive(
9
10
  padding: glib_json_padding_body,
10
11
  childViews: ->(res) do
@@ -2,9 +2,10 @@ json.title 'Test Page (Progress Circle)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body(
6
8
  childViews: ->(body) do
7
- render 'json_ui/garage/test_page/header', view: body
8
9
 
9
10
  body.panels_responsive(
10
11
  padding: glib_json_padding_body,
@@ -2,9 +2,10 @@ json.title 'Test Page (Responsive)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body(
6
8
  childViews: ->(body) do
7
- render 'json_ui/garage/test_page/header', view: body
8
9
  body.panels_responsive(
9
10
  padding: glib_json_padding_body,
10
11
  childViews: ->(res) do
@@ -2,8 +2,9 @@ json.title 'Test Page (Scroll)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body childViews: ->(body) do
6
- render 'json_ui/garage/test_page/header', view: body
7
8
 
8
9
  body.panels_responsive padding: glib_json_padding_body, childViews: ->(res) do
9
10
  res.h2 text: 'Overview'
@@ -31,8 +31,9 @@ languages.each do |group, sub|
31
31
  end
32
32
  options << { text: 'None of above', value: 'none_of_above' }
33
33
 
34
+ render 'json_ui/garage/test_page/header', json: json, page: page
35
+
34
36
  page.body padding: glib_json_padding_body, childViews: ->(body) do
35
- render 'json_ui/garage/test_page/header', view: body
36
37
  body.panels_form \
37
38
  url: json_ui_garage_url(path: 'forms/generic_post'),
38
39
  method: 'post',
@@ -2,9 +2,10 @@ json.title 'Test Page (Sheets)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body(
6
8
  childViews: ->(body) do
7
- render 'json_ui/garage/test_page/header', view: body
8
9
  body.panels_responsive(
9
10
  padding: glib_json_padding_body,
10
11
  childViews: ->(res) do
@@ -2,9 +2,10 @@ json.title 'Test Page (Snackbars)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body(
6
8
  childViews: ->(body) do
7
- render 'json_ui/garage/test_page/header', view: body
8
9
  body.panels_responsive(
9
10
  padding: glib_json_padding_body,
10
11
  childViews: ->(res) do
@@ -2,9 +2,10 @@ json.title 'Test Page (Split)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body(
6
8
  childViews: ->(body) do
7
- render 'json_ui/garage/test_page/header', view: body
8
9
  body.panels_responsive(
9
10
  padding: glib_json_padding_body,
10
11
  childViews: ->(res) do
@@ -2,9 +2,10 @@ json.title 'Test Page (Storage Items)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
5
7
  page.body(
6
8
  childViews: ->(body) do
7
- render 'json_ui/garage/test_page/header', view: body
8
9
  body.panels_responsive(
9
10
  padding: glib_json_padding_body,
10
11
  childViews: ->(res) do
@@ -0,0 +1,56 @@
1
+ json.title 'Test Page (Switch)'
2
+
3
+ page = json_ui_page json
4
+
5
+ render 'json_ui/garage/test_page/header', json: json, page: page
6
+
7
+ page.body(
8
+ childViews: ->(body) do
9
+ body.panels_responsive(
10
+ padding: glib_json_padding_body,
11
+ childViews: ->(res) do
12
+ res.h2 text: 'Overview'
13
+ res.p(
14
+ text: 'Switch is a toggle control that represents an on/off state. ' \
15
+ 'Use it for settings that take effect immediately without requiring a form submit. ' \
16
+ 'For form submission use a checkbox (fields_check) instead.'
17
+ )
18
+ res.spacer height: 12
19
+ res.hr width: 'matchParent'
20
+ res.spacer height: 12
21
+ res.h2 text: 'Variants and props'
22
+ res.spacer height: 8
23
+ res.label text: 'Default off (no enabled prop)'
24
+ res.spacer height: 6
25
+ res.switch(
26
+ text: 'Push notifications',
27
+ onEnabled: ->(action) do
28
+ action.snackbars_alert message: 'Push enabled'
29
+ end
30
+ )
31
+ res.spacer height: 12
32
+ res.label text: 'Default on (enabled: true)'
33
+ res.spacer height: 6
34
+ res.switch(
35
+ text: 'SMS notifications',
36
+ enabled: true,
37
+ onDisabled: ->(action) do
38
+ action.snackbars_alert message: 'SMS disabled'
39
+ end
40
+ )
41
+ res.spacer height: 12
42
+ res.label text: 'Both onEnabled and onDisabled'
43
+ res.spacer height: 6
44
+ res.switch(
45
+ text: 'Marketing emails',
46
+ onEnabled: ->(action) do
47
+ action.snackbars_alert message: 'Marketing emails on'
48
+ end,
49
+ onDisabled: ->(action) do
50
+ action.snackbars_alert message: 'Marketing emails off'
51
+ end
52
+ )
53
+ end
54
+ )
55
+ end
56
+ )