glib-web 4.42.1 → 4.42.3

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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/glib/json/libs.rb +4 -9
  3. data/app/controllers/concerns/glib/json/ui.rb +6 -8
  4. data/app/views/json_ui/garage/test_page/_header.json.jbuilder +84 -14
  5. data/app/views/json_ui/garage/test_page/browsers.json.jbuilder +101 -0
  6. data/app/views/json_ui/garage/test_page/calendar.json.jbuilder +109 -0
  7. data/app/views/json_ui/garage/test_page/calendar_empty_data.json.jbuilder +3 -0
  8. data/app/views/json_ui/garage/test_page/carousel.json.jbuilder +70 -0
  9. data/app/views/json_ui/garage/test_page/charts.json.jbuilder +370 -0
  10. data/app/views/json_ui/garage/test_page/column.json.jbuilder +121 -0
  11. data/app/views/json_ui/garage/test_page/commands.json.jbuilder +98 -0
  12. data/app/views/json_ui/garage/test_page/components.json.jbuilder +143 -0
  13. data/app/views/json_ui/garage/test_page/cookies.json.jbuilder +109 -0
  14. data/app/views/json_ui/garage/test_page/custom.json.jbuilder +56 -0
  15. data/app/views/json_ui/garage/test_page/flow.json.jbuilder +70 -0
  16. data/app/views/json_ui/garage/test_page/forms.json.jbuilder +105 -0
  17. data/app/views/json_ui/garage/test_page/grid.json.jbuilder +68 -0
  18. data/app/views/json_ui/garage/test_page/horizontal.json.jbuilder +68 -0
  19. data/app/views/json_ui/garage/test_page/http.json.jbuilder +87 -37
  20. data/app/views/json_ui/garage/test_page/image.json.jbuilder +145 -0
  21. data/app/views/json_ui/garage/test_page/list.json.jbuilder +75 -0
  22. data/app/views/json_ui/garage/test_page/lists_append.json.jbuilder +151 -0
  23. data/app/views/json_ui/garage/test_page/logics_set.json.jbuilder +7 -6
  24. data/app/views/json_ui/garage/test_page/multimedia_video.json.jbuilder +118 -0
  25. data/app/views/json_ui/garage/test_page/pagination.json.jbuilder +64 -0
  26. data/app/views/json_ui/garage/test_page/panels.json.jbuilder +113 -0
  27. data/app/views/json_ui/garage/test_page/popovers.json.jbuilder +112 -0
  28. data/app/views/json_ui/garage/test_page/progressCircle.json.jbuilder +119 -0
  29. data/app/views/json_ui/garage/test_page/responsive.json.jbuilder +100 -0
  30. data/app/views/json_ui/garage/test_page/scroll.json.jbuilder +77 -0
  31. data/app/views/json_ui/garage/test_page/split.json.jbuilder +82 -0
  32. data/app/views/json_ui/garage/test_page/storage_items.json.jbuilder +144 -0
  33. data/app/views/json_ui/garage/test_page/table.json.jbuilder +99 -0
  34. data/app/views/json_ui/garage/test_page/timeline.json.jbuilder +97 -0
  35. data/app/views/json_ui/garage/test_page/timeouts.json.jbuilder +86 -0
  36. data/app/views/json_ui/garage/test_page/ul.json.jbuilder +68 -0
  37. data/app/views/json_ui/garage/test_page/vertical.json.jbuilder +68 -0
  38. data/app/views/json_ui/garage/test_page/web.json.jbuilder +64 -0
  39. data/app/views/json_ui/garage/test_page/windows.json.jbuilder +129 -0
  40. data/lib/glib/rubocop/cops/multiline_method_call_style.rb +8 -0
  41. data/lib/tasks/db.rake +1 -0
  42. metadata +34 -1
