glib-web 0.2.2 → 0.2.3

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: 6172e95852bba5794a140c99ad5e82fe0c744794
4
- data.tar.gz: 2bcf5c2e01de6e21b29a48a6cb27e8818481e244
3
+ metadata.gz: f28df42b84aa95f3f0b7a62edc043922c794088b
4
+ data.tar.gz: 15fcac1a3f3ff687de3282bec0e8cbe6b5cdc633
5
5
  SHA512:
6
- metadata.gz: 84d11ec676c1d58f85efe5d40a6b6cc001ed4243f1038ee4b4316a7df2452018d8e7797f9fcfcacb1cbbe2478305afe4ee90505b3de9c259a08c588757fd9610
7
- data.tar.gz: db45ed05de333b5b83b254d783d00bb175202a1912682a6b2fe0e860f455af25f5771b7f851f8e1a858b63e42dc857ce650dad41e292a66fcb60768eed26dad0
6
+ metadata.gz: 1c5964f043ccf8d63df46718435865515652e7d484b01decb790bce8eacc49812dc3e348c92fbcd446077869764991f604a97dbc0254128ca2da200007eb145a
7
+ data.tar.gz: 68be8065f0f8d9f1b18e142643c7355d91d8e5b6be608958abb5ad30c9e0f0619b1b9d0353c3014c39b5eddf4cd41670cf8cff58c1ceeb23e3ecbf430c3856e9
@@ -3,8 +3,41 @@ module Concerns::Application::Json::Libs
3
3
 
4
4
  included do
5
5
  extend ClassMethods
6
+
7
+ helper_method :json_ui_app_bundle_id, :json_ui_app_build_version, :json_ui_app_device_os
8
+ helper_method :json_ui_app_is_android?, :json_ui_app_is_ios?, :json_ui_app_is_web?
9
+ end
10
+
11
+ def json_ui_app_bundle_id
12
+ @json_ui_app_bundle_id ||= request.headers['JsonUiApp-Bundle-Id']
13
+ end
14
+
15
+ def json_ui_app_build_version
16
+ @json_ui_app_build_version ||= request.headers['JsonUiApp-Build-Version']
17
+ @json_ui_app_build_version = params[:build_version] if @json_ui_app_build_version.nil? && Rails.env.development? # For easy testing
18
+ @json_ui_app_build_version
19
+ end
20
+
21
+ def json_ui_app_device_os
22
+ @json_ui_app_device_os ||= request.headers['JsonUiApp-Device-Os']
23
+ @json_ui_app_device_os = params[:device_os] if @json_ui_app_device_os.nil? && Rails.env.development? # For easy testing
24
+ @json_ui_app_device_os || 'web'
6
25
  end
7
26
 
27
+ def json_ui_app_is_android?
28
+ json_ui_app_device_os == 'android'
29
+ end
30
+
31
+ def json_ui_app_is_ios?
32
+ json_ui_app_device_os == 'ios'
33
+ end
34
+
35
+ def json_ui_app_is_web?
36
+ json_ui_app_device_os == 'web'
37
+ end
38
+
39
+
40
+
8
41
  module ClassMethods
9
42
 
10
43
  def json_libs_init(options)
@@ -1,131 +1,53 @@
1
1
 
