glib-web 4.39.0 → 4.39.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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/glib/auth/policy.rb +13 -0
  3. data/app/controllers/glib/api_docs_controller.rb +145 -0
  4. data/app/helpers/glib/json_ui/abstract_builder.rb +16 -0
  5. data/app/helpers/glib/json_ui/action_builder/dialogs.rb +4 -0
  6. data/app/helpers/glib/json_ui/list_builders.rb +2 -0
  7. data/app/helpers/glib/json_ui/view_builder/fields.rb +15 -0
  8. data/app/helpers/glib/json_ui/view_builder/panels.rb +450 -11
  9. data/app/helpers/glib/json_ui/view_builder.rb +1 -1
  10. data/app/views/glib/api_docs/component.json.jbuilder +215 -0
  11. data/app/views/glib/api_docs/index.json.jbuilder +103 -0
  12. data/app/views/glib/api_docs/show.json.jbuilder +111 -0
  13. data/app/views/json_ui/garage/actions/_dialogs.json.jbuilder +2 -2
  14. data/app/views/json_ui/garage/forms/dynamic_group.json.jbuilder +2 -2
  15. data/app/views/json_ui/garage/forms/file_upload_new.json.jbuilder +1 -1
  16. data/app/views/json_ui/garage/forms/partial_update.json.jbuilder +12 -12
  17. data/app/views/json_ui/garage/forms/selects.json.jbuilder +1 -1
  18. data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +62 -7
  19. data/app/views/json_ui/garage/lists/edit_mode.json.jbuilder +4 -4
  20. data/app/views/json_ui/garage/lists/templating.json.jbuilder +68 -44
  21. data/app/views/json_ui/garage/pages/custom_style_class.json.jbuilder +1 -1
  22. data/app/views/json_ui/garage/pages/nav_buttons.json.jbuilder +31 -13
  23. data/app/views/json_ui/garage/panels/_styled.json.jbuilder +8 -8
  24. data/app/views/json_ui/garage/panels/hover.json.jbuilder +2 -2
  25. data/app/views/json_ui/garage/panels/timeline.json.jbuilder +5 -5
  26. data/app/views/json_ui/garage/panels/ul.json.jbuilder +1 -1
  27. data/app/views/json_ui/garage/tables/bulk_edit.json.jbuilder +1 -1
  28. data/app/views/json_ui/garage/test_page/file_upload_new.json.jbuilder +1 -1
  29. data/app/views/json_ui/garage/test_page/form.json.jbuilder +6 -6
  30. data/app/views/json_ui/garage/test_page/form_dynamic.json.jbuilder +2 -2
  31. data/app/views/json_ui/garage/test_page/logics_set.json.jbuilder +94 -0
  32. data/app/views/json_ui/garage/views/components_replace.json.jbuilder +13 -13
  33. data/app/views/json_ui/garage/views/components_set.json.jbuilder +6 -6
  34. data/app/views/json_ui/garage/views/fields_focus.json.jbuilder +22 -22
  35. data/app/views/json_ui/garage/views/markdowns.json.jbuilder +2 -0
  36. data/config/routes.rb +4 -0
  37. data/lib/glib/doc_generator.rb +386 -0
  38. data/lib/glib/json_crawler/router.rb +45 -24
  39. data/lib/glib/rubocop/cops/json_ui/base_nested_parameter.rb +145 -0
  40. data/lib/glib/rubocop/cops/json_ui/nested_action_parameter.rb +55 -0
  41. data/lib/glib/rubocop/cops/json_ui/nested_block_parameter.rb +51 -0
  42. data/lib/glib/rubocop/cops/multiline_method_call_style.rb +74 -5
  43. data/lib/glib/rubocop/cops/test_name_parentheses.rb +33 -0
  44. data/lib/glib/rubocop.rb +4 -0
  45. data/lib/glib/test/parallel_coverage.rb +38 -0
  46. data/lib/glib/test_helpers.rb +12 -0
  47. data/lib/glib-web.rb +1 -0
  48. data/lib/tasks/db.rake +1 -1
  49. data/lib/tasks/docs.rake +59 -0
  50. metadata +13 -1
