glib-web 0.15.0 → 0.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/glib/json/traversal.rb +12 -2
- data/app/helpers/glib/json_ui/view_builder.rb +1 -0
- data/app/views/json_ui/garage/forms/full_page_form.json.jbuilder +13 -1
- data/app/views/json_ui/garage/forms/full_page_form_dialog.json.jbuilder +21 -0
- data/app/views/json_ui/garage/forms/submission_flow.json.jbuilder +45 -7
- data/app/views/json_ui/garage/lists/edit_mode.json.jbuilder +18 -1
- data/app/views/json_ui/garage/views/images.json.jbuilder +8 -2
- data/lib/glib/json_crawler/action_crawlers/windows_open.rb +3 -1
- data/lib/glib/json_crawler/router.rb +7 -2
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ee300b7e05299ffaed9427513fada06ef2f248c68f8329bc6d07de7faf947a0
|
4
|
+
data.tar.gz: 8c11c15ae46e15b7fcfaf5c43744fbe2f872a6b6ea2e185e75f882759473c3db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b97228f7f53ea4f1fb86877c08c1cecadf12aaee9536e2ee8488eed58ffff4502c253984c9bc38d0e7df839e46283a5ac5aebbc6b63de63dcc98fa968e77bd6
|
7
|
+
data.tar.gz: b5a3e5a45469e5486465a7b5f3c12400d15ade17bcee01c237528cda747b404478cbc500347b5442992a1a8ae84efd0895f8fb9eefa4ef91493a340977d0df6a
|
@@ -39,12 +39,22 @@ module Glib::Json::Traversal
|
|
39
39
|
@forms = []
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
43
|
-
|
42
|
+
def fullPageForm(spec)
|
43
|
+
spec['fullPageForm']
|
44
|
+
end
|
45
|
+
|
46
|
+
def begin_page(spec)
|
47
|
+
if (form = fullPageForm(spec))
|
44
48
|
@forms << form
|
45
49
|
end
|
46
50
|
end
|
47
51
|
|
52
|
+
def end_page(spec)
|
53
|
+
if fullPageForm(spec)
|
54
|
+
@forms.pop
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
48
58
|
def traverse_multiple(views, block)
|
49
59
|
if views.is_a? Array
|
50
60
|
views.each do |view|
|
@@ -12,5 +12,17 @@ end
|
|
12
12
|
page.footer padding: glib_json_padding_body, backgroundColor: '#b3bac2', childViews: ->(footer) do
|
13
13
|
footer.label text: 'This button will submit the form above because this whole page is wrapped in a giant form.'
|
14
14
|
footer.spacer height: 6
|
15
|
-
|
15
|
+
|
16
|
+
footer.panels_split width: 'matchParent', content: ->(content) do
|
17
|
+
content.left childViews: ->(left) do
|
18
|
+
left.panels_horizontal height: 'matchParent', align: 'middle', childViews: ->(horizontal) do
|
19
|
+
horizontal.label styleClass: 'link', text: 'Open Nested Form', onClick: ->(action) do
|
20
|
+
action.dialogs_open url: json_ui_garage_url(path: 'forms/full_page_form_dialog', mode: 'dialog')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
content.right childViews: ->(right) do
|
25
|
+
right.fields_submit text: 'Submit'
|
26
|
+
end
|
27
|
+
end
|
16
28
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
json.title 'Forms'
|
2
|
+
|
3
|
+
page = json_ui_page json
|
4
|
+
|
5
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
6
|
+
|
7
|
+
page.form url: json_ui_garage_url(path: 'forms/basic_post?id=dialog'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
|
8
|
+
form.fields_text name: 'user[name]', width: 'matchParent', label: 'Name'
|
9
|
+
form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
|
10
|
+
end
|
11
|
+
|
12
|
+
page.footer padding: glib_json_padding_body, backgroundColor: '#b3bac2', childViews: ->(footer) do
|
13
|
+
footer.label text: 'This button will submit the form above because this whole page is wrapped in a giant form.'
|
14
|
+
footer.spacer height: 6
|
15
|
+
|
16
|
+
footer.panels_split width: 'matchParent', content: ->(content) do
|
17
|
+
content.right childViews: ->(right) do
|
18
|
+
right.fields_submit text: 'Submit'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -36,31 +36,69 @@ page.scroll childViews: ->(scroll) do
|
|
36
36
|
group.fields_radio value: 'alert_close', label: 'alert+close - useful for non-model form (e.g. contact us)'
|
37
37
|
end
|
38
38
|
|
39
|
-
form.spacer height:
|
39
|
+
form.spacer height: 6
|
40
40
|
form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
41
41
|
end
|
42
42
|
|
43
|
+
scroll.spacer height: 14
|
43
44
|
scroll.panels_form \
|
45
|
+
width: 'matchParent',
|
44
46
|
url: json_ui_garage_url(path: 'forms/generic_post'),
|
45
47
|
method: 'post',
|
46
48
|
padding: { top: 12, left: 20, right: 20, bottom: 12 },
|
47
49
|
childViews: ->(form) do
|
48
50
|
form.h3 text: 'Perform custom actions on submit'
|
51
|
+
form.spacer height: 6
|
52
|
+
form.label text: 'This also works when you press ENTER in the following text fields'
|
53
|
+
form.spacer height: 6
|
49
54
|
|
50
|
-
form.fields_text width: 'matchParent', styleClass: 'outlined', name: 'user[
|
51
|
-
|
52
|
-
form.spacer height: 14
|
53
|
-
# form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
55
|
+
form.fields_text width: 'matchParent', styleClass: 'outlined', name: 'user[first_name]', value: 'Jane'
|
56
|
+
form.fields_text width: 'matchParent', styleClass: 'outlined', name: 'user[last_name]', value: 'Doe'
|
54
57
|
|
58
|
+
form.spacer height: 6
|
55
59
|
form.fields_submit text: 'Submit'
|
56
60
|
end,
|
57
61
|
onSubmit: ->(action) do
|
58
|
-
# action.forms_submit
|
59
|
-
|
60
62
|
action.dialogs_alert \
|
61
63
|
message: 'The form will submit after the dialog is closed',
|
62
64
|
onClose: ->(subaction) do
|
63
65
|
subaction.forms_submit
|
64
66
|
end
|
65
67
|
end
|
68
|
+
|
69
|
+
scroll.spacer height: 14
|
70
|
+
scroll.panels_form \
|
71
|
+
width: 'matchParent',
|
72
|
+
url: json_ui_garage_url(path: 'forms/generic_post'),
|
73
|
+
method: 'post',
|
74
|
+
padding: { top: 12, left: 20, right: 20, bottom: 12 },
|
75
|
+
childViews: ->(form) do
|
76
|
+
form.h3 text: 'Submit without using a submit button'
|
77
|
+
form.spacer height: 6
|
78
|
+
form.label text: 'Note: In general using a submit button is better because it will allow the browser to handle the form functionality in a consistent manner.'
|
79
|
+
form.spacer height: 6
|
80
|
+
form.label text: 'For example, without a submit button, you cannot submit the form by pressing ENTER in the following text fields'
|
81
|
+
form.spacer height: 6
|
82
|
+
|
83
|
+
form.fields_text width: 'matchParent', styleClass: 'outlined', name: 'user[first_name]', value: 'John'
|
84
|
+
form.fields_text width: 'matchParent', styleClass: 'outlined', name: 'user[last_name]', value: 'Doe'
|
85
|
+
|
86
|
+
form.spacer height: 6
|
87
|
+
|
88
|
+
form.panels_split width: 'matchParent', content: ->(split) do
|
89
|
+
split.left childViews: ->(left) do
|
90
|
+
left.panels_horizontal height: 'matchParent', align: 'middle', childViews: ->(horizontal) do
|
91
|
+
horizontal.label text: 'Submit using label', onClick: ->(subaction) do
|
92
|
+
subaction.forms_submit
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
split.right childViews: ->(right) do
|
98
|
+
right.banners_select width: 'matchParent', message: 'Banner Menu', buttons: ->(menu) do
|
99
|
+
menu.button text: 'Submit using banner', onClick: ->(action) { action.forms_submit }
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
66
104
|
end
|
@@ -4,6 +4,22 @@ json.title 'Lists'
|
|
4
4
|
|
5
5
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
6
6
|
|
7
|
+
tab_index = params[:tab].to_i
|
8
|
+
|
9
|
+
page.header childViews: ->(header) do
|
10
|
+
# Allow navigating to another "edit mode" page to test reuse issues.
|
11
|
+
header.tabBar buttons: ->(menu) do
|
12
|
+
['FIRST', 'SECOND'].each_with_index do |text, index|
|
13
|
+
menu.button \
|
14
|
+
text: text,
|
15
|
+
disabled: tab_index == index,
|
16
|
+
onClick: ->(action) do
|
17
|
+
action.windows_reload url: json_ui_garage_url(path: 'lists/edit_mode', tab: index)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
7
23
|
page.form \
|
8
24
|
width: 'matchParent',
|
9
25
|
url: json_ui_garage_url(path: 'forms/generic_post'),
|
@@ -34,7 +50,8 @@ page.form \
|
|
34
50
|
section.rows builder: ->(row) do
|
35
51
|
batch_count = 20
|
36
52
|
batch_count.times do |index|
|
37
|
-
|
53
|
+
id = (batch_count * tab_index) + index
|
54
|
+
row.thumbnail title: "Item #{id}", recordId: "PK_#{id}"
|
38
55
|
end
|
39
56
|
end
|
40
57
|
end
|
@@ -19,13 +19,19 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
|
19
19
|
url: glib_json_image_avatar_url,
|
20
20
|
badge: { text: '1', backgroundColor: '#0000ff' }
|
21
21
|
|
22
|
+
base64_data = 'data:image/gif;base64,R0lGODlhPQBEAPeoAJosM//AwO/AwHVYZ/z595kzAP/s7P+goOXMv8+fhw/v739/f+8PD98fH/8mJl+fn/9ZWb8/PzWlwv///6wWGbImAPgTEMImIN9gUFCEm/gDALULDN8PAD6atYdCTX9gUNKlj8wZAKUsAOzZz+UMAOsJAP/Z2ccMDA8PD/95eX5NWvsJCOVNQPtfX/8zM8+QePLl38MGBr8JCP+zs9myn/8GBqwpAP/GxgwJCPny78lzYLgjAJ8vAP9fX/+MjMUcAN8zM/9wcM8ZGcATEL+QePdZWf/29uc/P9cmJu9MTDImIN+/r7+/vz8/P8VNQGNugV8AAF9fX8swMNgTAFlDOICAgPNSUnNWSMQ5MBAQEJE3QPIGAM9AQMqGcG9vb6MhJsEdGM8vLx8fH98AANIWAMuQeL8fABkTEPPQ0OM5OSYdGFl5jo+Pj/+pqcsTE78wM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roll.h2 text: 'Avatar with base64 data '
|
25
|
+
scroll.spacer height: 6
|
26
|
+
scroll.avatar \
|
27
|
+
base64Data: base64_data
|
28
|
+
|
22
29
|
scroll.spacer height: 20
|
23
30
|
scroll.h2 text: 'Image with base64 data'
|
24
31
|
scroll.spacer height: 6
|
25
32
|
scroll.image \
|
26
|
-
height: 100,
|
27
33
|
tooltip: { text: 'This is a tooltip' },
|
28
|
-
base64Data:
|
34
|
+
base64Data: base64_data
|
29
35
|
|
30
36
|
scroll.spacer height: 20
|
31
37
|
scroll.h2 text: 'QR Code as base64 image'
|
@@ -8,7 +8,7 @@ module Glib
|
|
8
8
|
json = @http.get(url, action, args.except('url'))
|
9
9
|
|
10
10
|
unless json.nil?
|
11
|
-
@http.router.
|
11
|
+
@http.router.begin_page(json)
|
12
12
|
|
13
13
|
crawl json['header']&.[]('childViews')
|
14
14
|
crawl json['body']&.[]('childViews')
|
@@ -27,6 +27,8 @@ module Glib
|
|
27
27
|
if (on_load = (args.fetch('onLoad', nil)))
|
28
28
|
perform(on_load)
|
29
29
|
end
|
30
|
+
|
31
|
+
@http.router.end_page(json)
|
30
32
|
end
|
31
33
|
end
|
32
34
|
end
|
@@ -94,9 +94,14 @@ module Glib
|
|
94
94
|
@visitor.traverse_multiple views, block
|
95
95
|
end
|
96
96
|
|
97
|
-
def
|
97
|
+
def begin_page(spec)
|
98
98
|
@page_spec = spec
|
99
|
-
@visitor.
|
99
|
+
@visitor.begin_page spec
|
100
|
+
end
|
101
|
+
|
102
|
+
def end_page(spec)
|
103
|
+
@page_spec = nil
|
104
|
+
@visitor.end_page spec
|
100
105
|
end
|
101
106
|
|
102
107
|
def allowed?(url)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glib-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -154,6 +154,7 @@ files:
|
|
154
154
|
- app/views/json_ui/garage/forms/file_upload.json.jbuilder
|
155
155
|
- app/views/json_ui/garage/forms/floating_submit.json.jbuilder
|
156
156
|
- app/views/json_ui/garage/forms/full_page_form.json.jbuilder
|
157
|
+
- app/views/json_ui/garage/forms/full_page_form_dialog.json.jbuilder
|
157
158
|
- app/views/json_ui/garage/forms/generic_post.json.jbuilder
|
158
159
|
- app/views/json_ui/garage/forms/index.json.jbuilder
|
159
160
|
- app/views/json_ui/garage/forms/local_request.json.jbuilder
|