2
-
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
7
- action.windows_open url: root_url
2
+ if local_assigns[:top_nav] || json_ui_app_is_web?
3
+
4
+ page.leftDrawer content: ->(drawer) do
5
+ drawer.header childViews: ->(header) do
6
+ header.h1 text: 'App', onClick: ->(action) do
7
+ # action.windows_open url: json_ui_garage_url
8
+ action.windows_open url: root_url
9
+ end
10
+ end
11
+
12
+ drawer.rows builder: ->(menu) do
13
+
14
+ menu.button text: 'Menu', onClick: ->(action) do
15
+ action.windows_open url: json_ui_garage_url
16
+ end
17
+
18
+ menu.button text: 'Pages', onClick: ->(action) do
19
+ action.windows_open url: json_ui_garage_url(path: 'pages/index')
20
+ end
21
+
22
+ menu.button text: 'Lists', onClick: ->(action) do
23
+ action.windows_open url: json_ui_garage_url(path: 'lists/index')
24
+ end
25
+
26
+ menu.button text: 'Forms', onClick: ->(action) do
27
+ action.windows_open url: json_ui_garage_url(path: 'forms/index')
28
+ end
29
+
30
+ menu.button text: 'Panels', onClick: ->(action) do
31
+ action.windows_open url: json_ui_garage_url(path: 'panels/index')
32
+ end
33
+
34
+ menu.button text: 'Views', onClick: ->(action) do
35
+ action.windows_open url: json_ui_garage_url(path: 'views/index')
36
+ end
37
+
38
+ menu.button text: 'Actions', onClick: ->(action) do
39
+ action.windows_open url: json_ui_garage_url(path: 'actions/index')
40
+ end
41
+
42
+ menu.button text: 'Diagnostics', onClick: ->(action) do
43
+ action.dialogs_alert message: %{
44
+ Bundle ID: #{json_ui_app_bundle_id || '<unknown>'}
45
+ App Version: #{json_ui_app_build_version || '<unknown>'}
46
+ Device OS: #{json_ui_app_device_os}
47
+ }
48
+ end
49
+
8
50
  end
9
51
  end
10
-
11
- drawer.rows builder: ->(menu) do
12
-
13
- menu.button text: 'Menu', onClick: ->(action) do
14
- action.windows_open url: json_ui_garage_url
15
- end
16
-
17
- menu.button text: 'Pages', onClick: ->(action) do
18
- action.windows_open url: json_ui_garage_url(path: 'pages/index')
19
- end
20
-
21
- menu.button text: 'Lists', onClick: ->(action) do
22
- action.windows_open url: json_ui_garage_url(path: 'lists/index')
23
- end
24
-
25
- menu.button text: 'Forms', onClick: ->(action) do
26
- action.windows_open url: json_ui_garage_url(path: 'forms/index')
27
- end
28
-
29
- menu.button text: 'Panels', onClick: ->(action) do
30
- action.windows_open url: json_ui_garage_url(path: 'panels/index')
31
- end
32
-
33
- menu.button text: 'Views', onClick: ->(action) do
34
- action.windows_open url: json_ui_garage_url(path: 'views/index')
35
- end
36
-
37
- menu.button text: 'Actions', onClick: ->(action) do
38
- action.windows_open url: json_ui_garage_url(path: 'actions/index')
39
- end
40
-
41
- menu.button text: 'Diagnostics', onClick: ->(action) do
42
- action.dialogs_alert message: 'JSON UI v1.0'
43
- end
44
-
45
- end
52
+
46
53
  end
