glib-web 0.1.0 → 0.1.1

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 (30) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/glib/json_ui/page_helper.rb +26 -14
  3. data/app/views/json_ui/garage/_nav_menu.json.jbuilder +112 -70
  4. data/app/views/json_ui/garage/actions/index.json.jbuilder +10 -11
  5. data/app/views/json_ui/garage/forms/basic.json.jbuilder +4 -55
  6. data/app/views/json_ui/garage/forms/file_upload.json.jbuilder +2 -2
  7. data/app/views/json_ui/garage/forms/floating_submit.json.jbuilder +2 -31
  8. data/app/views/json_ui/garage/forms/index.json.jbuilder +7 -7
  9. data/app/views/json_ui/garage/forms/submit_indicator.json.jbuilder +2 -26
  10. data/app/views/json_ui/garage/home/index.json.jbuilder +9 -9
  11. data/app/views/json_ui/garage/lists/index.json.jbuilder +5 -27
  12. data/app/views/json_ui/garage/lists/infinite_scroll.json.jbuilder +17 -10
  13. data/app/views/json_ui/garage/lists/templating.json.jbuilder +7 -49
  14. data/app/views/json_ui/garage/pages/full_width_height.json.jbuilder +46 -38
  15. data/app/views/json_ui/garage/pages/index.json.jbuilder +6 -39
  16. data/app/views/json_ui/garage/pages/layout.json.jbuilder +2 -34
  17. data/app/views/json_ui/garage/pages/nav_buttons.json.jbuilder +2 -31
  18. data/app/views/json_ui/garage/pages/tab_bar.json.jbuilder +2 -2
  19. data/app/views/json_ui/garage/panels/carousel.json.jbuilder +2 -2
  20. data/app/views/json_ui/garage/panels/horizontal.json.jbuilder +2 -123
  21. data/app/views/json_ui/garage/panels/index.json.jbuilder +7 -38
  22. data/app/views/json_ui/garage/panels/split.json.jbuilder +16 -16
  23. data/app/views/json_ui/garage/panels/vertical.json.jbuilder +2 -93
  24. data/app/views/json_ui/garage/views/basic.json.jbuilder +2 -20
  25. data/app/views/json_ui/garage/views/carousels.json.jbuilder +2 -96
  26. data/app/views/json_ui/garage/views/images.json.jbuilder +2 -55
  27. data/app/views/json_ui/garage/views/index.json.jbuilder +6 -37
  28. data/lib/glib/json_crawler/action_crawlers/windows_open.rb +1 -1
  29. metadata +1 -2
  30. data/app/helpers/glib/json_ui/json_ui_helper.rb +0 -94
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a53e5f3f6be6c7d47601f3a401ebbb9cdb2b8e0
4
- data.tar.gz: e3ed2b12c3d9a19186864c35d5f771ce63dec2db
3
+ metadata.gz: 5079872c2112ab26d047f127bc6a1439108ff6e4
4
+ data.tar.gz: 3b85cc0e2092562954945464557b04f6cbf73daf
5
5
  SHA512:
6
- metadata.gz: 39369b0bc54cb5ec96d03658a3c50ebb72b5b7a12eab67100ce9cd4e8f540e1c8690d5ee6d09c00c9909cf0ec4bb3a9ffc60ab2c62757ef816aead626e09892c
7
- data.tar.gz: 56bec0256c4beb322736880f35d7c0ba4fa800d95aaebe820b5be367e31466d356f9a5030401f789dd772ae2468e7fd5604bf2881f825eb3a46e0de38d1c2381
6
+ metadata.gz: 202573f997d53fd508721b354bd9fe465f7afa63b7eedfe200a18c5d4523f54ca59139c946ae744abbacb41c673fecc80485c0c1c1295759bec71d5f11118328
7
+ data.tar.gz: e7ab09ff8e10b8cf59607b2bed4c1321b8b3dcd962e6c32792320f2470a7daa81f6bbb3c24ded486e90ff1bc114bc7ad47d77516859c4dc592cbf40d5f1e238e
@@ -46,31 +46,28 @@ module Glib
46
46
  json.leftDrawer do
47
47
  options[:content]&.call drawer_content_builder
