glib-web 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c9296a445e5e0d74a2b3c801fe2fc02d2534c97
4
- data.tar.gz: e2670acc3fb614affb71939f1d33609f7cd53e17
3
+ metadata.gz: 16cdd34be25cdf7ddc7eed6386b812fad3344f9d
4
+ data.tar.gz: 22e6e356684d59ef1eacafc4db92f1ba3b65cc3e
5
5
  SHA512:
6
- metadata.gz: aeeb6f7c4b82cded13854c5ed44e80836257d29c98b06b223f00947fa77692a3191c50a07ffe0c56e1bedd7aa5656ec241398ec46a78aa8c6651c6bbb0baf051
7
- data.tar.gz: 7d176519ccc425f4bf889e73e41ad068bf93c7366902a9f3230f2fbe5ed8655d6dabc53193220abf34f4553bff59f63b89192d434a115d95aa660e898f7e4642
6
+ metadata.gz: 760f82dd68348ebe244c5b4a9a13ab4250b39ccb4aaeb8cda728d51b936be3e5603d06021a7a78313da84eb73670052d35e133b84c2b3cc81199af5380726dfe
7
+ data.tar.gz: 94fa00daca4205c602579f97c6b4ee5e1846736b301b07ac2fea10efa05b9e5800302ad2c96d04fb69bcd817325e9aaca1cb3530f039fb9f01a94dcf975ef4db
@@ -127,5 +127,9 @@ class Glib::JsonUi::ViewBuilder
127
127
  string :distribution
128
128
  end
129
129
 
130
+ class Card < View
131
+ views :childViews
132
+ end
133
+
130
134
  end
131
135
  end
@@ -1,9 +1,14 @@
1
1
  json.title 'Actions'
2
2
 
3
3
  json_ui_page json do |page|
4
- render "#{@path_prefix}/nav_menu", json: json, page: page
4
+ render "#{@path_prefix}/nav_menu", json: json, page: page
5
5
 