47
-
48
- # json.leftDrawer do
49
- # # json.items do
50
- # # json.child! do
51
- # # json.icon do
52
- # # json.materialName 'home'
53
- # # end
54
- # # json.text 'Home'
55
- # # json.onClick do
56
- # # json.action 'windows/open-v1'
57
- # # json.url json_ui_garage_url
58
- # # end
59
- # # end
60
- # # end
61
-
62
- # # json.items do
63
- # # json.child! do
64
- # # json.text 'Pages'
65
- # # json.onClick do
66
- # # json.action 'windows/open-v1'
67
- # # json.url json_ui_garage_url(path: 'pages/index')
68
- # # end
69
- # # end
70
- # # end
71
-
72
- # # json.items do
73
- # # json.child! do
74
- # # json.text 'Lists'
75
- # # json.onClick do
76
- # # json.action 'windows/open-v1'
77
- # # json.url json_ui_garage_url(path: 'lists/index')
78
- # # end
79
- # # end
80
- # # end
81
-
82
- # # json.items do
83
- # # json.child! do
84
- # # json.text 'Forms'
85
- # # json.onClick do
86
- # # json.action 'windows/open-v1'
87
- # # json.url json_ui_garage_url(path: 'forms/index')
88
- # # end
89
- # # end
90
- # # end
91
-
92
- # # json.items do
93
- # # json.child! do
94
- # # json.text 'Panels'
95
- # # json.onClick do
96
- # # json.action 'windows/open-v1'
97
- # # json.url json_ui_garage_url(path: 'panels/index')
98
- # # end
99
- # # end
100
- # # end
101
-
102
- # # json.items do
103
- # # json.child! do
104
- # # json.text 'Views'
105
- # # json.onClick do
106
- # # json.action 'windows/open-v1'
107
- # # json.url json_ui_garage_url(path: 'views/index')
108
- # # end
109
- # # end
110
- # # end
111
-
112
- # # json.items do
113
- # # json.child! do
114
- # # json.text 'Actions'
115
- # # json.onClick do
116
- # # json.action 'windows/open-v1'
117
- # # json.url json_ui_garage_url(path: 'actions/index')
118
- # # end
119
- # # end
120
- # # end
121
-
122
- # # json.items do
123
- # # json.child! do
124
- # # json.text 'Diagnostics'
125
- # # json.onClick do
126
- # # json.action 'dialogs/alert-v1'
127
- # # json.message 'JSON UI v1.0'
128
- # # end
129
- # # end
130
- # # end
131
- # end
@@ -1,7 +1,7 @@
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, top_nav: true
5
5
 
6
6
  # page.header padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(header) do
7
7
  # header.label text: "Timestamp: #{DateTime.current.to_i}"
@@ -54,7 +54,7 @@ json_ui_page json do |page|
54
54
  end, ->(section) do
55
55
  section.header padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(header) do
56
56
  header.h3 text: 'Reload'
57
- header.br height: 6
57
+ header.spacer height: 6
58
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
59
  end
60
60
 
@@ -1,7 +1,7 @@
1
1
  json.title 'Forms'
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, top_nav: true
5
5
 
