glib-web 0.4.66 → 0.4.67

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: 79b0d05fad96e500e336fd3705ed09ff53199d4d
4
- data.tar.gz: 6cec3284142a09fb31f2d65f797047be7909e769
3
+ metadata.gz: 904b947a5cea2a83a12ee5b084f11a54ad980616
4
+ data.tar.gz: 72bec3f5842e7a94d3cf1d89b6c818386a596309
5
5
  SHA512:
6
- metadata.gz: c8b9ab890ab1d8826d0839f1363102731a203ad82682e2846cb27a11e0caddb3144f9f10cb87d624a01837deb56a42878e5e81dd1d81e85ff46a1df60551b135
7
- data.tar.gz: 5dadd52713ca918d748c1a57d574eb048b0667b4e69dfe9d0d8f764e14589c538d36f70522a95feb27ac3a5a81381f1cf90b2c9bbfa3cb7ac0241b4635602614
6
+ metadata.gz: 68095f45e47b78a3b2e8d060e74caca8857ac71e74fbece088d8285d7113e4e43776f23799e877e8c135832234891d882dc2a77687677a7d1c31a95929b5c05d
7
+ data.tar.gz: 8a15b95af63a3268152c8fa3dcd399c1c64238cea18b7347fcbed1b0f5ca6bd92c305424237ba1d212d97a0a9dfbfa726ccbd7c3a6fc56b41102e5f1d7310e3f
@@ -170,6 +170,12 @@ module Glib
170
170
  raise "Invalid properties: #{options.keys}" if options.size > 0
171
171
  end
172
172
 
173
+ def onLoad(options = {})
174
+ json.onLoad do
175
+ yield @action_builder
176
+ end
177
+ end
178
+
173
179
  end
174
180
  end
175
181
  end
@@ -12,12 +12,14 @@ json_ui_page json do |page|
12
12
  selectedOptions: [ { value: 'id3', text: 'Item 3' } ],
13
13
  url: json_ui_garage_url(path: 'forms/dynamic_select_data')
14
14
 
15
+ form.spacer height: 14
15
16
  form.fields_dynamicSelect name: 'user[preferred_languages][]', width: 'matchParent', label: 'Preferred Languages',
16
17
  # value: ['id3', 'id5'], multiple: true,
17
18
  selectedOptions: [ { value: 'id3', text: 'Item 3' }, { value: 'id5', text: 'Item 5' } ],
18
19
  url: json_ui_garage_url(path: 'forms/dynamic_select_data'),
19
20
  multiple: true
20
21
 
22
+ form.spacer height: 14
21
23
  form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
22
24
  end
23
25
  end
@@ -13,28 +13,11 @@ json.rows do
13
13
  json.child! do
14
14
  index = page * count_per_page + i
15
15
  json.template 'thumbnail'
16
- json.title "City #{index}"
16
+ json.title "City #{index} (#{params[:q]})"
17
17
  json.subtitle "State #{index}"
18
18
  json.subsubtitle "Country #{index}"
19
19
  json.value "id#{index}"
20
20
  json.text "Item #{index}"
21
21
  end
22
22
  end
23
-
24
- # languages = {
25
- # 'zh-HK' => 'Hong Kong',
26
- # 'zh-TW' => 'Taiwan',
27
- # 'zh-CN' => 'China',
28
- # 'ja-JP' => 'Japan',
29
- # 'ko-KR' => 'Korea',
30
- # 'ru-RU' => 'Russian',
31
- # 'en-PH' => 'Philippines'
32
- # }
33
- # languages.each do |k, v|
34
- # json.child! do
35
- # json.value k
36
- # json.text v
37
- # end
38
- # end
39
-
40
23
  end
@@ -2,18 +2,18 @@ json.title 'Pages'
2
2
 