6
- page.list sections: [->(section) do
6
+ # page.header padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(header) do
7
+ # header.label text: "Timestamp: #{DateTime.current.to_i}"
8
+ # end
9
+
10
+ page.list sections: [
11
+ ->(section) do
7
12
  section.header padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(header) do
8
13
  header.h3 text: 'Dialogs'
9
14
  end
@@ -40,16 +45,30 @@ json_ui_page json do |page|
40
45
  end
41
46
 
42
47
  section.rows builder: ->(template) do
43
- template.thumbnail title: 'windows/reload', onClick: ->(action) do
44
- action.windows_reload
45
- end
46
-
47
48
  template.thumbnail title: 'windows/close', onClick: ->(action) do
48
49
  action.windows_close onClose: ->(subaction) do
49
50
  subaction.dialogs_alert message: 'Previous window closed'
50
51
  end
51
52
  end
52
53
  end
54
+ end, ->(section) do
55
+ section.header padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(header) do
56
+ header.h3 text: 'Reload'
57
+ header.br height: 6
58
+ header.label text: 'Reload does not open a new page/screen. Click reload a few times, then click back and notice that it goes back to the page before the reload.'
59
+ end
60
+
61
+ section.rows builder: ->(template) do
62
+ template.thumbnail title: "windows/reload (timestamp: #{DateTime.current.to_i})", onClick: ->(action) do
63
+ action.windows_reload
64
+ end
65
+
66
+ reload_counter = params[:reload_counter].to_i
67
+ template.thumbnail title: "windows/reload with URL (counter: #{reload_counter})", onClick: ->(action) do
68
+ action.windows_reload url: json_ui_garage_url(path: 'actions/index', reload_counter: reload_counter + 1)
69
+ end
70
+
71
+ end
53
72
  end
54
73
  ]
55
74
  end
@@ -1,11 +1,8 @@
1
-
2
1
  name, _ = params.require(:user).values_at(:name)
3
- json.onResponse do
4
- if name.present?
5
- json.action 'dialogs/alert-v1'
6
- json.message "Submitted information: #{params.require(:user).values.join(", ")}"
2
+ json_ui_response json do |action|
3
+ if !name.present?
4
+ action.dialogs_alert message: 'Please enter name'
7
5
  else
8
- json.action 'dialogs/alert-v1'
9
- json.message 'Please enter name'
6
+ action.dialogs_alert message: "Submitted information: #{params.require(:user).values.join(", ")}"
10
7
  end
11
8
  end
@@ -1,6 +1,5 @@
1
1
  sleep 0.5
2
2
 
3
- json.onResponse do
4
- json.action 'dialogs/alert-v1'
5
- json.message 'Success!'
3
+ json_ui_response json do |action|
4
+ action.dialogs_alert message: 'Success!'
6
5
  end
@@ -3,70 +3,56 @@ json.title 'Forms'
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.rows builder: ->(template) do
8
- template.thumbnail title: 'Basic', onClick: ->(action) do
9
- action.windows_open url: json_ui_garage_url(path: 'forms/basic')
6
+ page.list sections: [
7
+ ->(section) do
8
+ section.header padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(header) do
9
+ header.h3 text: 'Form Fields'
10
10
  end
11
- template.thumbnail title: 'Submit Indicator', onClick: ->(action) do
12
- action.windows_open url: json_ui_garage_url(path: 'forms/submit_indicator')
13
- end
14
- template.thumbnail title: 'Floating Submit', onClick: ->(action) do
15
- action.windows_open url: json_ui_garage_url(path: 'forms/floating_submit')
11
+
12
+ section.rows builder: ->(template) do
13
+ template.thumbnail title: 'Basic', onClick: ->(action) do
14
+ action.windows_open url: json_ui_garage_url(path: 'forms/basic')
15
+ end
16
+ template.thumbnail title: 'Pickers (TODO: web, ios, android)', onClick: ->(action) do
17
+ action.windows_open url: json_ui_garage_url(path: 'forms/pickers')
18
+ end
19
+ template.thumbnail title: 'File Upload', onClick: ->(action) do
20
+ action.windows_open url: json_ui_garage_url(path: 'forms/file_upload')
21
+ end
22
+ template.thumbnail title: 'Floating Submit', onClick: ->(action) do
23
+ action.windows_open url: json_ui_garage_url(path: 'forms/floating_submit')
24
+ end
25
+
16
26
  end
17
- template.thumbnail title: 'File Upload', onClick: ->(action) do
18
- action.windows_open url: json_ui_garage_url(path: 'forms/file_upload')
27
+ end, ->(section) do
28
+ section.header padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(header) do
29
+ header.h3 text: 'Submission Logics'
19
30
  end
20
- template.thumbnail title: 'Pickers', onClick: ->(action) do
21
- action.windows_open url: json_ui_garage_url(path: 'forms/pickers')
31
+
32
+ section.rows builder: ->(template) do
33
+ template.thumbnail title: "Submission Flow (timestamp: #{DateTime.current.to_i})", onClick: ->(action) do
34
+ action.windows_open url: json_ui_garage_url(path: 'forms/submission_flow')
35
+ end
36
+ template.thumbnail title: "Submission Indicator", onClick: ->(action) do
37
+ action.windows_open url: json_ui_garage_url(path: 'forms/submission_indicator')
38
+ end
39
+ template.thumbnail title: 'Text Validation - TODO: web, ios, android', onClick: ->(action) do
40
+ action.windows_open url: json_ui_garage_url(path: 'forms/text_validation')
41
+ end
42
+
22
43
  end
23
- template.thumbnail title: 'Text Validation', onClick: ->(action) do
24
- action.windows_open url: json_ui_garage_url(path: 'forms/text_validation')
44
+ end, ->(section) do
45
+ section.header padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(header) do
46
+ header.h3 text: 'Web Only'
25
47
  end
26
- template.thumbnail title: 'Others', onClick: ->(action) do
27
- action.windows_open url: json_ui_garage_url(path: 'forms/others')
48
+
49
+ section.rows builder: ->(template) do
50
+ template.thumbnail title: 'Rich Text Editor', onClick: ->(action) do
51
+ action.windows_open url: json_ui_garage_url(path: 'forms/rich_text')
52
+ end
53
+
28
54
  end
29
55
  end
56
+ ]
30
57
 
31
- end
32
58
  end
33
-
34
- # json_body_with_list json do
35
- # json.rows do
36
- # json.child! do
37
- # json.template 'thumbnail-v1'
38
- # json.title 'Basic'
39
- # json.onClick do
40
- # json.action 'windows/open-v1'
41
- # json.url json_ui_garage_url(path: 'forms/basic')
42
- # end
43
- # end
44
-
45
- # json.child! do
46
- # json.template 'thumbnail-v1'
47
- # json.title 'Submit Indicator'
48
- # json.onClick do
49
- # json.action 'windows/open-v1'
50
- # json.url json_ui_garage_url(path: 'forms/submit_indicator')
51
- # end
52
- # end
53
-
54
- # json.child! do
55
- # json.template 'thumbnail-v1'
56
- # json.title 'Floating Submit'
57
- # json.onClick do
58
- # json.action 'windows/open-v1'
59
- # json.url json_ui_garage_url(path: 'forms/floating_submit')
60
- # end
61
- # end
62
-
63
- # json.child! do
64
- # json.template 'thumbnail-v1'
65
- # json.title 'File Upload'
66
- # json.onClick do
67
- # json.action 'windows/open-v1'
68
- # json.url json_ui_garage_url(path: 'forms/file_upload')
69
- # end
70
- # end
71
- # end
72
- # end
@@ -0,0 +1,17 @@
1
+ json.title 'Forms'
2
+
3
+ json_ui_page json do |page|
4
+ render "#{@path_prefix}/nav_menu", json: json, page: page
5
+
6
+ page.form url: json_ui_garage_url(path: 'forms/submission_flow_post'), method: 'post', padding: { top: 12, left: 20, right: 20, bottom: 12 }, childViews: ->(form) do
7
+ form.fields_radioGroup name: 'user[flow]', childViews: ->(group) do
8
+ group.h3 text: 'Flow'
9
+ group.br height: 6
10
+ group.fields_radio value: 'close_reload', label: 'close+reload - useful for form submission in mobile apps'
11
+ group.fields_radio value: 'open', label: 'open - useful for form submission in web app'
12
+ group.fields_radio value: 'close_alert', label: 'close+alert - useful for non-model form (e.g. contact us) in both mobile/web'
13
+ group.fields_radio value: 'alert_close', label: 'alert+close - useful for non-model form (e.g. contact us) in both mobile/web'
14
+ end
15
+ form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
16
+ end
17
+ end
@@ -0,0 +1,24 @@
1
+
2
+ flow = params.require(:user)[:flow] if params[:user]
3
+ json_ui_response json do |action|
4
+ if !flow.present?
5
+ action.dialogs_alert message: 'Please enter all required information'
6
+ else
7
+ case flow
8
+ when 'close_reload'
9
+ action.windows_close onClose: ->(action) do
10
+ action.windows_reload
11
+ end
12
+ when 'close_alert'
13
+ action.windows_close onClose: ->(action) do
14
+ action.dialogs_alert message: 'Thanks for the submission!'
15
+ end
16
+ when 'alert_close'
17
+ action.dialogs_alert message: 'Thanks for the submission!', onClose: ->(action) do
18
+ action.windows_close
19
+ end
20
+ when 'open'
21
+ action.windows_open url: json_ui_garage_url(path: 'forms/index')
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,9 @@
1
+ json.title 'Forms'
2
+
3
+ json_ui_page json do |page|
4
+ render "#{@path_prefix}/nav_menu", json: json, page: page
5
+
6
+ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: { top: 12, left: 20, right: 20, bottom: 12 }, childViews: ->(form) do
7
+ form.button text: 'This button gets disabled on submit', onClick: ->(action) { action.forms_submit }
8
+ end
9
+ end
@@ -14,7 +14,7 @@ json_ui_page json do |page|
14
14
  end
15
15
  template.thumbnail title: 'Item with subtitle', subtitle: 'Item subtitle'
16
16
  template.thumbnail title: 'Item with thumbnail image', subtitle: 'Item subtitle', imageUrl: @sample_image_url
17
- template.featured title: 'Featured with featured image', subtitle: 'Item subtitle', imageUrl: @sample_image_url
17
+ # template.featured title: 'Featured with featured image', subtitle: 'Item subtitle', imageUrl: @sample_image_url
18
18
  end
19
19
  end
20
20
  end
@@ -0,0 +1,31 @@
1
+ json.title 'Panels'
2
+
3
+ json_ui_page json do |page|
4
+ render "#{@path_prefix}/nav_menu", json: json, page: page
5
+
6
+ page.scroll childViews: ->(scroll) do
7
+ scroll.br height: 20
8
+
9
+ scroll.panels_card width: 'matchParent', padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(card) do
10
+ card.h1 text: 'Vertical Panel'
11
+ card.panels_vertical backgroundColor: '#b3bac2', childViews: ->(panel) do
12
+ # card.panels_vertical backgroundColor: '#ff0000', childViews: ->(panel) do
13
+ panel.button text: 'Button1'
14
+ panel.button text: 'Button2', width: 200
15
+ panel.button text: 'Button3', width: 300
16
+ end
17
+ end
18
+
19
+ scroll.br height: 20
20
+
21
+ scroll.panels_card width: 'matchParent', padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(card) do
22
+ card.h1 text: 'Vertical Panel with equal filling'
23
+ card.panels_vertical backgroundColor: '#b3bac2', height: 300, distribution: 'fillEqually', childViews: ->(panel) do
24
+ panel.button text: 'Button1'
25
+ panel.button text: 'Button2'
26
+ panel.button text: 'Button3'
27
+ end
28
+ end
29
+
30
+ end
31
+ end
@@ -5,6 +5,9 @@ json_ui_page json do |page|
5
5
 
6
6
  page.list firstSection: ->(section) do
7
7
  section.rows builder: ->(template) do
8
+ template.thumbnail title: 'Card', onClick: ->(action) do
9
+ action.windows_open url: json_ui_garage_url(path: 'panels/card')
10
+ end
8
11
  template.thumbnail title: 'Vertical', onClick: ->(action) do
9
12
  action.windows_open url: json_ui_garage_url(path: 'panels/vertical')
10
13
  end
@@ -4,6 +4,29 @@ json_ui_page json do |page|
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
5
 
6
6
  page.scroll childViews: ->(scroll) do
7
+ # scroll.br height: 20
8
+
9
+ # scroll.panels_card width: 'matchParent', padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(card) do
10
+ # card.h1 text: 'Vertical Panel'
11
+ # card.panels_vertical backgroundColor: '#b3bac2', childViews: ->(panel) do
12
+ # # card.panels_vertical backgroundColor: '#ff0000', childViews: ->(panel) do
13
+ # panel.button text: 'Button1'
14
+ # panel.button text: 'Button2', width: 200
15
+ # panel.button text: 'Button3', width: 300
16
+ # end
17
+ # end
18
+
19
+ # scroll.br height: 20
20
+
21
+ # scroll.panels_card width: 'matchParent', padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(card) do
22
+ # card.h1 text: 'Vertical Panel with equal filling'
23
+ # card.panels_vertical backgroundColor: '#b3bac2', height: 300, distribution: 'fillEqually', childViews: ->(panel) do
24
+ # panel.button text: 'Button1'
25
+ # panel.button text: 'Button2'
26
+ # panel.button text: 'Button3'
27
+ # end
28
+ # end
29
+
7
30
  scroll.h1 text: 'Vertical Panel'
8
31
  scroll.panels_vertical backgroundColor: '#b3bac2', childViews: ->(panel) do
9
32
  panel.button text: 'Button1'
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.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -54,10 +54,11 @@ files:
54
54
  - app/views/json_ui/garage/forms/floating_submit.json.jbuilder
55
55
  - app/views/json_ui/garage/forms/generic_post.json.jbuilder
56
56
  - app/views/json_ui/garage/forms/index.json.jbuilder
57
- - app/views/json_ui/garage/forms/others.json.jbuilder
58
57
  - app/views/json_ui/garage/forms/pickers.json.jbuilder
59
- - app/views/json_ui/garage/forms/submit_indicator.json.jbuilder
60
- - app/views/json_ui/garage/forms/submit_indicator_post.json.jbuilder
58
+ - app/views/json_ui/garage/forms/rich_text.json.jbuilder
59
+ - app/views/json_ui/garage/forms/submission_flow.json.jbuilder
60
+ - app/views/json_ui/garage/forms/submission_flow_post.json.jbuilder
61
+ - app/views/json_ui/garage/forms/submission_indicator.json.jbuilder
61
62
  - app/views/json_ui/garage/forms/text_validation.json.jbuilder
62
63
  - app/views/json_ui/garage/home/index.json.jbuilder
63
64
  - app/views/json_ui/garage/lists/_infinite_scroll_section.json.jbuilder
@@ -69,6 +70,7 @@ files:
69
70
  - app/views/json_ui/garage/pages/layout.json.jbuilder
70
71
  - app/views/json_ui/garage/pages/nav_buttons.json.jbuilder
71
72
  - app/views/json_ui/garage/pages/tab_bar.json.jbuilder
73
+ - app/views/json_ui/garage/panels/card.json.jbuilder
72
74
  - app/views/json_ui/garage/panels/carousel.json.jbuilder
73
75
  - app/views/json_ui/garage/panels/horizontal.json.jbuilder
74
76
  - app/views/json_ui/garage/panels/index.json.jbuilder
@@ -1,18 +0,0 @@
1
- json.title 'Forms'
2
-
3
- options = {
4
- url: json_ui_garage_url(path: 'forms/submit_indicator_post'),
5
- method: 'post',
6
- padding: { top: 12, left: 20, right: 20, bottom: 12 }
7
- }
8
-
9
- json_ui_page json do |page|
10
- render "#{@path_prefix}/nav_menu", json: json, page: page
11
-
12
- page.form options.merge(childViews: ->(form) do
13
- form.fields_text name: 'user[name]', width: 'matchParent', label: 'Name'
14
- form.panels_split width: 'matchParent', rightViews: ->(split) do
15
- split.button text: 'Submit', onClick: ->(action) { action.forms_submit }
16
- end
17
- end)
18
- end
@@ -1,12 +0,0 @@
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