@@ -3,49 +3,73 @@ json.title 'Lists'
3
3
  json_ui_page json do |page|
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
5
 
6
- page.list firstSection: ->(section) do
7
- section.header padding: { top: 12, left: 16, right: 16, bottom: 12 }, childViews: ->(header) do
8
- header.h3 text: 'Section Header'
6
+ page.list(
7
+ firstSection: ->(section) do
8
+ section.header(
9
+ padding: { top: 12, left: 16, right: 16, bottom: 12 },
10
+ childViews: ->(header) do
11
+ header.h3 text: 'Section Header'
12
+ end
13
+ )
14
+ section.rows(
15
+ builder: ->(template) do
16
+ template.thumbnail(
17
+ title: 'Click me',
18
+ onClick: ->(action) do
19
+ action.windows_open url: json_ui_garage_url(path: 'home/blank')
20
+ end,
21
+ accessory: ->(accessory) do
22
+ accessory.header(
23
+ width: 'matchParent',
24
+ backgroundColor: '#b3bac2',
25
+ padding: { top: 10, bottom: 10, left: 10, right: 10 },
26
+ childViews: ->(bottom) do
27
+ bottom.label text: 'Custom row header'
28
+ end
29
+ )
30
+ accessory.footer(
31
+ width: 'matchParent',
32
+ backgroundColor: '#b3bac2',
33
+ padding: { top: 10, bottom: 10, left: 10, right: 10 },
34
+ childViews: ->(bottom) do
35
+ bottom.label text: 'Custom row footer'
36
+ end
37
+ )
38
+ end
39
+ )
40
+ template.thumbnail title: 'Item with icon and subtitle', subtitle: 'Item subtitle', icon: 'facebook'
41
+ template.thumbnail(
42
+ title: 'Item with chips',
43
+ chips: ->(menu) do
44
+ menu.button text: 'Finished', styleClass: 'info'
45
+ menu.button props: { text: 'Succeeded', styleClass: 'success' }
46
+ end
47
+ )
48
+ template.thumbnail(
49
+ title: 'Item with thumbnail image',
50
+ subtitle: 'Item subtitle',
51
+ imageUrl: glib_json_image_standard_url,
52
+ )
53
+ template.featured(
54
+ title: 'Featured with featured image',
55
+ subtitle: 'Item subtitle',
56
+ imageUrl: glib_json_image_standard_url
57
+ )
58
+ template.thumbnail(
59
+ title: 'Item with **formatted** text',
60
+ subtitle: 'Item *subtitle*',
61
+ textFormat: :markdown
62
+ )
63
+ # TODO
64
+ # template.thumbnail title: 'Item with accessories (Experimental)', subtitle: 'Item subtitle', accessoryViews: ->(thumbnail) do
65
+ # thumbnail.panels_horizontal childViews: ->(horizontal) do
66
+ # horizontal.chip text: 'finished'
67
+ # horizontal.spacer width: 10
68
+ # horizontal.chip text: 'succeeded'
69
+ # end
70
+ # end
71
+ end
72
+ )
9
73
  end
10
-
11
- section.rows builder: ->(template) do
12
- template.thumbnail title: 'Click me', onClick: ->(action) do
13
- action.windows_open url: json_ui_garage_url(path: 'home/blank')
14
- end,
15
- accessory: ->(accessory) do
16
- accessory.header \
17
- width: 'matchParent',
18
- backgroundColor: '#b3bac2',
19
- padding: { top: 10, bottom: 10, left: 10, right: 10 },
20
- childViews: ->(bottom) do
21
- bottom.label text: 'Custom row header'
22
- end
23
- accessory.footer \
24
- width: 'matchParent',
25
- backgroundColor: '#b3bac2',
26
- padding: { top: 10, bottom: 10, left: 10, right: 10 },
27
- childViews: ->(bottom) do
28
- bottom.label text: 'Custom row footer'
29
- end
30
- end
31
- template.thumbnail title: 'Item with icon and subtitle', subtitle: 'Item subtitle', icon: 'facebook'
32
- template.thumbnail title: 'Item with chips', chips: ->(menu) do
33
- menu.button text: 'Finished', styleClass: 'info'
34
- menu.button props: { text: 'Succeeded', styleClass: 'success' }
35
- end
36
-
37
- template.thumbnail title: 'Item with thumbnail image', subtitle: 'Item subtitle', imageUrl: glib_json_image_standard_url
38
- template.featured title: 'Featured with featured image', subtitle: 'Item subtitle', imageUrl: glib_json_image_standard_url
39
-
40
- # TODO
41
- # template.thumbnail title: 'Item with accessories (Experimental)', subtitle: 'Item subtitle', accessoryViews: ->(thumbnail) do
42
- # thumbnail.panels_horizontal childViews: ->(horizontal) do
43
- # horizontal.chip text: 'finished'
44
- # horizontal.spacer width: 10
45
- # horizontal.chip text: 'succeeded'
46
- # end
47
- # end
48
-
49
- end
50
- end
74
+ )
51
75
  end