3
3
  json_ui_page json do |page|
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page, top_nav: true
5
-
5
+
6
6
  page.list sections: [
7
7
  ->(section) do
8
8
  section.rows builder: ->(template) do
9
9
  template.thumbnail title: 'Hamburger Layout', onClick: ->(action) do
10
10
  action.windows_open url: json_ui_garage_url(path: 'pages/layout')
11
11
  end
12
-
12
+
13
13
  template.thumbnail title: 'Full Width/Height', onClick: ->(action) do
14
14
  action.windows_open url: json_ui_garage_url(path: 'pages/full_width_height')
15
15
  end
16
-
16
+
17
17
  template.thumbnail title: 'Tab Bar', onClick: ->(action) do
18
18
  action.windows_open url: json_ui_garage_url(path: 'pages/tab_bar')
19
19
  end
@@ -21,6 +21,10 @@ json_ui_page json do |page|
21
21
  template.thumbnail title: 'Nav Buttons', onClick: ->(action) do
22
22
  action.windows_open url: json_ui_garage_url(path: 'pages/nav_buttons')
23
23
  end
24
+
25
+ template.thumbnail title: 'Loading Indicator', onClick: ->(action) do
26
+ action.windows_open url: json_ui_garage_url(path: 'pages/loading_indicator')
27
+ end
24
28
  end
25
29
  end,
26
30
  ->(section) do
@@ -32,12 +36,12 @@ json_ui_page json do |page|
32
36
  template.thumbnail title: 'Flat Centered', onClick: ->(action) do
33
37
  action.windows_open url: json_ui_garage_url(path: 'pages/flat_centered')
34
38
  end
35
-
39
+
36
40
  template.thumbnail title: 'Full Width', onClick: ->(action) do
37
41
  action.windows_open url: json_ui_garage_url(path: 'pages/full_width')
38
42
  end
39
43
  end
40
44
  end
41
45
  ]
42
-
46
+
43
47
  end
@@ -0,0 +1,10 @@
1
+ sleep 1
2
+
3
+ json.title 'Pages'
4
+
5
+ page = json_ui_page json
6
+ render "#{@path_prefix}/nav_menu", json: json, page: page
7
+
8
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
9
+ scroll.label text: 'On the web, the loading indicator should be show on the browser tab.'
10
+ end
@@ -5,11 +5,11 @@ module Glib
5
5
  @http = http
6
6
  end
7
7
 
8
- def click object
8
+ def click(object)
9
9
  @http.router.step(@http, object)
10
10
  end
11
11
 
12
- def crawl views
12
+ def crawl(views)
13
13
  @http.router.crawl_multiple views, ->(view) do
14
14
  click view
15
15
  end
@@ -17,4 +17,4 @@ module Glib
17
17
  end
18
18
 
19
19
  end
20
- end
20
+ end
@@ -1,16 +1,22 @@
1
1
  module Glib
2
2
  module JsonCrawler
3
3
  class FormsSubmit < ActionCrawler
4
- def initialize(http, params, action, form)
4
+ def initialize(http, form)
5
5
  super(http)
6
6
 
7
+ raise 'Submit action needs to be inside a form' unless form
8
+
7
9
  @http = http
8
10
 
9
- case form['method']
11
+ method = form['method']
12
+ action = "forms/#{method}"
13
+
14
+ case method
10
15
  when 'patch', 'put'
11
16
  submit_update(form, action)
12
17
  else
13
- http.router.log action, params['url']
18
+ url = form['url']
19
+ http.router.log action, url
14
20
  end
15
21
  end
16
22
 
@@ -19,16 +25,24 @@ module Glib
19
25
  fields = []
20
26
  params = {}
21
27
  @http.router.crawl_multiple view['childViews'], ->(child) do
22
- if child['view'].start_with?('fields/')
28
+ name = child['view']
29
+ if name.start_with?('fields/')
23
30
  fields << child