48
48
  end
49
-
50
49
  end
51
50
 
52
51
  def header(options = {})
53
52
  json.header do
54
- json.padding options[:padding]
55
- json.backgroundColor options[:backgroundColor]
56
- json.childViews do
57
- options[:childViews]&.call @view_builder
58
- end
53
+ vertical_content(options)
59
54
  end
60
55
  end
61
56
 
62
57
  def footer(options = {})
63
58
  json.footer do
64
- json.padding options[:padding]
65
- json.backgroundColor options[:backgroundColor]
66
- json.childViews do
67
- options[:childViews]&.call @view_builder
68
- end
59
+ vertical_content(options)
69
60
  end
70
61
  end
71
62
 
63
+ def body(options = {})
64
+ json.body do
65
+ vertical_content(options)
66
+ end
67
+ end
68
+
72
69
  def list(options = {})
73
- json.content do
70
+ json.body do
74
71
  json.childViews do
75
72
  @view_builder.add_view('panels_list', options.reverse_merge(width: 'matchParent'))
76
73
  end
@@ -78,7 +75,7 @@ module Glib
78
75
  end
79
76
 
80
77
  def table(options = {})
81
- json.content do
78
+ json.body do
82
79
  json.childViews do
83
80
  @view_builder.add_view('panels_table', options.reverse_merge(width: 'matchParent'))
84
81
  end
@@ -86,7 +83,7 @@ module Glib
86
83
  end
87
84
 
88
85
  def scroll(options = {})
89
- json.content do
86
+ json.body do
90
87
  json.childViews do
91
88
  @view_builder.add_view('panels_scroll', options.reverse_merge(width: 'matchParent'))
92
89
  end
@@ -98,6 +95,21 @@ module Glib
98
95
  @view_builder.add_view('panels_form', options.reverse_merge(width: 'matchParent'))
99
96
  end
100
97
  end
98
+
99
+ private
100
+ def vertical_content(options)
101
+ options = options.reverse_merge(width: 'matchParent')
102
+
103
+ [:padding, :backgroundColor, :width, :height].each do |name|
104
+ if (value = options[name])
105
+ json.set! name, value
106
+ end
107
+ end
108
+ json.childViews do
109
+ options[:childViews]&.call @view_builder
110
+ end
111
+ end
112
+
101
113
  end
102
114
  end
103
115
  end
@@ -1,84 +1,126 @@
1
- json.leftDrawer do
2
- json.items do
3
- json.child! do
4
- json.icon do
5
- json.materialName 'home'
6
- end
7
- json.text 'Home'
8
- json.onClick do
9
- json.action 'windows/open-v1'
10
- json.url json_ui_garage_url
11
- end
12
- end
13
- end
14
1
 
15
- json.items do
16
- json.child! do
17
- json.text 'Pages'
18
- json.onClick do
19
- json.action 'windows/open-v1'
20
- json.url json_ui_garage_url(path: 'pages/index')
21
- end
22
- end
23
- end
24
2
 
25
- json.items do
26
- json.child! do
27
- json.text 'Lists'
28
- json.onClick do
29
- json.action 'windows/open-v1'
30
- json.url json_ui_garage_url(path: 'lists/index')
31
- end
3
+ page.leftDrawer content: ->(drawer) do
4
+ drawer.header childViews: ->(header) do
5
+ header.h1 text: 'App', onClick: ->(action) do
6
+ action.windows_open url: json_ui_garage_url
32
7
  end
33
8
  end
34
9
 
35
- json.items do
36
- json.child! do
37
- json.text 'Forms'
38
- json.onClick do
39
- json.action 'windows/open-v1'
40
- json.url json_ui_garage_url(path: 'forms/index')
41
- end
42
- end
43
- end
10
+ drawer.rows builder: ->(menu) do
44
11
 
45
- json.items do
46
- json.child! do
47
- json.text 'Panels'
48
- json.onClick do
49
- json.action 'windows/open-v1'
50
- json.url json_ui_garage_url(path: 'panels/index')
51
- end
12
+ menu.button text: 'Pages', onClick: ->(action) do
13
+ action.windows_open url: json_ui_garage_url(path: 'pages/index')
52
14
  end
