glib-web 0.15.0 → 0.15.2

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
  SHA256:
3
- metadata.gz: 884f9ef9236368bb5739d56715d0aca1196e6d85f905ad258aaf2d7942333d07
4
- data.tar.gz: 3c870f312d7cb7b921ca4ff244d247d7c9b7e7f94ae359cd93696f6544c9682c
3
+ metadata.gz: 71cb6d54bc1fbb2c25ccbeffe5c3973a9c6623a796a0bdf34ce76d6f83598ea6
4
+ data.tar.gz: 78d7afacf9d015032060e8da2d77bb3ae88d31676ac22a5bb39776007e70cb2e
5
5
  SHA512:
6
- metadata.gz: 34f43053111cf3304a15a0311fc0b85031554b7a0c3be65b7795ebab0d438850ad7550eb977c33cc099ba09ea2d06258880aed767b89398b6fe2a8d80327f7f9
7
- data.tar.gz: f332e88b5d80b56c7b5fef95fce6551a7ca13a1a7a05b71626161b344d02f594a98c74b19e97d3247e4260c0cb5ab208ec83ac21d516d9ceb644706ddf1d6542
6
+ metadata.gz: b550f286f9f170a4a4bff70aca2d0f42a4f5327941d9228a47c172a832106af08d1bc525d6756b2902277e112c3b7ca5f146e6472cf4b27f642ba94f5e777e80
7
+ data.tar.gz: 14ffeb553fff62702924f8a558245f2cb9703f39d2873d9ad9a2e3b1831ab35edd75f6961d95b9d80fd090e5cb641e52843d4b2e4a15e07891cc3e958ca65e24
@@ -39,12 +39,22 @@ module Glib::Json::Traversal
39
39
  @forms = []
40
40
  end
41
41
 
42
- def parse_page(spec)
43
- if (form = spec['fullPageForm'])
42
+ def fullPageForm(spec)
43
+ spec['fullPageForm']
44
+ end
45
+
46
+ def begin_page(spec)
47
+ if (form = fullPageForm(spec))
44
48
  @forms << form
45
49
  end
46
50
  end
47
51
 
52
+ def end_page(spec)
53
+ if fullPageForm(spec)
54
+ @forms.pop
55
+ end
56
+ end
57
+
48
58
  def traverse_multiple(views, block)
49
59
  if views.is_a? Array
50
60
  views.each do |view|
@@ -26,6 +26,8 @@ class Glib::JsonUi::ActionBuilder
26
26
  class Show < Action
27
27
  panels_builder :content, :body
28
28
  bool :showClose
29
+ string :fullscreen # mobile, always
30
+ length :width
29
31
 
30
32
  # Future plan
31
33
  # panels_builder :content, :body, :footer
@@ -34,12 +36,16 @@ class Glib::JsonUi::ActionBuilder
34
36
  class Open < Action
35
37
  string :url, cache: true
36
38
  bool :showClose
39
+ string :fullscreen
40
+ length :width
37
41
  end
38
42
 
39
43
  class Reload < Action
40
44
  panels_builder :content, :body
41
45
  string :url, cache: true
42
46
  bool :showClose
47
+ string :fullscreen # mobile, always
48
+ length :width
43
49
  end
44
50
 
45
51
  class Close < Action
@@ -139,6 +139,7 @@ module Glib
139
139
 
140
140
  int :size
141
141
  string :url
142
+ string :base64Data
142
143
  action :onClick
143
144
  end
144
145
 
@@ -59,7 +59,11 @@ section.rows builder: ->(template) do
59
59
  end
60
60
 
61
61
  template.thumbnail title: 'dialogs/open', onClick: ->(action) do
62
- action.dialogs_open url: json_ui_garage_url(path: 'forms/basic', mode: 'dialog')
62
+ action.dialogs_open width: 950, url: json_ui_garage_url(path: 'forms/basic', mode: 'dialog')
63
+ end
64
+
65
+ template.thumbnail title: 'dialogs/open (fullscreen on mobile)', onClick: ->(action) do
66
+ action.dialogs_open fullscreen: 'mobile', url: json_ui_garage_url(path: 'forms/basic', mode: 'dialog')
63
67
  end
