glib-web 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/application/json/libs.rb +26 -0
  3. data/app/controllers/concerns/application/json/transformation.rb +11 -0
  4. data/app/controllers/concerns/application/json/ui.rb +73 -0
  5. data/app/controllers/concerns/application/json/validation.rb +13 -0
  6. data/app/controllers/home_controller.rb +21 -0
  7. data/app/helpers/glib/web/json_ui_helper.rb +58 -0
  8. data/app/views/app/views/json_ui/vue/renderer.html.erb +29 -0
  9. data/app/views/json_ui/garage/_nav_menu.json.jbuilder +84 -0
  10. data/app/views/json_ui/garage/actions/index.json.jbuilder +25 -0
  11. data/app/views/json_ui/garage/forms/basic.json.jbuilder +53 -0
  12. data/app/views/json_ui/garage/forms/basic_post.json.jbuilder +10 -0
  13. data/app/views/json_ui/garage/forms/file_upload.json.jbuilder +38 -0
  14. data/app/views/json_ui/garage/forms/floating_submit.json.jbuilder +48 -0
  15. data/app/views/json_ui/garage/forms/generic_post.json.jbuilder +6 -0
  16. data/app/views/json_ui/garage/forms/index.json.jbuilder +43 -0
  17. data/app/views/json_ui/garage/forms/submit_indicator.json.jbuilder +32 -0
  18. data/app/views/json_ui/garage/forms/submit_indicator_post.json.jbuilder +12 -0
  19. data/app/views/json_ui/garage/home/index.json.jbuilder +61 -0
  20. data/app/views/json_ui/garage/lists/_infinite_scroll_section.json.jbuilder +10 -0
  21. data/app/views/json_ui/garage/lists/index.json.jbuilder +25 -0
  22. data/app/views/json_ui/garage/lists/infinite_scroll.json.jbuilder +27 -0
  23. data/app/views/json_ui/garage/lists/templating.json.jbuilder +45 -0
  24. data/app/views/json_ui/garage/pages/full_width_height.json.jbuilder +39 -0
  25. data/app/views/json_ui/garage/pages/index.json.jbuilder +35 -0
  26. data/app/views/json_ui/garage/pages/layout.json.jbuilder +35 -0
  27. data/app/views/json_ui/garage/pages/nav_buttons.json.jbuilder +32 -0
  28. data/app/views/json_ui/garage/panels/horizontal.json.jbuilder +213 -0
  29. data/app/views/json_ui/garage/panels/index.json.jbuilder +34 -0
  30. data/app/views/json_ui/garage/panels/split.json.jbuilder +360 -0
  31. data/app/views/json_ui/garage/panels/vertical.json.jbuilder +94 -0
  32. data/app/views/json_ui/garage/views/basic.json.jbuilder +21 -0
  33. data/app/views/json_ui/garage/views/carousels.json.jbuilder +100 -0
  34. data/app/views/json_ui/garage/views/images.json.jbuilder +56 -0
  35. data/app/views/json_ui/garage/views/index.json.jbuilder +34 -0
  36. data/config/routes.rb +4 -0
  37. data/lib/glib/engine.rb +7 -0
  38. data/lib/glib/version.rb +5 -0
  39. data/lib/glib-web.rb +2 -0
  40. metadata +40 -2