53
- end
54
15
 
55
- json.items do
56
- json.child! do
57
- json.text 'Views'
58
- json.onClick do
59
- json.action 'windows/open-v1'
60
- json.url json_ui_garage_url(path: 'views/index')
61
- end
16
+ menu.button text: 'Lists', onClick: ->(action) do
17
+ action.windows_open url: json_ui_garage_url(path: 'lists/index')
62
18
  end
63
- end
64
19
 
65
- json.items do
66
- json.child! do
67
- json.text 'Actions'
68
- json.onClick do
69
- json.action 'windows/open-v1'
70
- json.url json_ui_garage_url(path: 'actions/index')
71
- end
20
+ menu.button text: 'Forms', onClick: ->(action) do
21
+ action.windows_open url: json_ui_garage_url(path: 'forms/index')
72
22
  end
73
- end
74
-
75
- json.items do
76
- json.child! do
77
- json.text 'Diagnostics'
78
- json.onClick do
79
- json.action 'dialogs/alert-v1'
80
- json.message 'JSON UI v1.0'
81
- end
23
+
24
+ menu.button text: 'Panels', onClick: ->(action) do
25
+ action.windows_open url: json_ui_garage_url(path: 'panels/index')
26
+ end
27
+
28
+ menu.button text: 'Views', onClick: ->(action) do
29
+ action.windows_open url: json_ui_garage_url(path: 'views/index')
82
30
  end
31
+
32
+ menu.button text: 'Actions', onClick: ->(action) do
33
+ action.windows_open url: json_ui_garage_url(path: 'actions/index')
34
+ end
35
+
36
+ menu.button text: 'Diagnostics', onClick: ->(action) do
37
+ action.dialogs_alert message: 'JSON UI v1.0'
38
+ end
39
+
83
40
  end
84
41
  end
42
+
43
+ # json.leftDrawer do
44
+ # # json.items do
45
+ # # json.child! do
46
+ # # json.icon do
47
+ # # json.materialName 'home'
48
+ # # end
49
+ # # json.text 'Home'
50
+ # # json.onClick do
51
+ # # json.action 'windows/open-v1'
52
+ # # json.url json_ui_garage_url
53
+ # # end
54
+ # # end
55
+ # # end
56
+
57
+ # # json.items do
58
+ # # json.child! do
59
+ # # json.text 'Pages'
60
+ # # json.onClick do
61
+ # # json.action 'windows/open-v1'
62
+ # # json.url json_ui_garage_url(path: 'pages/index')
63
+ # # end
64
+ # # end
65
+ # # end
66
+
67
+ # # json.items do
68
+ # # json.child! do
69
+ # # json.text 'Lists'
70
+ # # json.onClick do
71
+ # # json.action 'windows/open-v1'
72
+ # # json.url json_ui_garage_url(path: 'lists/index')
73
+ # # end
74
+ # # end
75
+ # # end
76
+
77
+ # # json.items do
78
+ # # json.child! do
79
+ # # json.text 'Forms'
80
+ # # json.onClick do
81
+ # # json.action 'windows/open-v1'
82
+ # # json.url json_ui_garage_url(path: 'forms/index')
83
+ # # end
84
+ # # end
85
+ # # end
86
+
87
+ # # json.items do
88
+ # # json.child! do
89
+ # # json.text 'Panels'
90
+ # # json.onClick do
91
+ # # json.action 'windows/open-v1'
92
+ # # json.url json_ui_garage_url(path: 'panels/index')
93
+ # # end
94
+ # # end
95
+ # # end
96
+
97
+ # # json.items do
98
+ # # json.child! do
99
+ # # json.text 'Views'
100
+ # # json.onClick do
101
+ # # json.action 'windows/open-v1'
102
+ # # json.url json_ui_garage_url(path: 'views/index')
103
+ # # end
104
+ # # end
105
+ # # end
106
+
107
+ # # json.items do
108
+ # # json.child! do
109
+ # # json.text 'Actions'
110
+ # # json.onClick do
111
+ # # json.action 'windows/open-v1'
112
+ # # json.url json_ui_garage_url(path: 'actions/index')
113
+ # # end
114
+ # # end
115
+ # # end
116
+
117
+ # # json.items do
118
+ # # json.child! do
119
+ # # json.text 'Diagnostics'
120
+ # # json.onClick do
121
+ # # json.action 'dialogs/alert-v1'
122
+ # # json.message 'JSON UI v1.0'
123
+ # # end
124
+ # # end
125
+ # # end
126
+ # end
@@ -1,16 +1,15 @@
1
1
  json.title 'Actions'