24
- params[child['name']] = child['value']
31
+
32
+ include_params = case name
33
+ when 'fields/check', 'fields/check-v1'
34
+ child['checked']
35
+ else
36
+ true
37
+ end
38
+
39
+ params[child['name']] = child['value'] if include_params
25
40
  end
26
41
  end
27
42
 
28
43
  json = @http.patch url, action, params
29
44
  click(json)
30
45
  end
31
-
32
46
  end
33
47
  end
34
48
  end
@@ -23,6 +23,15 @@ module Glib
23
23
  Glib::JsonCrawler::Coverage.coverage_files.add(controller.class.instance_method(http.action_name).source_location.first)
24
24
  end
25
25
 
26
+ case args['view']
27
+ when 'fields/submit-v1', 'fields/submit'
28
+ @depth += 1
29
+ forms = @visitor.forms
30
+ JsonCrawler::FormsSubmit.new(http, forms.last)
31
+ @depth -= 1
32
+ return
33
+ end
34
+
26
35
  if args.is_a?(Hash) && args['rel'] != 'nofollow'
27
36
  if (onClick = (args.fetch('onClick', nil) || args.fetch('onResponse', nil)))
28
37
  action = onClick['action']
@@ -31,27 +40,31 @@ module Glib
31
40
 
32
41
  if action.present?
33
42
  @depth += 1
34
- child = case action
43
+ # child =
44
+ case action
35
45
  when 'initiate_navigation'
36
46
  @read_only_actions.add([action, params['url']])
37
47
  JsonCrawler::NavInitiate.new(http, params, action)
38
- when 'windows/open-v1', 'dialogs/open-v1', 'windows/reload-v1'
48
+ when 'windows/open-v1', 'dialogs/open-v1', 'windows/reload-v1', 'windows/open', 'dialogs/open', 'windows/reload'
39
49
  @read_only_actions.add([action, params['url']])
40
50
  JsonCrawler::WindowsOpen.new(http, params, action)
41
- when 'http/post-v1'
51
+ when 'http/post-v1', 'http/post'
42
52
  JsonCrawler::ActionHttp.new(:post, http, params, action)
43
- when 'forms/submit-v1'
53
+ when 'forms/submit-v1', 'forms/submit'
44
54
  forms = @visitor.forms
45
- raise 'Submit action needs to be inside a form' if forms.size < 1
46
- JsonCrawler::FormsSubmit.new(http, params, action, forms.last)
55
+ # raise 'Submit action needs to be inside a form' if forms.size < 1
56
+ JsonCrawler::FormsSubmit.new(http, forms.last)
47
57
  else
48
- unless ['http/delete-v1', 'dialogs/oauth-v1', 'windows/openWeb-v1'].include?(action)
58
+ unless [
59
+ 'http/delete-v1', 'dialogs/oauth-v1', 'windows/openWeb-v1',
60
+ 'http/delete', 'dialogs/oauth', 'windows/openWeb'
61
+ ].include?(action)
49
62
  @read_only_actions.add([action, params['url']])
50
63
  end
51
64
  self.log action, params['url']
52
65
  end
53
66
  @depth -= 1
54
- child
67
+ # child
55
68
  end
56
69
  end
57
70
  end
@@ -74,4 +87,3 @@ module Glib
74
87
  end
75
88
  end
76
89
  end
77
-
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.4.66
4
+ version: 0.4.67
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -147,6 +147,7 @@ files:
147
147
  - app/views/json_ui/garage/pages/full_width_height.json.jbuilder
148
148
  - app/views/json_ui/garage/pages/index.json.jbuilder
149
149
  - app/views/json_ui/garage/pages/layout.json.jbuilder
150
+ - app/views/json_ui/garage/pages/loading_indicator.json.jbuilder
150
151
  - app/views/json_ui/garage/pages/nav_buttons.json.jbuilder
151
152
  - app/views/json_ui/garage/pages/tab_bar.json.jbuilder
152
153
  - app/views/json_ui/garage/panels/_styled.json.jbuilder