@@ -10,60 +10,110 @@ page.body(
10
10
  childViews: ->(res) do
11
11
  res.h2 text: 'HTTP'
12
12
  res.spacer height: 8
13
- res.button text: 'http/post', onClick: ->(action) do
14
- action.auth_saveCsrfToken token: form_authenticity_token, onSave: ->(subaction) do
15
- subaction.http_post(
16
- url: json_ui_garage_url(path: 'forms/basic_post'),
17
- formData: { user: { name: { first: 'New', last: 'Joe' } } }
13
+ res.button(
14
+ text: 'http/get',
15
+ onClick: ->(action) do
16
+ action.http_get url: json_ui_garage_url(path: 'forms/index')
17
+ end
18
+ )
19
+ res.spacer height: 4
20
+ res.button(
21
+ text: 'http/get (error page)',
22
+ onClick: ->(action) do
23
+ action.http_get url: json_ui_garage_url(path: SecureRandom.hex(3))
24
+ end
25
+ )
26
+ res.spacer height: 4
27
+ res.button(
28
+ text: 'http/post',
29
+ onClick: ->(action) do
30
+ action.auth_saveCsrfToken(
31
+ token: form_authenticity_token,
32
+ onSave: ->(subaction) do
33
+ subaction.http_post(
34
+ url: json_ui_garage_url(path: 'forms/basic_post'),
35
+ formData: { user: { name: { first: 'New', last: 'Joe' } } }
36
+ )
37
+ end
18
38
  )
19
39
  end
20
- end
40
+ )
21
41
  res.spacer height: 4
22
- res.button text: 'http/post (error page)', onClick: ->(action) do
23
- action.auth_saveCsrfToken token: form_authenticity_token, onSave: ->(subaction) do
24
- subaction.http_post(
25
- retryLimit: 5,
26
- url: json_ui_garage_url(path: SecureRandom.hex(3)),
27
- formData: { user: { name: { first: 'New', last: 'Joe' } } }
42
+ res.button(
43
+ text: 'http/post (error page)',
44
+ onClick: ->(action) do
45
+ action.auth_saveCsrfToken(
46
+ token: form_authenticity_token,
47
+ onSave: ->(subaction) do
48
+ subaction.http_post(
49
+ retryLimit: 5,
50
+ url: json_ui_garage_url(path: SecureRandom.hex(3)),
51
+ formData: { user: { name: { first: 'New', last: 'Joe' } } }
52
+ )
53
+ end
28
54
  )
29
55
  end
30
- end
56
+ )
31
57
  res.spacer height: 4
32
- res.button text: 'http/patch', onClick: ->(action) do
33
- action.auth_saveCsrfToken token: form_authenticity_token, onSave: ->(subaction) do
34
- subaction.http_patch(
35
- url: json_ui_garage_url(path: 'forms/basic_post'),
36
- formData: { 'user[name]' => 'Edit Joe' }
58
+ res.button(
59
+ text: 'http/patch',
60
+ onClick: ->(action) do
61
+ action.auth_saveCsrfToken(
62
+ token: form_authenticity_token,
63
+ onSave: ->(subaction) do
64
+ subaction.http_patch(
65
+ url: json_ui_garage_url(path: 'forms/basic_post'),
66
+ formData: { 'user[name]' => 'Edit Joe' }
67
+ )
68
+ end
37
69
  )
38
70
  end
39
- end
71
+ )
40
72
  res.spacer height: 4
41
- res.button text: 'http/patch (error page)', onClick: ->(action) do
42
- action.auth_saveCsrfToken token: form_authenticity_token, onSave: ->(subaction) do
43
- subaction.http_patch(
44
- url: json_ui_garage_url(path: SecureRandom.hex(3)),
45
- formData: { 'user[name]' => 'Edit Joe' }
73
+ res.button(
74
+ text: 'http/patch (error page)',
75
+ onClick: ->(action) do
76
+ action.auth_saveCsrfToken(
77
+ token: form_authenticity_token,
78
+ onSave: ->(subaction) do
79
+ subaction.http_patch(
80
+ url: json_ui_garage_url(path: SecureRandom.hex(3)),
81
+ formData: { 'user[name]' => 'Edit Joe' }
82
+ )
83
+ end
46
84
  )
47
85
  end
48
- end
86
+ )
49
87
  res.spacer height: 4
50
- res.button text: 'http/delete', onClick: ->(action) do
51
- action.auth_saveCsrfToken token: form_authenticity_token, onSave: ->(subaction) do
52
- subaction.http_delete(
53
- url: json_ui_garage_url(path: 'forms/basic_post'),
54
- formData: { 'user[name]' => 'Delete Joe' }
88
+ res.button(
89
+ text: 'http/delete',
90
+ onClick: ->(action) do
91
+ action.auth_saveCsrfToken(
92
+ token: form_authenticity_token,
93
+ onSave: ->(subaction) do
94
+ subaction.http_delete(
95
+ url: json_ui_garage_url(path: 'forms/basic_post'),
96
+ formData: { 'user[name]' => 'Delete Joe' }
97
+ )
98
+ end
55
99
  )
56
100
  end
57
- end
101
+ )
58
102
  res.spacer height: 4
59
- res.button text: 'http/delete (error page)', onClick: ->(action) do
60
- action.auth_saveCsrfToken token: form_authenticity_token, onSave: ->(subaction) do
61
- subaction.http_delete(
62
- url: json_ui_garage_url(path: SecureRandom.hex(3)),
63
- formData: { 'user[name]' => 'Delete Joe' }
103
+ res.button(
104
+ text: 'http/delete (error page)',
105
+ onClick: ->(action) do
106
+ action.auth_saveCsrfToken(
107
+ token: form_authenticity_token,
108
+ onSave: ->(subaction) do
109
+ subaction.http_delete(
110
+ url: json_ui_garage_url(path: SecureRandom.hex(3)),
111
+ formData: { 'user[name]' => 'Delete Joe' }
112
+ )
113
+ end
64
114
  )
65
115
  end
66
- end
116
+ )
67
117
  end
68
118
  )
69
119
  end
@@ -0,0 +1,145 @@
1
+ json.title 'Test Page (Image)'
2
+
3
+ page = json_ui_page json
4
+
5
+ small_image_url = 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSGQpSWjtELISLBlmugOZ6wzl1JamYXQvbFeYywpfg3E8b8DrO0Kg&s'
6
+
7
+ page.body(
8
+ childViews: ->(body) do
9
+ render 'json_ui/garage/test_page/header', view: body
10
+
11
+ body.panels_responsive(
12
+ padding: glib_json_padding_body,
13
+ childViews: ->(res) do
14
+ res.h2 text: 'Overview'
15
+ res.p text: 'Image renders remote assets with sizing, fit, tooltip, and badge options.'
16
+ res.spacer height: 12
17
+ res.hr width: 'matchParent'
18
+ res.spacer height: 12
19
+
20
+ res.h2 text: 'Basic example'
21
+ res.spacer height: 8
22
+ res.image(
23
+ id: 'image_main',
24
+ width: 320,
25
+ height: 200,
26
+ url: glib_json_image_standard_url,
27
+ fit: :clip
28
+ )
29
+
30
+ res.spacer height: 12
31
+ res.hr width: 'matchParent'
32
+ res.spacer height: 12
33
+
34
+ res.h2 text: 'Variants and props'
35
+ res.label text: 'Resize and swap the asset to confirm fit and layout.'
36
+ res.spacer height: 8
37
+ res.panels_flow(
38
+ innerPadding: { bottom: 0 },
39
+ childViews: ->(flow) do
40
+ flow.button(
41
+ text: 'Default',
42
+ onClick: ->(action) do
43
+ action.components_set(
44
+ targetId: 'image_main',
45
+ data: {
46
+ width: 320,
47
+ height: 200,
48
+ url: glib_json_image_standard_url,
49
+ fit: :clip,
50
+ badge: nil,
51
+ tooltip: nil
52
+ }
53
+ )
54
+ end
55
+ )
56
+ flow.spacer width: 6
57
+ flow.button(
58
+ text: 'Crop square',
59
+ onClick: ->(action) do
60
+ action.components_set(
61
+ targetId: 'image_main',
62
+ data: { width: 160, height: 160, url: small_image_url, fit: :crop }
63
+ )
64
+ end
65
+ )
66
+ flow.spacer width: 6
67
+ flow.button(
68
+ text: 'Full width',
69
+ onClick: ->(action) do
70
+ action.components_set(
71
+ targetId: 'image_main',
72
+ data: { width: 'matchParent', height: 220, url: glib_json_image_standard_url, fit: :clip }
73
+ )
74
+ end
75
+ )
76
+ flow.spacer width: 6
77
+ flow.button(
78
+ text: 'Tall crop',
79
+ onClick: ->(action) do
80
+ action.components_set(
81
+ targetId: 'image_main',
82
+ data: { width: 200, height: 320, url: glib_json_image_standard_url, fit: :crop }
83
+ )
84
+ end
85
+ )
86
+ end
87
+ )
88
+
89
+ res.spacer height: 12
90
+ res.hr width: 'matchParent'
91
+ res.spacer height: 12
92
+
93
+ res.h2 text: 'Actions and events'
94
+ res.label text: 'Toggle badges and tooltips to confirm metadata rendering.'
95
+ res.spacer height: 8
96
+ res.panels_flow(
97
+ innerPadding: { bottom: 0 },
98
+ childViews: ->(flow) do
99
+ flow.button(
100
+ text: 'Show badge',
101
+ onClick: ->(action) do
102
+ action.components_set(
103
+ targetId: 'image_main',
104
+ data: { badge: { text: '3', backgroundColor: '#2B3A67' } }
105
+ )
106
+ end
107
+ )
108
+ end
109
+ )
110
+
111
+ res.spacer height: 12
112
+ res.hr width: 'matchParent'
113
+ res.spacer height: 12
114
+
115
+ res.h2 text: 'Edge and advanced'
116
+ res.label text: 'Confirm tiny images render without layout issues.'
117
+ res.spacer height: 8
118
+ res.panels_flow(
119
+ innerPadding: { bottom: 0 },
120
+ childViews: ->(flow) do
121
+ flow.button(
122
+ text: 'Tiny thumbnail',
123
+ onClick: ->(action) do
124
+ action.components_set(
125
+ targetId: 'image_main',
126
+ data: { width: 64, height: 64, url: small_image_url, fit: :crop }
127
+ )
128
+ end
129
+ )
130
+ flow.spacer width: 6
131
+ flow.button(
132
+ text: 'Restore size',
133
+ onClick: ->(action) do
134
+ action.components_set(
135
+ targetId: 'image_main',
136
+ data: { width: 320, height: 200, url: glib_json_image_standard_url, fit: :clip }
137
+ )
138
+ end
139
+ )
140
+ end
141
+ )
142
+ end
143
+ )
144
+ end
145
+ )
@@ -0,0 +1,75 @@
1
+ json.title 'Test Page (List)'
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: 'Overview'
10
+ res.p text: 'List panels render rows using templates and support pagination, drag, and edit modes.'
11
+
12
+ res.spacer height: 12
13
+ res.hr width: 'matchParent'
14
+
15
+ res.h2 text: 'Basic'
16
+ res.spacer height: 8
17
+ res.panels_list id: 'list_main', firstSection: ->(section) do
18
+ section.rows builder: ->(template) do
19
+ template.standard title: 'Alpha', subtitle: 'Basic list row'
20
+ template.standard title: 'Bravo', subtitle: 'Basic list row'
21
+ template.standard title: 'Charlie', subtitle: 'Basic list row'
22
+ end
23
+ end
24
+
25
+ res.spacer height: 12
26
+ res.hr width: 'matchParent'
27
+
28
+ res.h2 text: 'Variants and Props'
29
+ res.spacer height: 8
30
+ res.panels_flow innerPadding: { bottom: 0 }, childViews: ->(flow) do
31
+ flow.button text: 'One column', onClick: ->(action) do
32
+ action.components_set targetId: 'list_main', data: { responsiveCols: 1 }
33
+ end
34
+ flow.spacer width: 4
35
+ flow.button text: 'Three columns', onClick: ->(action) do
36
+ action.components_set targetId: 'list_main', data: { responsiveCols: 3 }
37
+ end
38
+ flow.spacer width: 4
39
+ flow.button text: 'Card style', onClick: ->(action) do
40
+ action.components_set targetId: 'list_main', data: { styleClasses: ['card'], padding: glib_json_padding_list }
41
+ end
42
+ flow.spacer width: 4
43
+ flow.button text: 'Clear style', onClick: ->(action) do
44
+ action.components_set targetId: 'list_main', data: { styleClasses: nil, padding: nil }
45
+ end
46
+ end
47
+
48
+ res.spacer height: 12
49
+ res.hr width: 'matchParent'
50
+
51
+ res.h2 text: 'Actions and Events'
52
+ res.spacer height: 8
53
+ res.label id: 'list_event_status', text: 'Scroll events: idle'
54
+ res.spacer height: 6
55
+ res.panels_list id: 'list_events', height: 180, onScrollToTop: ->(action) do
56
+ action.components_set targetId: 'list_event_status', data: { text: 'Scroll events: top reached' }
57
+ end, onScrollToBottom: ->(action) do
58
+ action.components_set targetId: 'list_event_status', data: { text: 'Scroll events: bottom reached' }
59
+ end, firstSection: ->(section) do
60
+ section.rows builder: ->(template) do
61
+ (1..12).each do |index|
62
+ template.standard title: "Row #{index}", subtitle: 'Scroll to trigger events'
63
+ end
64
+ end
65
+ end
66
+
67
+ res.spacer height: 12
68
+ res.hr width: 'matchParent'
69
+
70
+ res.h2 text: 'Edge and Advanced'
71
+ res.spacer height: 8
72
+ res.label text: 'Empty list (sections: [])'
73
+ res.panels_list sections: []
74
+ end
75
+ end
@@ -0,0 +1,151 @@
1
+ json.title 'Test Page (Lists Append)'
2
+
3
+ page = json_ui_page json
4
+
5
+ page.body(
6
+ childViews: ->(body) do
7
+ render 'json_ui/garage/test_page/header', view: body
8
+ body.panels_responsive(
9
+ padding: glib_json_padding_body,
10
+ childViews: ->(res) do
11
+ res.h2 text: 'Lists Append'
12
+ res.label text: 'Append rows to list panels from actions for live updates.'
13
+ res.spacer height: 12
14
+ res.hr width: 'matchParent'
15
+ res.spacer height: 12
16
+
17
+ res.h2 text: 'Overview'
18
+ res.label text: 'Use lists/append when a list should grow without a full refresh.'
19
+ res.spacer height: 12
20
+ res.hr width: 'matchParent'
21
+ res.spacer height: 12
22
+
23
+ res.h2 text: 'Basic example'
24
+ res.spacer height: 8
25
+ res.label id: 'lists_append_status', text: 'Status: idle'
26
+ res.spacer height: 8
27
+ res.panels_list id: 'list_append_demo', firstSection: ->(section) do
28
+ section.rows builder: ->(template) do
29
+ template.thumbnail title: 'Starter row', subtitle: 'Existing item'
30
+ end
31
+ end
32
+ res.spacer height: 8
33
+ res.button(
34
+ text: 'lists/append (thumbnail)',
35
+ onClick: ->(action) do
36
+ action.lists_append(
37
+ targetId: 'list_append_demo',
38
+ row: {
39
+ template: 'thumbnail',
40
+ title: "New row #{DateTime.current.to_i}",
41
+ subtitle: 'Appended via action'
42
+ },
43
+ onAppend: ->(subaction) do
44
+ subaction.logics_set targetId: 'lists_append_status', data: { text: 'Status: appended' }
45
+ end
46
+ )
47
+ end
48
+ )
49
+
50
+ res.spacer height: 16
51
+ res.hr width: 'matchParent'
52
+ res.spacer height: 16
53
+
54
+ res.h2 text: 'Variants/props'
55
+ res.spacer height: 8
56
+ res.panels_flow(
57
+ innerPadding: { bottom: 0 },
58
+ width: 'matchParent',
59
+ childViews: ->(flow) do
60
+ flow.button(
61
+ text: 'Append standard row',
62
+ onClick: ->(action) do
63
+ action.lists_append(
64
+ targetId: 'list_append_demo',
65
+ row: {
66
+ template: 'standard',
67
+ title: 'Standard row',
68
+ subtitle: 'Uses the standard template'
69
+ }
70
+ )
71
+ end
72
+ )
73
+ flow.spacer width: 8
74
+ flow.button(
75
+ text: 'Append + snackbar',
76
+ onClick: ->(action) do
77
+ action.lists_append(
78
+ targetId: 'list_append_demo',
79
+ row: {
80
+ template: 'thumbnail',
81
+ title: 'Snackbar row',
82
+ subtitle: 'onAppend triggers feedback'
83
+ },
84
+ onAppend: ->(subaction) do
85
+ subaction.snackbars_alert message: 'Row appended'
86
+ end
87
+ )
88
+ end
89
+ )
90
+ end
91
+ )
92
+
93
+ res.spacer height: 16
94
+ res.hr width: 'matchParent'
95
+ res.spacer height: 16
96
+
97
+ res.h2 text: 'Actions/events'
98
+ res.spacer height: 8
99
+ res.button(
100
+ text: 'Append two rows',
101
+ onClick: ->(action) do
102
+ action.runMultiple(
103
+ childActions: ->(multi) do
104
+ multi.lists_append(
105
+ targetId: 'list_append_demo',
106
+ row: {
107
+ template: 'thumbnail',
108
+ title: 'Batch row A',
109
+ subtitle: 'RunMultiple append'
110
+ }
111
+ )
112
+ multi.lists_append(
113
+ targetId: 'list_append_demo',
114
+ row: {
115
+ template: 'thumbnail',
116
+ title: 'Batch row B',
117
+ subtitle: 'RunMultiple append'
118
+ }
119
+ )
120
+ end
121
+ )
122
+ end
123
+ )
124
+
125
+ res.spacer height: 16
126
+ res.hr width: 'matchParent'
127
+ res.spacer height: 16
128
+
129
+ res.h2 text: 'Edge/advanced'
130
+ res.spacer height: 8
131
+ res.label text: 'Append into an empty list'
132
+ res.spacer height: 8
133
+ res.panels_list id: 'list_append_empty', sections: []
134
+ res.spacer height: 8
135
+ res.button(
136
+ text: 'lists/append (empty list)',
137
+ onClick: ->(action) do
138
+ action.lists_append(
139
+ targetId: 'list_append_empty',
140
+ row: {
141
+ template: 'standard',
142
+ title: 'First row',
143
+ subtitle: 'Created from empty list'
144
+ }
145
+ )
146
+ end
147
+ )
148
+ end
149
+ )
150
+ end
151
+ )
@@ -2,7 +2,7 @@ json.title 'Test Page (Logics Set)'
2
2
 
3
3
  page = json_ui_page json
4
4
 
5
- page.body(
5
+ page.form(
6
6
  childViews: ->(body) do
7
7
  render 'json_ui/garage/test_page/header', view: body
8
8
  body.panels_responsive(
@@ -122,18 +122,19 @@ page.body(
122
122
  end
123
123
  )
124
124
  res.spacer height: 16
125
+ res.fields_text label: 'Say', name: 'user[say]', width: 300, value: 'Hello'
126
+ res.fields_hidden name: 'user[say]', value: 'Silent'
125
127
  res.button(
126
- text: 'Update duplicate labels',
128
+ text: 'Update label',
127
129
  onClick: ->(action) do
128
130
  action.logics_set(
129
- targetId: 'duplicate_label',
130
- data: { text: 'Updated label text' }
131
+ targetId: 'say_label',
132
+ conditionalData: { text: { "var": 'user[say]' } }
131
133
  )
132
134
  end
133
135
  )
134
136
  res.spacer height: 8
135
- res.label id: 'duplicate_label', text: 'Visible label text'
136
- res.label id: 'duplicate_label', text: 'Hidden label text', displayed: false
137
+ res.label id: 'say_label', text: 'Visible label text'
137
138
  end
138
139
  )
139
140
  end
@@ -0,0 +1,118 @@
1
+ json.title 'Test Page (Multimedia Video)'
2
+
3
+ page = json_ui_page json
4
+
5
+ page.body(
6
+ childViews: ->(body) do
7
+ render 'json_ui/garage/test_page/header', view: body
8
+
9
+ body.panels_responsive(
10
+ padding: glib_json_padding_body,
11
+ childViews: ->(res) do
12
+ res.h2 text: 'Overview'
13
+ res.p text: 'Multimedia video embeds external media with configurable sizing.'
14
+ res.spacer height: 12
15
+ res.hr width: 'matchParent'
16
+ res.spacer height: 12
17
+
18
+ res.h2 text: 'Basic example'
19
+ res.spacer height: 8
20
+ res.multimedia_video(
21
+ id: 'multimedia_video_main',
22
+ width: 560,
23
+ height: 315,
24
+ url: 'https://www.youtube.com/watch?v=947op8yKJRY'
25
+ )
26
+
27
+ res.spacer height: 12
28
+ res.hr width: 'matchParent'
29
+ res.spacer height: 12
30
+
31
+ res.h2 text: 'Variants and props'
32
+ res.label text: 'Swap sizing and URL formats.'
33
+ res.spacer height: 8
34
+ res.panels_flow innerPadding: { bottom: 0 }, childViews: ->(flow) do
35
+ flow.button(
36
+ text: 'Default size',
37
+ onClick: ->(action) do
38
+ action.components_set(
39
+ targetId: 'multimedia_video_main',
40
+ data: {
41
+ width: 560,
42
+ height: 315,
43
+ url: 'https://www.youtube.com/watch?v=947op8yKJRY'
44
+ }
45
+ )
46
+ end
47
+ )
48
+ flow.spacer width: 6
49
+ flow.button(
50
+ text: 'Short URL',
51
+ onClick: ->(action) do
52
+ action.components_set(
53
+ targetId: 'multimedia_video_main',
54
+ data: { url: 'https://youtu.be/ATnpEOo3GJA' }
55
+ )
56
+ end
57
+ )
58
+ flow.spacer width: 6
59
+ flow.button(
60
+ text: 'Match parent',
61
+ onClick: ->(action) do
62
+ action.components_set(
63
+ targetId: 'multimedia_video_main',
64
+ data: { width: 'matchParent', height: 240 }
65
+ )
66
+ end
67
+ )
68
+ flow.spacer width: 6
69
+ flow.button(
70
+ text: 'Compact',
71
+ onClick: ->(action) do
72
+ action.components_set(
73
+ targetId: 'multimedia_video_main',
74
+ data: { width: 360, height: 200 }
75
+ )
76
+ end
77
+ )
78
+ end
79
+
80
+ res.spacer height: 12
81
+ res.hr width: 'matchParent'
82
+ res.spacer height: 12
83
+
84
+ res.h2 text: 'Actions and events'
85
+ res.label text: 'Use the buttons above to validate updates without remounting.'
86
+ res.spacer height: 12
87
+
88
+ res.hr width: 'matchParent'
89
+ res.spacer height: 12
90
+
91
+ res.h2 text: 'Edge and advanced'
92
+ res.label text: 'Test wide and tall ratios for responsive layouts.'
93
+ res.spacer height: 8
94
+ res.panels_flow innerPadding: { bottom: 0 }, childViews: ->(flow) do
95
+ flow.button(
96
+ text: 'Wide 16:9',
97
+ onClick: ->(action) do
98
+ action.components_set(
99
+ targetId: 'multimedia_video_main',
100
+ data: { width: 640, height: 360 }
101
+ )
102
+ end
103
+ )
104
+ flow.spacer width: 6
105
+ flow.button(
106
+ text: 'Tall',
107
+ onClick: ->(action) do
108
+ action.components_set(
109
+ targetId: 'multimedia_video_main',
110
+ data: { width: 360, height: 480 }
111
+ )
112
+ end
113
+ )
114
+ end
115
+ end
116
+ )
117
+ end
118
+ )