2
2
 
3
- render "#{@path_prefix}/nav_menu", json: json
4
-
5
3
  json_ui_page json do |page|
4
+ render "#{@path_prefix}/nav_menu", json: json, page: page
6
5
 
7
6
  page.list firstSection: ->(section) do
8
- section.rows do |row|
9
- row.thumbnail title: 'dialogs/alert', onClick: ->(action) do
7
+ section.rows builder: ->(template) do
8
+ template.thumbnail title: 'dialogs/alert', onClick: ->(action) do
10
9
  action.dialogs_alert message: 'This is an alert'
11
10
  end
12
11
 
13
- # row.thumbnail title: 'dialogs/confirm (TODO)', onClick: ->(action) do
12
+ # template.thumbnail title: 'dialogs/confirm (TODO)', onClick: ->(action) do
14
13
  # action.dialogs_confirm message: 'Confirm?', onConfirm: ->(action) do
15
14
  # action.dialogs_alert message: 'Good'
16
15
  # end, onCancel: ->(action) do
@@ -18,23 +17,23 @@ json_ui_page json do |page|
18
17
  # end
19
18
  # end
20
19
 
21
- row.thumbnail title: 'dialogs/option', onClick: ->(action) do
20
+ template.thumbnail title: 'dialogs/option', onClick: ->(action) do
22
21
  action.dialogs_options message: 'Select one', buttons: ->(menu) do
23
- menu.button title: 'Option1', onClick: ->(action) do
22
+ menu.button text: 'Option1', onClick: ->(action) do
24
23
  action.dialogs_alert message: 'Option 1'
25
24
  end
26
- menu.button title: 'Option2', onClick: ->(action) do
25
+ menu.button text: 'Option2', onClick: ->(action) do
27
26
  action.dialogs_alert message: 'Option 2'
28
27
  end
29
- menu.button title: 'Cancel'
28
+ menu.button text: 'Cancel'
30
29
  end
31
30
  end
32
31
 
33
- row.thumbnail title: 'dialogs/open', onClick: ->(action) do
32
+ template.thumbnail title: 'dialogs/open', onClick: ->(action) do
34
33
  action.dialogs_open url: json_ui_garage_url(path: 'forms/basic')
35
34
  end
36
35
 
37
- row.thumbnail title: 'dialogs/snackbar', onClick: ->(action) do
36
+ template.thumbnail title: 'dialogs/snackbar', onClick: ->(action) do
38
37
  action.dialogs_snackbar message: 'This is a snackbar'
39
38
  end
40
39
 
@@ -1,15 +1,9 @@
1
1
  json.title 'Forms'
2
2
 
3
- render "#{@path_prefix}/nav_menu", json: json
4
-
5
- options = {
6
- url: json_ui_garage_url(path: 'forms/basic_post'),
7
- method: 'post',
8
- padding: { top: 12, left: 20, right: 20, bottom: 12 }
9
- }
10
-
11
3
  json_ui_page json do |page|
12
- page.form options.merge(childViews: ->(form) do
4
+ render "#{@path_prefix}/nav_menu", json: json, page: page
5
+
6
+ page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: { top: 12, left: 20, right: 20, bottom: 12 }, childViews: ->(form) do
13
7
  form.fields_text name: 'user[name]', width: 'matchParent', label: 'Name'
14
8
  form.fields_email name: 'user[email]', width: 'matchParent', label: 'Email'
15
9
  form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
@@ -26,50 +20,5 @@ json_ui_page json do |page|
26
20
  form.panels_split width: 'matchParent', rightViews: ->(split) do
27
21
  split.button text: 'Submit', onClick: ->(action) { action.forms_submit }
28
22
  end
29
- end)
23
+ end
30
24
  end