@@ -0,0 +1,48 @@
1
+ json.title 'Forms'
2
+
3
+ render "#{@path_prefix}/nav_menu", json: json
4
+
5
+ footer = Jbuilder.new do |json|
6
+ json.padding(top: 12, left: 20, right: 80, bottom: 12)
7
+ json.backgroundColor '#b3bac2'
8
+ json.subviews do
9
+ json.child! do
10
+ json.view 'label-v1'
11
+ json.text 'Demonstrates the use Floating Action Button on a form with footer'
12
+ end
13
+ end
14
+ end
15
+
16
+ options = {
17
+ url: json_ui_garage_url(path: 'forms/generic_post'),
18
+ method: 'post',
19
+ padding: { top: 12, left: 20, right: 20, bottom: 12 }
20
+ }
21
+ json_body_with_form json, nil, footer, options do
22
+ 30.times do |i|
23
+ json.child! do
24
+ json.view 'fields/text-v1'
25
+ json.name "user[field#{i}]"
26
+ json.width 'matchParent'
27
+ json.label "Field#{i}"
28
+ end
29
+ end
30
+
31
+ json.child! do
32
+ json.view 'button-v1'
33
+ json.text 'Submit'
34
+ json.onClick do
35
+ json.action 'forms/submit-v1'
36
+ end
37
+ end
38
+
39
+ json.child! do
40
+ json.view 'fab-v1'
41
+ json.icon do
42
+ json.materialName 'send'
43
+ end
44
+ json.onClick do
45
+ json.action 'forms/submit-v1'
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,6 @@
1
+ sleep 0.5
2
+
3
+ json.onResponse do
4
+ json.action 'dialogs/alert-v1'
5
+ json.message 'Success!'
6
+ end
@@ -0,0 +1,43 @@
1
+ json.title 'Forms'
2
+
3
+ render "#{@path_prefix}/nav_menu", json: json
4
+
5
+ json_body_with_list json do
6
+ json.rows do
7
+ json.child! do
8
+ json.template 'thumbnail-v1'
9
+ json.title 'Basic'
10
+ json.onClick do
11
+ json.action 'windows/open-v1'
12
+ json.url json_ui_garage_url(path: 'forms/basic')
13
+ end
14
+ end
15
+
16
+ json.child! do
17
+ json.template 'thumbnail-v1'
18
+ json.title 'Submit Indicator'
19
+ json.onClick do
20
+ json.action 'windows/open-v1'
21
+ json.url json_ui_garage_url(path: 'forms/submit_indicator')
22
+ end
23
+ end
24
+
25
+ json.child! do
26
+ json.template 'thumbnail-v1'
27
+ json.title 'Floating Submit'
28
+ json.onClick do
29
+ json.action 'windows/open-v1'
30
+ json.url json_ui_garage_url(path: 'forms/floating_submit')
31
+ end
32
+ end
33
+
34
+ json.child! do
35
+ json.template 'thumbnail-v1'
36
+ json.title 'File Upload'
37
+ json.onClick do
38
+ json.action 'windows/open-v1'
39
+ json.url json_ui_garage_url(path: 'forms/file_upload')
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,32 @@
1
+ json.title 'Forms'
2
+
3
+ render "#{@path_prefix}/nav_menu", json: json
4
+
5
+ options = {
6
+ url: json_ui_garage_url(path: 'forms/submit_indicator_post'),
7
+ method: 'post',
8
+ padding: { top: 12, left: 20, right: 20, bottom: 12 }
9
+ }
10
+ json_body_with_form json, nil, nil, options do
11
+ json.child! do
12
+ json.view 'fields/text-v1'
13
+ json.name 'user[name]'
14
+ json.width 'matchParent'
15
+ json.label 'Name'
16
+ end
17
+
18
+ json.child! do
19
+ json.view 'panels/split-v1'
20
+ json.width 'matchParent'
21
+
22
+ json.content do
23
+ json.right do
24
+ json.view 'button-v1'
25
+ json.text 'Submit'
26
+ json.onClick do
27
+ json.action 'forms/submit-v1'
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,12 @@
1
+ sleep 2
2
+
3
+ name = params.require(:user)[:name]
4
+ json.onResponse do
5
+ if name.present?
6
+ json.action 'dialogs/alert-v1'
7
+ json.message "Submitted information: #{name}"
8
+ else
9
+ json.action 'dialogs/alert-v1'
10
+ json.message 'Please enter all required information'
11
+ end
12
+ end
@@ -0,0 +1,61 @@
1
+ json.title 'Home'
2
+
3
+ render "#{@path_prefix}/nav_menu", json: json
4
+
5
+ json_body_with_list json do
6
+ json.rows do
7
+ json.child! do
8
+ json.template 'thumbnail-v1'
9
+ json.title 'Pages'
10
+ json.onClick do
11
+ json.action 'windows/open-v1'
12
+ json.url json_ui_garage_url(path: 'pages/index')
13
+ end
14
+ end
15
+
16
+ json.child! do
17
+ json.template 'thumbnail-v1'
18
+ json.title 'Lists'
19
+ json.onClick do
20
+ json.action 'windows/open-v1'
21
+ json.url json_ui_garage_url(path: 'lists/index')
22
+ end
23
+ end
24
+
25
+ json.child! do
26
+ json.template 'thumbnail-v1'
27
+ json.title 'Forms'
28
+ json.onClick do
29
+ json.action 'windows/open-v1'
30
+ json.url json_ui_garage_url(path: 'forms/index')
31
+ end
32
+ end
33
+
34
+ json.child! do
35
+ json.template 'thumbnail-v1'
36
+ json.title 'Panels'
37
+ json.onClick do
38
+ json.action 'windows/open-v1'
39
+ json.url json_ui_garage_url(path: 'panels/index')
40
+ end
41
+ end
42
+
43
+ json.child! do
44
+ json.template 'thumbnail-v1'
45
+ json.title 'Views'
46
+ json.onClick do
47
+ json.action 'windows/open-v1'
48
+ json.url json_ui_garage_url(path: 'views/index')
49
+ end
50
+ end
51
+
52
+ json.child! do
53
+ json.template 'thumbnail-v1'
54
+ json.title 'Actions'
55
+ json.onClick do
56
+ json.action 'windows/open-v1'
57
+ json.url json_ui_garage_url(path: 'actions/index')
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,10 @@
1
+ json.rows do
2
+ batch_count = 30
3
+ batch_count.times do |i|
4
+ index = page * batch_count + i
5
+ json.child! do
6
+ json.template 'thumbnail-v1'
7
+ json.title "Item #{index}"
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,25 @@
1
+ json.title 'Lists'
2
+
3
+ render "#{@path_prefix}/nav_menu", json: json
4
+
5
+ json_body_with_list json do
6
+ json.rows do
7
+ json.child! do
8
+ json.template 'thumbnail-v1'
9
+ json.title 'Templating'
10
+ json.onClick do
11
+ json.action 'windows/open-v1'
12
+ json.url json_ui_garage_url(path: 'lists/templating')
13
+ end
14
+ end
15
+
16
+ json.child! do
17
+ json.template 'thumbnail-v1'
18
+ json.title 'Infinite Scroll'
19
+ json.onClick do
20
+ json.action 'windows/open-v1'
21
+ json.url json_ui_garage_url(path: 'lists/infinite_scroll')
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,27 @@
1
+
2
+ page = params[:page].to_i
3
+ nextPage = {
4
+ url: json_ui_garage_url(path: 'lists/infinite_scroll', page: page + 1, section_only: 'v1'),
5
+ autoLoad: true
6
+ }
7
+
8
+ # TODO: Cater
9
+ # - for SEO: one URL for a standalone page and one URL for pagination only
10
+ # - for generic approach, e.g. excluding nav_menu when there is no change
11
+ if params[:section_only].present?
12
+ json.nextPage nextPage
13
+ json.sections do
14
+ json.child! do
15
+ render 'json_ui/garage/lists/infinite_scroll_section', json: json, page: page
16
+ end
17
+ end
18
+ else
19
+ json.title 'Lists'
20
+
21
+ render "#{@path_prefix}/nav_menu", json: json
22
+
23
+ options = { nextPage: nextPage }
24
+ json_body_with_list json, nil, nil, options do
25
+ render 'json_ui/garage/lists/infinite_scroll_section', json: json, page: page
26
+ end
27
+ end
@@ -0,0 +1,45 @@
1
+ json.title 'Lists'
2
+
3
+ render "#{@path_prefix}/nav_menu", json: json
4
+
5
+ json_body_with_list json do
6
+ json.header do
7
+ json.subviews do
8
+ json.child! do
9
+ json.view 'label-v1'
10
+ json.text 'Section Header'
11
+ end
12
+ end
13
+ end
14
+
15
+ json.rows do
16
+ json.child! do
17
+ json.template 'thumbnail-v1'
18
+ json.title 'Click me'
19
+ json.onClick do
20
+ json.action 'dialogs/alert-v1'
21
+ json.message 'Perform action'
22
+ end
23
+ end
24
+
25
+ json.child! do
26
+ json.template 'thumbnail-v1'
27
+ json.title 'Item with subtitle'
28
+ json.subtitle 'Item subtitle'
29
+ end
30
+
31
+ json.child! do
32
+ json.template 'thumbnail-v1'
33
+ json.title 'Item with thumbnail image'
34
+ json.subtitle 'Item subtitle'
35
+ json.imageUrl @sample_image_url
36
+ end
37
+
38
+ json.child! do
39
+ json.template 'featured-v1'
40
+ json.title 'Featured with featured image'
41
+ json.subtitle 'Item subtitle'
42
+ json.imageUrl @sample_image_url
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,39 @@
1
+ json.title 'Pages'
2
+
3
+ render "#{@path_prefix}/nav_menu", json: json
4
+
5
+ json.header do
6
+ json.padding(left: 20, right: 20, top: 5, bottom: 5)
7
+ json.backgroundColor '#b3bac2'
8
+ json.subviews do
9
+ json.child! do
10
+ json.view 'h1-v1'
11
+ json.text 'Header'
12
+ end
13
+ end
14
+ end
15
+
16
+ json.content do
17
+ json.height 'matchParent'
18
+ json.padding(top: 15, left: 20, right: 20, bottom: 15)
19
+ json.subviews do
20
+ json.child! do
21
+ json.view 'button-v1'
22
+ json.width 'matchParent'
23
+ json.height 'matchParent'
24
+ json.text 'Full Width/Height'
25
+ end
26
+ end
27
+ end
28
+
29
+ json.footer do
30
+ json.height 80
31
+ json.padding(left: 20, right: 20, top: 5, bottom: 5)
32
+ json.backgroundColor '#b3bac2'
33
+ json.subviews do
34
+ json.child! do
35
+ json.view 'h1-v1'
36
+ json.text 'Footer'
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,35 @@
1
+ json.title 'Pages'
2
+
3
+ render "#{@path_prefix}/nav_menu", json: json
4
+
5
+ json_body_with_list json do
6
+ json.rows do
7
+ json.child! do
8
+ json.template 'thumbnail-v1'
9
+ json.title 'Nav Buttons'
10
+ json.onClick do
11
+ json.action 'windows/open-v1'
12
+ json.url json_ui_garage_url(path: 'pages/nav_buttons')
13
+ end
14
+ end
15
+
16
+ json.child! do
17
+ json.template 'thumbnail-v1'
18
+ json.title 'Hamburger Layout'
19
+ json.onClick do
20
+ json.action 'windows/open-v1'
21
+ json.url json_ui_garage_url(path: 'pages/layout')
22
+ end
23
+ end
24
+
25
+ json.child! do
26
+ json.template 'thumbnail-v1'
27
+ json.title 'Full Width/Height'
28
+ json.onClick do
29
+ json.action 'windows/open-v1'
30
+ json.url json_ui_garage_url(path: 'pages/full_width_height')
31
+ end
32
+ end
33
+
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ json.title 'Pages'
2
+
3
+ render "#{@path_prefix}/nav_menu", json: json
4
+
5
+ header = Jbuilder.new do |json|
6
+ json.padding(top: 12, left: 20, right: 20, bottom: 12)
7
+ json.backgroundColor '#b3bac2'
8
+ json.subviews do
9
+ json.child! do
10
+ json.view 'h1-v1'
11
+ json.text 'Header'
12
+ end
13
+ end
14
+ end
15
+
16
+ footer = Jbuilder.new do |json|
17
+ json.padding(top: 12, left: 20, right: 20, bottom: 12)
18
+ json.backgroundColor '#b3bac2'
19
+ json.subviews do
20
+ json.child! do
21
+ json.view 'h1-v1'
22
+ json.text 'Footer'
23
+ end
24
+ end
25
+ end
26
+
27
+ options = {padding: {top: 20, left: 20, right: 20, bottom: 20}}
28
+ json_body_with_scroll json, header, footer, options do
29
+ (1..100).each do |index|
30
+ json.child! do
31
+ json.view 'label-v1'
32
+ json.text 'Content'
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,32 @@
1
+ json.title 'Pages'
2
+
3
+ render "#{@path_prefix}/nav_menu", json: json
4
+
5
+ json.rightNavButtons do
6
+ json.child! do
7
+ json.icon do
8
+ json.materialName 'search'
9
+ end
10
+ json.onClick do
11
+ json.action 'dialogs/alert-v1'
12
+ json.message 'Perform some action'
13
+ end
14
+ end
15
+
16
+ json.child! do
17
+ json.icon do
18
+ json.materialName 'map'
19
+ end
20
+ json.onClick do
21
+ json.action 'dialogs/alert-v1'
22
+ json.message 'Perform some action'
23
+ end
24
+ end
25
+ end
26
+
27
+ json_body_with_scroll json do
28
+ json.child! do
29
+ json.view 'label-v1'
30
+ json.text 'See the right menu buttons on the nav bar'
31
+ end
32
+ end