64
68
 
65
69
  template.thumbnail title: 'dialogs/oauth', onClick: ->(action) do
@@ -13,7 +13,7 @@ action.send "dialogs_#{dialog_mode}", showClose: true, content: ->(dialog) do
13
13
  split.left childViews: ->(left) do
14
14
  left.panels_horizontal height: 'matchParent', align: 'middle', childViews: ->(horizontal) do
15
15
  horizontal.label text: 'Open current', onClick: ->(subaction) do
16
- subaction.dialogs_reload url: json_ui_garage_url(path: 'forms/basic', mode: 'dialog_reload')
16
+ subaction.dialogs_reload width: 900, fullscreen: 'mobile', url: json_ui_garage_url(path: 'forms/basic', mode: 'dialog_reload')
17
17
  end
18
18
  end
19
19
  end
@@ -12,5 +12,17 @@ end
12
12
  page.footer padding: glib_json_padding_body, backgroundColor: '#b3bac2', childViews: ->(footer) do
13
13
  footer.label text: 'This button will submit the form above because this whole page is wrapped in a giant form.'
14
14
  footer.spacer height: 6
15
- footer.fields_submit text: 'Submit'
15
+
16
+ footer.panels_split width: 'matchParent', content: ->(content) do
17
+ content.left childViews: ->(left) do
18
+ left.panels_horizontal height: 'matchParent', align: 'middle', childViews: ->(horizontal) do
19
+ horizontal.label styleClass: 'link', text: 'Open Nested Form', onClick: ->(action) do
20
+ action.dialogs_open url: json_ui_garage_url(path: 'forms/full_page_form_dialog', mode: 'dialog')
21
+ end
22
+ end
23
+ end
24
+ content.right childViews: ->(right) do
25
+ right.fields_submit text: 'Submit'
26
+ end
27
+ end
16
28
  end