31
-
32
- # json_body_with_form json, nil, nil, options do
33
- # json.child! do
34
- # json.view 'fields/text-v1'
35
- # json.name 'user[name]'
36
- # json.width 'matchParent'
37
- # json.label 'Name'
38
- # end
39
-
40
- # json.child! do
41
- # json.view 'fields/email-v1'
42
- # json.name 'user[email]'
43
- # json.width 'matchParent'
44
- # json.label 'Email'
45
- # end
46
-
47
- # json.child! do
48
- # json.view 'fields/password-v1'
49
- # json.name 'user[password]'
50
- # json.width 'matchParent'
51
- # json.label 'Password'
52
- # end
53
-
54
- # json.child! do
55
- # json.view 'panels/split-v1'
56
- # json.width 'matchParent'
57
-
58
- # json.rightViews do
59
- # json.child! do
60
- # json.view 'button-v1'
61
- # json.text 'Submit'
62
- # json.onClick do
63
- # json.action 'forms/submit-v1'
64
-
65
- # # json.action 'forms/encode-v1'
66
- # # json.paramName 'formData'
67
- # # json.onEncoded do
68
- # # json.action 'http/post-v1'
69
- # # json.url json_ui_garage_url(path: 'forms/basic_post')
70
- # # end
71
- # end
72
- # end
73
- # end
74
- # end
75
- # end
@@ -1,7 +1,5 @@
1
1
  json.title 'Forms'
2
2
 
3
- render "#{@path_prefix}/nav_menu", json: json
4
-
5
3
  options = {
6
4
  url: json_ui_garage_url(path: 'forms/generic_post'),
7
5
  method: 'post',
@@ -9,6 +7,8 @@ options = {
9
7
  }
10
8
 
11
9
  json_ui_page json do |page|
10
+ render "#{@path_prefix}/nav_menu", json: json, page: page
11
+
12
12
  page.form options.merge(childViews: ->(form) do
13
13
  form.fields_file name: 'user[photo]', width: 'matchParent', label: 'Photo', accepts: "image/*", s3_direct_upload_url: rails_direct_uploads_path, file_size_limit: 5000, file_size_limit_alert_text: 'Too big!', value: 'VALUE_OF_THE_PREVIOUS_IMAGE_WHICH_IS_USEFUL_WHEN_UPDATING_EXISTING_MODEL'
14
14
  form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
@@ -1,7 +1,5 @@
1
1
  json.title 'Forms'
2
2
 
3
- render "#{@path_prefix}/nav_menu", json: json
4
-
5
3
  # footer = Jbuilder.new do |json|
6
4
  # json.padding(top: 12, left: 20, right: 80, bottom: 12)
7
5
  # json.backgroundColor '#b3bac2'
@@ -20,6 +18,8 @@ options = {
20
18
  }
21
19
 
22
20
  json_ui_page json do |page|
21
+ render "#{@path_prefix}/nav_menu", json: json, page: page
22
+
23
23
  page.form options.merge(childViews: ->(form) do
24
24
  form.label text: 'Demonstrates the use Floating Action Button on a form with footer'
25
25
  30.times do |i|
@@ -29,32 +29,3 @@ json_ui_page json do |page|
29
29
  form.fab icon: 'send', onClick: ->(action) { action.forms_submit }
30
30
  end)
31
31
  end
32
-
33
- # json_body_with_form json, nil, footer, options do
34
- # 30.times do |i|
35
- # json.child! do
36
- # json.view 'fields/text-v1'
37
- # json.name "user[field#{i}]"
38
- # json.width 'matchParent'
39
- # json.label "Field#{i}"
40
- # end
41
- # end
42
-
43
- # json.child! do
44
- # json.view 'button-v1'
45
- # json.text 'Submit'
46
- # json.onClick do
47
- # json.action 'forms/submit-v1'
48
- # end
49
- # end
50
-
51
- # json.child! do
52
- # json.view 'fab-v1'
53
- # json.icon do
54
- # json.materialName 'send'
55
- # end
56
- # json.onClick do
57
- # json.action 'forms/submit-v1'
58
- # end
59
- # end
60
- # end