@@ -26,7 +26,7 @@ end
26
26
  page.body padding: glib_json_padding_body, childViews: ->(scroll) do
27
27
  scroll.panels_vertical width: 'matchParent', styleClass: 'card', padding: glib_json_padding_body, childViews: ->(vertical) do
28
28
  (1..100).each do |index|
29
- scroll.label text: 'Content'
29
+ vertical.label text: 'Content'
30
30
  end
31
31
  end
32
32
  end
@@ -4,18 +4,36 @@ page = json_ui_page json
4
4
 
5
5
  render "#{@path_prefix}/nav_menu", json: json, page: page
6
6
 
7
- page.navBar backgroundColor: '#a8c4e3', color: '#ffffff', showTitle: true, rightButtons: ->(menu) do
8
- menu.button icon: 'search', text: 'Search', onClick: ->(action) do
9
- action.dialogs_alert message: 'Perform some action'
7
+ page.navBar(
8
+ backgroundColor: '#a8c4e3',
9
+ color: '#ffffff',
10
+ showTitle: true,
11
+ rightButtons: ->(menu) do
12
+ menu.button(
13
+ icon: 'search',
14
+ text: 'Search',
15
+ onClick: ->(action) do
16
+ action.dialogs_alert message: 'Perform some action'
17
+ end
18
+ )
19
+ menu.button(
20
+ icon: { name: 'star', badge: { text: '1', backgroundColor: '#ff0000' } },
21
+ onClick: ->(action) do
22
+ action.dialogs_alert message: 'Perform some action'
23
+ end
24
+ )
25
+ menu.button(
26
+ icon: { name: 'map', badge: '2' },
27
+ onClick: ->(action) do
28
+ action.dialogs_alert message: 'Perform some action'
29
+ end
30
+ )
10
31
  end
11
- menu.button icon: { name: 'star', badge: { text: '1', backgroundColor: '#ff0000' } }, onClick: ->(action) do
12
- action.dialogs_alert message: 'Perform some action'
13
- end
14
- menu.button icon: { name: 'map', badge: '2' }, onClick: ->(action) do
15
- action.dialogs_alert message: 'Perform some action'
16
- end
17
- end
32
+ )
18
33
 