@@ -0,0 +1,21 @@
1
+ json.title 'Forms'
2
+
3
+ page = json_ui_page json
4
+
5
+ render "#{@path_prefix}/nav_menu", json: json, page: page
6
+
7
+ page.form url: json_ui_garage_url(path: 'forms/basic_post?id=dialog'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
8
+ form.fields_text name: 'user[name]', width: 'matchParent', label: 'Name'
9
+ form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
10
+ end
11
+
12
+ page.footer padding: glib_json_padding_body, backgroundColor: '#b3bac2', childViews: ->(footer) do
13
+ footer.label text: 'This button will submit the form above because this whole page is wrapped in a giant form.'
14
+ footer.spacer height: 6
15
+
16
+ footer.panels_split width: 'matchParent', content: ->(content) do
17
+ content.right childViews: ->(right) do
18
+ right.fields_submit text: 'Submit'
19
+ end
20
+ end
21
+ end
@@ -36,31 +36,70 @@ page.scroll childViews: ->(scroll) do
36
36
  group.fields_radio value: 'alert_close', label: 'alert+close - useful for non-model form (e.g. contact us)'
37
37
  end
38
38
 
39
- form.spacer height: 14
39
+ form.spacer height: 6
40
40
  form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
41
41
  end
42
42
 
43
+ scroll.spacer height: 14
43
44
  scroll.panels_form \
45
+ width: 'matchParent',
44
46
  url: json_ui_garage_url(path: 'forms/generic_post'),
45
47
  method: 'post',
46
48
  padding: { top: 12, left: 20, right: 20, bottom: 12 },
47
49
  childViews: ->(form) do
48
50
  form.h3 text: 'Perform custom actions on submit'
51
+ form.spacer height: 6
52
+ # See https://stackoverflow.com/questions/4196681/form-not-submitting-when-pressing-enter
53
+ form.label text: 'This also works when you press ENTER in the following text fields'
54
+ form.spacer height: 6
49
55
 
50
- form.fields_text width: 'matchParent', styleClass: 'outlined', name: 'user[text]', value: 'Hello'
51
-
52
- form.spacer height: 14
53
- # form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
56
+ form.fields_text width: 'matchParent', styleClass: 'outlined', name: 'user[first_name]', value: 'Jane'
57
+ form.fields_text width: 'matchParent', styleClass: 'outlined', name: 'user[last_name]', value: 'Doe'
54
58
 
59
+ form.spacer height: 6
55
60
  form.fields_submit text: 'Submit'
56
61
  end,
57
62
  onSubmit: ->(action) do
58
- # action.forms_submit
59
-
60
63
  action.dialogs_alert \
61
64
  message: 'The form will submit after the dialog is closed',
62
65
  onClose: ->(subaction) do
63
66
  subaction.forms_submit
64
67
  end
65
68
  end
69
+
70
+ scroll.spacer height: 14
71
+ scroll.panels_form \
72
+ width: 'matchParent',
73
+ url: json_ui_garage_url(path: 'forms/generic_post'),
74
+ method: 'post',
75
+ padding: { top: 12, left: 20, right: 20, bottom: 12 },
76
+ childViews: ->(form) do
77
+ form.h3 text: 'Submit without using a submit button'
78
+ form.spacer height: 6
79
+ form.label text: 'Note: In general using a submit button is better because it will allow the browser to handle the form functionality in a consistent manner.'
80
+ form.spacer height: 6
81
+ form.label text: 'For example, without a submit button, you cannot submit the form by pressing ENTER in the following text fields'
82
+ form.spacer height: 6
83
+
84
+ form.fields_text width: 'matchParent', styleClass: 'outlined', name: 'user[first_name]', value: 'John'
85
+ form.fields_text width: 'matchParent', styleClass: 'outlined', name: 'user[last_name]', value: 'Doe'
86
+
87
+ form.spacer height: 6
88
+
89
+ form.panels_split width: 'matchParent', content: ->(split) do
90
+ split.left childViews: ->(left) do
91
+ left.panels_horizontal height: 'matchParent', align: 'middle', childViews: ->(horizontal) do
92
+ horizontal.label text: 'Submit using label', onClick: ->(subaction) do
93
+ subaction.forms_submit
94
+ end
95
+ end
96
+ end
97
+
98
+ split.right childViews: ->(right) do
99
+ right.banners_select width: 'matchParent', message: 'Banner Menu', buttons: ->(menu) do
100
+ menu.button text: 'Submit using banner', onClick: ->(action) { action.forms_submit }
101
+ end
102
+ end
103
+ end
104
+ end
66
105
  end
@@ -4,6 +4,22 @@ json.title 'Lists'
4
4
 
5
5
  render "#{@path_prefix}/nav_menu", json: json, page: page
6
6
 
7
+ tab_index = params[:tab].to_i
8
+
9
+ page.header childViews: ->(header) do
10
+ # Allow navigating to another "edit mode" page to test reuse issues.
11
+ header.tabBar buttons: ->(menu) do
12
+ ['FIRST', 'SECOND'].each_with_index do |text, index|
13
+ menu.button \
14
+ text: text,
15
+ disabled: tab_index == index,
16
+ onClick: ->(action) do
17
+ action.windows_reload url: json_ui_garage_url(path: 'lists/edit_mode', tab: index)
18
+ end
19
+ end
20
+ end
21
+ end
22
+
7
23
  page.form \
8
24
  width: 'matchParent',
9
25
  url: json_ui_garage_url(path: 'forms/generic_post'),
@@ -34,7 +50,8 @@ page.form \
34
50
  section.rows builder: ->(row) do
35
51
  batch_count = 20
36
52
  batch_count.times do |index|
37
- row.thumbnail title: "Item #{index}", recordId: "PK_#{index}"
53
+ id = (batch_count * tab_index) + index
54
+ row.thumbnail title: "Item #{id}", recordId: "PK_#{id}"
38
55
  end
39
56
  end
40
57
  end
@@ -19,13 +19,19 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
19
19
  url: glib_json_image_avatar_url,
20
20
  badge: { text: '1', backgroundColor: '#0000ff' }
21
21
 
22
+ base64_data = 'data:image/gif;base64,R0lGODlhPQBEAPeoAJosM//AwO/AwHVYZ/z595kzAP/s7P+goOXMv8+fhw/v739/f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3BCayK44EWdkUQcBByEQChFXfCB776aQsG0BIlQgQgE8qO26X1h8cEUep8ngRBnOy74E9QgRgEAC8SvOfQkh7FDBDmS43PmGoIiKUUEGkMEC/PJHgxw0xH74yx/3XnaYRJgMB8obxQW6kL9QYEJ0FIFgByfIL7/IQAlvQwEpnAC7DtLNJCKUoO/w45c44GwCXiAFB/OXAATQryUxdN4LfFiwgjCNYg+kYMIEFkCKDs6PKAIJouyGWMS1FSKJOMRB/BoIxYJIUXFUxNwoIkEKPAgCBZSQHQ1A2EWDfDEUVLyADj5AChSIQW6gu10bE/JG2VnCZGfo4R4d0sdQoBAHhPjhIB94v/wRoRKQWGRHgrhGSQJxCS+0pCZbEhAAOw=='
23
+
24
+ scroll.h2 text: 'Avatar with base64 data '
25
+ scroll.spacer height: 6
26
+ scroll.avatar \
27
+ base64Data: base64_data
28
+
22
29
  scroll.spacer height: 20
23
30
  scroll.h2 text: 'Image with base64 data'
24
31
  scroll.spacer height: 6
25
32
  scroll.image \
26
- height: 100,
27
33
  tooltip: { text: 'This is a tooltip' },
28
- 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/P8VNQGNugV8AAF9fX8swMNgTAFlDOICAgPNSUnNWSMQ5MBAQEJE3QPIGAM9AQMqGcG9vb6MhJsEdGM8vLx8fH98AANIWAMuQeL8fABkTEPPQ0OM5OSYdGFl5jo+Pj/+pqcsTE78wMFNGQLYmID4dGPvd3UB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bo3onOpajiihlO92KHGaUXGwWjUBChjSPiWJuOO/LYIm4v1tXfE6J4gCSJEZ7YgRYUNrkji9P55sF/ogxw5ZkSqIDaZBV6aSGYq/lGZplndkckZ98xoICbTcIJGQAZcNmdmUc210hs35nCyJ58fgmIKX5RQGOZowxaZwYA+JaoKQwswGijBV4C6SiTUmpphMspJx9unX4KaimjDv9aaXOEBteBqmuuxgEHoLX6Kqx+yXqqBANsgCtit4FWQAEkrNbpq7HSOmtwag5w57GrmlJBASEU18ADjUYb3ADTinIttsgSB1oJFfA63bduimuqKB1keqwUhoCSK374wbujvOSu4QG6UvxBRydcpKsav++Ca6G8A6Pr1x2kVMyHwsVxUALDq/krnrhPSOzXG1lUTIoffqGR7Goi2MAxbv6O2kEG56I7CSlRsEFKFVyovDJoIRTg7sugNRDGqCJzJgcKE0ywc0ELm6KBCCJo8DIPFeCWNGcyqNFE06ToAfV0HBRgxsvLThHn1oddQMrXj5DyAQgjEHSAJMWZwS3HPxT/QMbabI/iBCliMLEJKX2EEkomBAUCxRi42VDADxyTYDVogV+wSChqmKxEKCDAYFDFj4OmwbY7bDGdBhtrnTQYOigeChUmc1K3QTnAUfEgGFgAWt88hKA6aCRIXhxnQ1yg3BCayK44EWdkUQcBByEQChFXfCB776aQsG0BIlQgQgE8qO26X1h8cEUep8ngRBnOy74E9QgRgEAC8SvOfQkh7FDBDmS43PmGoIiKUUEGkMEC/PJHgxw0xH74yx/3XnaYRJgMB8obxQW6kL9QYEJ0FIFgByfIL7/IQAlvQwEpnAC7DtLNJCKUoO/w45c44GwCXiAFB/OXAATQryUxdN4LfFiwgjCNYg+kYMIEFkCKDs6PKAIJouyGWMS1FSKJOMRB/BoIxYJIUXFUxNwoIkEKPAgCBZSQHQ1A2EWDfDEUVLyADj5AChSIQW6gu10bE/JG2VnCZGfo4R4d0sdQoBAHhPjhIB94v/wRoRKQWGRHgrhGSQJxCS+0pCZbEhAAOw=='
34
+ base64Data: base64_data
29
35
 
30
36
  scroll.spacer height: 20
31
37
  scroll.h2 text: 'QR Code as base64 image'
@@ -8,7 +8,7 @@ module Glib
8
8
  json = @http.get(url, action, args.except('url'))
9
9
 
10
10
  unless json.nil?
11
- @http.router.parse_page(json)
11
+ @http.router.begin_page(json)
12
12
 
13
13
  crawl json['header']&.[]('childViews')
14
14
  crawl json['body']&.[]('childViews')
@@ -27,6 +27,8 @@ module Glib
27
27
  if (on_load = (args.fetch('onLoad', nil)))
28
28
  perform(on_load)
29
29
  end
30
+
31
+ @http.router.end_page(json)
30
32
  end
31
33
  end
32
34
  end
@@ -1,17 +1,22 @@
1
+
1
2
  module Glib
2
3
  module JsonCrawler
3
4
  class Router
4
- attr_reader :read_only_actions, :logger, :page_spec
5
+ attr_reader :read_only_actions, :logger
5
6
  attr_accessor :host
6
7
 
7
8
  def log(action, url, response = nil)
8
- @logger +=' ' * @depth + [
9
+ @logger += ' ' * @depth + [
9
10
  action,
10
11
  response.present? ? response.code : nil,
11
12
  url
12
13
  ].compact.join(' :: ') + "\n"
13
14
  end
14
15
 
16
+ def _puts(text)
17
+ puts ' ' * @depth + text
18
+ end
19
+
15
20
  def initialize
16
21
  @depth = -1
17
22
  @logger = ''
@@ -19,7 +24,7 @@ module Glib
19
24
  @read_only_actions = Set.new
20
25
  # default rails's development host
21
26
  @host ||= 'localhost:3000'
22
- @page_spec = nil
27
+ @page_specs = []
23
28
  end
24
29
 
25
30
  def step(http, args)
@@ -94,9 +99,18 @@ module Glib
94
99
  @visitor.traverse_multiple views, block
95
100
  end
96
101
 
97
- def parse_page(spec)
98
- @page_spec = spec
99
- @visitor.parse_page spec
102
+ def begin_page(spec)
103
+ @page_specs << spec
104
+ @visitor.begin_page(spec)
105
+ end
106
+
107
+ def end_page(spec)
108
+ @page_specs.pop
109
+ @visitor.end_page(spec)
110
+ end
111
+
112
+ def page_spec
113
+ @page_specs.last
100
114
  end
101
115
 
102
116
  def allowed?(url)
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.15.0
4
+ version: 0.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -154,6 +154,7 @@ files:
154
154
  - app/views/json_ui/garage/forms/file_upload.json.jbuilder
155
155
  - app/views/json_ui/garage/forms/floating_submit.json.jbuilder
156
156
  - app/views/json_ui/garage/forms/full_page_form.json.jbuilder
157
+ - app/views/json_ui/garage/forms/full_page_form_dialog.json.jbuilder
157
158
  - app/views/json_ui/garage/forms/generic_post.json.jbuilder
158
159
  - app/views/json_ui/garage/forms/index.json.jbuilder
159
160
  - app/views/json_ui/garage/forms/local_request.json.jbuilder