6
6
  page.list sections: [
7
7
  ->(section) do
@@ -6,7 +6,7 @@ json_ui_page json do |page|
6
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
7
  form.fields_radioGroup name: 'user[flow]', childViews: ->(group) do
8
8
  group.h3 text: 'Flow'
9
- group.br height: 6
9
+ group.spacer height: 6
10
10
  group.fields_radio value: 'close_reload', label: 'close+reload - useful for form submission in mobile apps'
11
11
  group.fields_radio value: 'open', label: 'open - useful for form submission in web app'
12
12
  group.fields_radio value: 'close_alert', label: 'close+alert - useful for non-model form (e.g. contact us) in both mobile/web'
@@ -1,7 +1,7 @@
1
1
  json.title 'Menu'
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, top_nav: true
5
5
 
6
6
  page.list firstSection: ->(section) do
7
7
  section.rows builder: ->(template) do
@@ -1,7 +1,7 @@
1
1
  json.title 'Lists'
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, top_nav: true
5
5
 
6
6
  page.list firstSection: ->(section) do
7
7
  section.rows builder: ->(template) do
@@ -1,7 +1,7 @@
1
1
  json.title 'Pages'
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, top_nav: true
5
5
 
6
6
  page.list firstSection: ->(section) do
7
7
  section.rows builder: ->(template) do
@@ -18,7 +18,7 @@ json_ui_page json do |page|
18
18
  page.scroll padding: {top: 12, left: 20, right: 20, bottom: 12}, childViews: ->(scroll) do
19
19
  scroll.label text: "Tab index #{params[:tab].to_i} selected"
20
20
 
21
- scroll.br height: 10
21
+ scroll.spacer height: 10
22
22
 
23
23
  100.times do |i|
24
24
  scroll.label text: "Line #{i + 1}"
@@ -6,17 +6,17 @@ json_ui_page json do |page|
6
6
  page.scroll backgroundColor: '#fafafa', padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(scroll) do
7
7
  scroll.panels_card width: 'matchParent', padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(card) do
8
8
  card.h1 text: 'With Default Layout'
9
- card.br height: 6
9
+ card.spacer height: 6
10
10
  card.button text: 'Button1'
11
11
  card.button text: 'Button2'
12
12
  card.button text: 'Button3'
13
13
  end
14
14
 
15
- scroll.br height: 20
15
+ scroll.spacer height: 20
16
16
 
17
17
  scroll.panels_card width: 'matchParent', padding: { top: 12, bottom: 12, left: 16, right: 16 }, childViews: ->(card) do
18
18
  card.h1 text: 'With Child Panel'
19
- card.br height: 6
19
+ card.spacer height: 6
20
20
  card.panels_horizontal backgroundColor: '#b3bac2', childViews: ->(panel) do
21
21
  panel.button text: 'Button1'
22
22
  panel.button text: 'Button2'
@@ -1,7 +1,7 @@
1
1
  json.title 'Panels'
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, top_nav: true
5
5
 
6
6
  page.list firstSection: ->(section) do
7
7
  section.rows builder: ->(template) do
@@ -5,13 +5,13 @@ json_ui_page json do |page|
5
5
 
6
6
  page.scroll padding: body_padding, childViews: ->(scroll) do
7
7
  scroll.h2 text: 'Map'
8
- scroll.br height: 6
8
+ scroll.spacer height: 6
9
9
  scroll.map width: 'matchParent', latitude: 13.4837, longitude: 144.7917, zoom: 11, height: 250, dataUrl: json_ui_garage_url(path: 'views/map_data')
10
10
 
11
11
  # TODO: Implement in vuejs
12
- scroll.br height: 20
12
+ scroll.spacer height: 20
13
13
  scroll.h2 text: 'Calendar'
14
- scroll.br height: 6
14
+ scroll.spacer height: 6
15
15
  scroll.calendar width: 'matchParent', height: 500, dataUrl: json_ui_garage_url(path: 'views/calendar_data')
16
16
 
17
17
  end
@@ -5,22 +5,22 @@ json_ui_page json do |page|
5
5
 
6
6
  page.scroll padding: body_padding, childViews: ->(scroll) do
7
7
  scroll.h2 text: 'Avatar'
8
- scroll.br height: 6
8
+ scroll.spacer height: 6
9
9
  scroll.avatar url: 'https://www.wpjournalist.nl/wp-content/uploads/2019/03/avatar-jongen-voorbeeld-1.jpg'
10
10
 
11
- scroll.br height: 20
11
+ scroll.spacer height: 20
12
12
  scroll.h2 text: 'Image with URL'
13
- scroll.br height: 6
13
+ scroll.spacer height: 6
14
14
  scroll.image width: 100, url: @sample_image_url
15
15
 
16
- scroll.br height: 20
16
+ scroll.spacer height: 20
17
17
  scroll.h2 text: 'Image with base64 data'
18
- scroll.br height: 6
18
+ scroll.spacer height: 6
19
19
  scroll.image height: 100, base64Data: '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/P8VNQGNugV8AAF9fX8swM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Q1A2EWDfDEUVLyADj5AChSIQW6gu10bE/JG2VnCZGfo4R4d0sdQoBAHhPjhIB94v/wRoRKQWGRHgrhGSQJxCS+0pCZbEhAAOw=='
20
20
 
21
- scroll.br height: 20
21
+ scroll.spacer height: 20
22
22
  scroll.h2 text: 'QR Code as base64 image'
23
- scroll.br height: 6
23
+ scroll.spacer height: 6
24
24
  if defined? RQRCode
25
25
  qr_content = { version: 1, message: 'This is a test' }
26
26
  qr = RQRCode::QRCode.new(qr_content.to_json)
@@ -1,7 +1,7 @@
1
1
  json.title 'Views'
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, top_nav: true
5
5
 
6
6
  page.list firstSection: ->(section) do
7
7
  section.rows builder: ->(template) do
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.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''