19
- page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
20
- scroll.label text: 'See the right menu buttons on the nav bar'
21
- end
34
+ page.scroll(
35
+ padding: glib_json_padding_body,
36
+ childViews: ->(scroll) do
37
+ scroll.label text: 'See the right menu buttons on the nav bar'
38
+ end
39
+ )
@@ -54,23 +54,23 @@ page.scroll backgroundColor: '#fafafa', padding: { top: 10, right: 10, bottom: 1
54
54
  scroll.panels_responsive width: 'matchParent', childViews: ->(horizontal) do
55
55
  gap = { top: 12, left: 10, right: 10, bottom: 12 }
56
56
  horizontal.panels_column lg: { cols: 4 }, padding: gap, childViews: ->(column) do
57
- column.panels_vertical styleClasses: styleClasses, width: 'matchParent', padding: glib_json_padding_body, childViews: ->(column) do
58
- column.button text: '1'
57
+ column.panels_vertical styleClasses: styleClasses, width: 'matchParent', padding: glib_json_padding_body, childViews: ->(subcolumn) do
58
+ subcolumn.button text: '1'
59
59
  end
60
60
  end
61
61
  horizontal.panels_column lg: { cols: 4 }, padding: gap, childViews: ->(column) do
62
- column.panels_vertical styleClasses: styleClasses, width: 'matchParent', padding: glib_json_padding_body, childViews: ->(column) do
63
- column.button text: '2'
62
+ column.panels_vertical styleClasses: styleClasses, width: 'matchParent', padding: glib_json_padding_body, childViews: ->(subcolumn) do
63
+ subcolumn.button text: '2'
64
64
  end
65
65
  end
66
66
  horizontal.panels_column lg: { cols: 4 }, padding: gap, childViews: ->(column) do
67
- column.panels_vertical styleClasses: styleClasses, width: 'matchParent', padding: glib_json_padding_body, childViews: ->(column) do
68
- column.button text: '3'
67
+ column.panels_vertical styleClasses: styleClasses, width: 'matchParent', padding: glib_json_padding_body, childViews: ->(subcolumn) do
68
+ subcolumn.button text: '3'
69
69
  end
70
70
  end
71
71
  horizontal.panels_column lg: { cols: 4 }, padding: gap, childViews: ->(column) do
72
- column.panels_vertical styleClasses: styleClasses, width: 'matchParent', padding: glib_json_padding_body, childViews: ->(column) do
73
- column.button text: '4'
72
+ column.panels_vertical styleClasses: styleClasses, width: 'matchParent', padding: glib_json_padding_body, childViews: ->(subcolumn) do
73
+ subcolumn.button text: '4'
74
74
  end
75
75
  end
76
76
  end
@@ -23,8 +23,8 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
23
23
  9.times do |i|
24
24
  scroll.panels_column lg: { cols: 4 }, padding: { top: 18, right: 14, bottom: 18, left: 14 }, childViews: ->(column) do
25
25
  column.panels_responsive styleClasses: ['card'], padding: { top: 48, right: 24, bottom: 48, left: 24 }, childViews: ->(responsive) do
26
- column.h2 text: "Item #{i}"
27
- column.p text: "Hover view with #{i} sentence(s)"
26
+ responsive.h2 text: "Item #{i}"
27
+ responsive.p text: "Hover view with #{i} sentence(s)"
28
28
  end, hoverViews: ->(hover) do
29
29
  render 'json_ui/garage/panels/hover_views_content', hover: hover, i: i
30
30
  end, onClick: ->(action) do
@@ -46,31 +46,31 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
46
46
  timeline.panels_vertical childViews: ->(vertical) do
47
47
  vertical.h4 text: 'Order submitted'
48
48
  vertical.spacer height: 2
49
- timeline.label text: '15 minutes ago'
49
+ vertical.label text: '15 minutes ago'
50
50
  end
51
51
 
52
52
  timeline.panels_vertical childViews: ->(vertical) do
53
53
  vertical.h4 text: 'Finding you a driver'
54
54
  vertical.spacer height: 2
55
- timeline.label text: '15 minutes ago'
55
+ vertical.label text: '15 minutes ago'
56
56
  end
57
57
 
58
58
  timeline.panels_vertical childViews: ->(vertical) do
59
59
  vertical.h4 text: 'Driver found'
60
60
  vertical.spacer height: 2
61
- timeline.label text: '12 minutes ago'
61
+ vertical.label text: '12 minutes ago'
62
62
  end
63
63
 
64
64
  timeline.panels_vertical childViews: ->(vertical) do
65
65
  vertical.h4 text: 'On the way'
66
66
  vertical.spacer height: 2
67
- timeline.label text: 'Duration: 11 minutes'
67
+ vertical.label text: 'Duration: 11 minutes'
68
68
  end
69
69
 
70
70
  timeline.panels_vertical childViews: ->(vertical) do
71
71
  vertical.h4 text: 'Arrived'
72
72
  vertical.spacer height: 2
73
- timeline.label text: '1 minute ago'
73
+ vertical.label text: '1 minute ago'
74
74
  end
75
75
  end
76
76
 
@@ -31,7 +31,7 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
31
31
  vertical.spacer height: 6
32
32
  vertical.p text: 'The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.'
33
33
  vertical.spacer height: 6
34
- ul.panels_ul childViews: ->(inner_ul) do
34
+ vertical.panels_ul childViews: ->(inner_ul) do
35
35
  inner_ul.label text: 'Sub item 1'
36
36
  inner_ul.label text: 'Sub item 2'
37
37
  end
@@ -61,7 +61,7 @@ page.scroll childViews: ->(scroll) do
61
61
  displayed: false
62
62
  end
63
63
 
64
- scroll.panels_bulkEdit2 \
64
+ wres.panels_bulkEdit2 \
65
65
  id: 'import_table',
66
66
  width: 'matchParent',
67
67
  paramNameForRowId: 'row_id',
@@ -67,7 +67,7 @@ page.form(
67
67
  styleClass: 'align-center',
68
68
  xs: { gap: { all: 4 } },
69
69
  childViews: ->(flow) do
70
- form.fields_upload(
70
+ flow.fields_upload(
71
71
  properties.merge(
72
72
  name: 'user[file_placeholderView]',
73
73
  id: 'pv1',
@@ -89,17 +89,17 @@ page.body childViews: ->(body) do
89
89
  form.fields_select clearable: true, multiple: true, width: 'matchParent', name: 'user[select][]', id: 'select', options: options, value: ['option1', 'option2'], validation: validation
90
90
  form.hr width: 'matchParent'
91
91
  form.panels_flow innerPadding: { bottom: 0 }, width: 'matchParent', id: 'select1', childViews: ->(flow) do
92
- form.fields_select clearable: true, width: 'matchParent', name: 'user[select1]', options: options_with_icon, value: 'option1'
93
- form.hr width: 'matchParent'
92
+ flow.fields_select clearable: true, width: 'matchParent', name: 'user[select1]', options: options_with_icon, value: 'option1'
93
+ flow.hr width: 'matchParent'
94
94
  end
95
95
  form.panels_horizontal id: 'select2', width: 'matchParent', childViews: ->(hori) do
96
- form.fields_select clearable: true, width: 'matchParent', name: 'user[select2]', options: options_with_image, value: 'option2'
97
- form.hr width: 'matchParent'
96
+ hori.fields_select clearable: true, width: 'matchParent', name: 'user[select2]', options: options_with_image, value: 'option2'
97
+ hori.hr width: 'matchParent'
98
98
  end
99
99
  form.panels_split id: 'select3', width: 'matchParent', content: ->(split) do
100
100
  split.left childViews: ->(right) do
101
- form.fields_select clearable: true, width: 'matchParent', name: 'user[select3]', options: options, value: 'option3'
102
- form.hr width: 'matchParent'
101
+ right.fields_select clearable: true, width: 'matchParent', name: 'user[select3]', options: options, value: 'option3'
102
+ right.hr width: 'matchParent'
103
103
  end
104
104
  end
105
105
  form.fields_chipGroup width: 'matchParent', name: 'user[chip_group]', id: 'chip_group', options: options, value: ['option2'], validation: validation
@@ -36,9 +36,9 @@ page.body childViews: ->(body) do
36
36
  template.fields_hidden name: 'error_message'
37
37
  template.fields_text width: 'matchParent', name: 'question', label: 'Question', placeholder: 'Question', styleClass: 'question'
38
38
 
39
- form.panels_responsive id: 'responsive_{{entryIndex}}', childViews: ->(column) do
39
+ template.panels_responsive id: 'responsive_{{entryIndex}}', childViews: ->(column) do
40
40
  options = [:rating, :yes_no, :choices, :unspecified]
41
- template.fields_select \
41
+ column.fields_select \
42
42
  width: 'matchParent',
43
43
  name: 'type',
44
44
  label: 'Answer Type',
@@ -0,0 +1,94 @@
1
+ json.title 'Test Page (Logics Set)'
2
+
3
+ page = json_ui_page json
4
+
5
+ page.body childViews: ->(body) do
6
+ render 'json_ui/garage/test_page/header', view: body
7
+
8
+ body.panels_responsive padding: glib_json_padding_body, childViews: ->(res) do
9
+ res.h2 text: 'Logics Set - Icon Badge'
10
+ res.spacer height: 8
11
+
12
+ res.panels_flow innerPadding: { bottom: 0 }, width: 'matchParent', childViews: ->(flow) do
13
+ flow.button text: 'Set badge to "5"', onClick: ->(action) do
14
+ action.logics_set targetId: 'test_icon', conditionalData: {
15
+ 'badge.text': '5',
16
+ 'badge.backgroundColor': 'primary'
17
+ }
18
+ end
19
+
20
+ flow.spacer width: 8
21
+
22
+ flow.button text: 'Set badge to "99"', onClick: ->(action) do
23
+ action.logics_set targetId: 'test_icon', conditionalData: {
24
+ 'badge.text': '99',
25
+ 'badge.backgroundColor': 'warning'
26
+ }
27
+ end
28
+
29
+ flow.spacer width: 8
30
+
31
+ flow.button text: 'Clear badge', onClick: ->(action) do
32
+ action.logics_set targetId: 'test_icon', data: {
33
+ badge: nil
34
+ }
35
+ end
36
+ end
37
+
38
+ res.spacer height: 16
39
+ res.hr width: 'matchParent'
40
+ res.spacer height: 16
41
+
42
+ res.icon \
43
+ id: 'test_icon',
44
+ name: 'notifications',
45
+ badge: { text: '1', backgroundColor: 'error' }
46
+
47
+ res.spacer height: 24
48
+ res.h2 text: 'Button with Icon Badge'
49
+ res.spacer height: 8
50
+
51
+ res.panels_flow innerPadding: { bottom: 0 }, width: 'matchParent', childViews: ->(flow) do
52
+ flow.button text: 'Set button badge to "3"', onClick: ->(action) do
53
+ action.logics_set targetId: 'test_button', conditionalData: {
54
+ 'icon.badge.text': '3',
55
+ 'icon.badge.backgroundColor': 'success'
56
+ }
57
+ end
58
+
59
+ flow.spacer width: 8
60
+
61
+ flow.button text: 'Set button badge to "10"', onClick: ->(action) do
62
+ action.logics_set targetId: 'test_button', conditionalData: {
63
+ 'icon.badge.text': '10',
64
+ 'icon.badge.backgroundColor': 'error'
65
+ }
66
+ end
67
+
68
+ flow.spacer width: 8
69
+
70
+ flow.button text: 'Clear button badge', onClick: ->(action) do
71
+ action.logics_set targetId: 'test_button', data: {
72
+ 'icon.badge': nil
73
+ }
74
+ end
75
+ end
76
+
77
+ res.spacer height: 16
78
+ res.hr width: 'matchParent'
79
+ res.spacer height: 16
80
+
81
+ res.button \
82
+ id: 'test_button',
83
+ text: 'Notifications',
84
+ icon: {
85
+ name: 'notifications',
86
+ badge: { text: '5', backgroundColor: 'warning' }
87
+ },
88
+ onClick: ->(action) do
89
+ action.snackbars_alert message: 'Button clicked!'
90
+ end
91
+
92
+ res.spacer height: 16
93
+ end
94
+ end
@@ -24,9 +24,9 @@ small_image_url = 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSGQpSWj
24
24
  page.body padding: glib_json_padding_body, childViews: ->(body) do
25
25
  body.panels_responsive width: 'matchParent', childViews: ->(res) do
26
26
  res.panels_column lg: { cols: 3 }, childViews: ->(col) do
27
- res.h3 text: 'Props changes'
28
- res.spacer height: 8
29
- res.panels_flow innerPadding: { top: 4, right: 4, bottom: 4, left: 4 }, childViews: ->(hori) do
27
+ col.h3 text: 'Props changes'
28
+ col.spacer height: 8
29
+ col.panels_flow innerPadding: { top: 4, right: 4, bottom: 4, left: 4 }, childViews: ->(hori) do
30
30
  hori.button text: 'change bgcolor', onClick: ->(action) do
31
31
  action.runMultiple childActions: ->(saction) do
32
32
  comp_ids.each do |id, method|
@@ -70,10 +70,10 @@ page.body padding: glib_json_padding_body, childViews: ->(body) do
70
70
  end
71
71
  end
72
72
  end
73
- res.spacer height: 16
74
- res.h3 text: 'Childviews changes'
75
- res.spacer height: 8
76
- res.panels_flow innerPadding: { top: 4, right: 4, bottom: 4, left: 4 }, childViews: ->(hori) do
73
+ col.spacer height: 16
74
+ col.h3 text: 'Childviews changes'
75
+ col.spacer height: 8
76
+ col.panels_flow innerPadding: { top: 4, right: 4, bottom: 4, left: 4 }, childViews: ->(hori) do
77
77
  hori.button text: 'Add child to panel', onClick: ->(action) do
78
78
  action.runMultiple childActions: ->(saction) do
79
79
  panels_ids.each do |id, method|
@@ -104,7 +104,7 @@ page.body padding: glib_json_padding_body, childViews: ->(body) do
104
104
  end
105
105
  end
106
106
  end
107
- res.spacer height: 16
107
+ col.spacer height: 16
108
108
  end
109
109
 
110
110
  res.panels_column lg: { cols: 9 }, childViews: ->(col) do
@@ -142,12 +142,12 @@ page.body padding: glib_json_padding_body, childViews: ->(body) do
142
142
  url: json_ui_garage_url(path: 'forms/generic_post'),
143
143
  method: 'post',
144
144
  childViews: ->(form) do
145
- col.fields_text id: 'inp-text', name: 'user[full_name]', width: 300, label: 'Full name', placeholder: 'Full name'
146
- col.spacer height: 4
145
+ form.fields_text id: 'inp-text', name: 'user[full_name]', width: 300, label: 'Full name', placeholder: 'Full name'
146
+ form.spacer height: 4
147
147
 
148
- col.fields_select id: 'inp-select', options: cities, width: 300, name: 'user[city]'
149
- col.spacer height: 4
150
- col.fields_submit text: 'Submit'
148
+ form.fields_select id: 'inp-select', options: cities, width: 300, name: 'user[city]'
149
+ form.spacer height: 4
150
+ form.fields_submit text: 'Submit'
151
151
  end
152
152
  col.spacer height: 8
153
153
  col.icon id: 'icon', name: 'pending', size: 32, styleClasses: ['warning']
@@ -19,14 +19,14 @@ page.body padding: glib_json_padding_body, childViews: ->(body) do
19
19
  url: json_ui_garage_url(path: 'forms/generic_post'),
20
20
  method: 'post',
21
21
  childViews: ->(form) do
22
- res.fields_text id: 'ftext', name: 'user[full_name]', value: 'John Doe', label: 'Full name', placeholder: 'Full name', width: 300
23
- res.spacer height: 8
24
- res.panels_horizontal childViews: ->(hori) do
25
- res.button text: 'set', onClick: ->(action) do
22
+ form.fields_text id: 'ftext', name: 'user[full_name]', value: 'John Doe', label: 'Full name', placeholder: 'Full name', width: 300
23
+ form.spacer height: 8
24
+ form.panels_horizontal childViews: ->(hori) do
25
+ hori.button text: 'set', onClick: ->(action) do
26
26
  action.components_set targetId: 'ftext', data: { name: 'user[city]', value: 'Taipei', label: 'City', placeholder: 'City' }
27
27
  end
28
- res.spacer width: 4
29
- res.fields_submit text: 'submit'
28
+ hori.spacer width: 4
29
+ hori.fields_submit text: 'submit'
30
30
  end
31
31
  end
32
32
 
@@ -11,44 +11,44 @@ page.body padding: glib_json_padding_body, childViews: ->(body) do
11
11
  method: 'post',
12
12
  width: 300,
13
13
  childViews: ->(form) do
14
- res.fields_text id: 'first', name: 'user[full_name]', label: 'Full name', placeholder: 'Full name', width: 'matchParent'
15
- res.spacer height: 4
16
- res.fields_number id: 'second', name: 'user[age]', label: 'Age', placeholder: 'Age', width: 'matchParent'
17
- res.spacer height: 4
18
- res.fields_textarea id: 'third', name: 'user[boi]', label: 'Bio', placeholder: 'Bio', width: 'matchParent'
19
- res.spacer height: 4
20
- res.fields_date id: 'fourth', name: 'user[birth_date]', label: 'Birth date', placeholder: 'Birth date', width: 'matchParent'
21
- res.spacer height: 4
22
- res.panels_horizontal childViews: ->(hori) do
23
- res.button text: 'focus1', onClick: ->(action) do
14
+ form.fields_text id: 'first', name: 'user[full_name]', label: 'Full name', placeholder: 'Full name', width: 'matchParent'
15
+ form.spacer height: 4
16
+ form.fields_number id: 'second', name: 'user[age]', label: 'Age', placeholder: 'Age', width: 'matchParent'
17
+ form.spacer height: 4
18
+ form.fields_textarea id: 'third', name: 'user[boi]', label: 'Bio', placeholder: 'Bio', width: 'matchParent'
19
+ form.spacer height: 4
20
+ form.fields_date id: 'fourth', name: 'user[birth_date]', label: 'Birth date', placeholder: 'Birth date', width: 'matchParent'
21
+ form.spacer height: 4
22
+ form.panels_horizontal childViews: ->(hori) do
23
+ hori.button text: 'focus1', onClick: ->(action) do
24
24
  action.fields_focus targetId: 'first'
25
25
  end
26
- res.spacer width: 4
27
- res.button text: 'focus2', onClick: ->(action) do
26
+ hori.spacer width: 4
27
+ hori.button text: 'focus2', onClick: ->(action) do
28
28
  action.fields_focus targetId: 'second'
29
29
  end
30
- res.spacer width: 4
31
- res.button text: 'focus3', onClick: ->(action) do
30
+ hori.spacer width: 4
31
+ hori.button text: 'focus3', onClick: ->(action) do
32
32
  action.fields_focus targetId: 'third'
33
33
  end
34
- res.spacer width: 4
35
- res.button text: 'focus4', onClick: ->(action) do
34
+ hori.spacer width: 4
35
+ hori.button text: 'focus4', onClick: ->(action) do
36
36
  action.fields_focus targetId: 'fourth'
37
37
  end
38
- res.spacer width: 4
39
- res.button text: 'blur', onClick: ->(action) do
38
+ hori.spacer width: 4
39
+ hori.button text: 'blur', onClick: ->(action) do
40
40
  action.fields_focus targetId: 'first', onFocus: ->(saction) do
41
41
  saction.timeouts_set interval: 1000, onTimeout: ->(ssaction) { ssaction.fields_blur }
42
42
  end
43
43
  end
44
- res.spacer width: 4
45
- res.button text: 'reset', onClick: ->(action) do
44
+ hori.spacer width: 4
45
+ hori.button text: 'reset', onClick: ->(action) do
46
46
  action.fields_reset targetIds: ['first', 'second', 'third', 'fourth'], onReset: ->(saction) do
47
47
  saction.snackbars_alert styleClasses: ['success'], message: 'Reset full name!'
48
48
  end
49
49
  end
50
- res.spacer width: 4
51
- res.fields_submit text: 'submit'
50
+ hori.spacer width: 4
51
+ hori.fields_submit text: 'submit'
52
52
  end
53
53
  end
54
54
 
@@ -27,6 +27,8 @@ json_ui_page json do |page|
27
27
  "\n" +
28
28
  '~~Strikethrough~~' + "\n" +
29
29
  "\n" +
30
+ '<u>Underlined</u>' + "\n" +
31
+ "\n" +
30
32
  'https://www.google.com' + "\n"
31
33
 
32
34
  scroll.spacer height: 20
data/config/routes.rb CHANGED
@@ -6,6 +6,10 @@ Glib::Web::Engine.routes.draw do
6
6
  delete 'json_ui_garage', to: 'home#json_ui_garage'
7
7
  post 'chat', to: 'home#chat'
8
8
 
9
+ get 'json_ui_api', to: 'api_docs#index'
10
+ get 'json_ui_api/:category', to: 'api_docs#show', as: :json_ui_api_category
11
+ get 'json_ui_api/:category/:component', to: 'api_docs#component', as: :json_ui_api_component
12
+
9
13
  resources :glib_direct_uploads, only: [:create]
10
14
  resources :blob_url_generators, only: [:create]
11
15
  resources :errors, only: [:create]