glib-web 0.4.65 → 0.4.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. checksums.yaml +5 -5
  2. data/app/controllers/concerns/glib/auth/policy.rb +0 -0
  3. data/app/controllers/concerns/glib/json/new_dynamic_text.rb +0 -0
  4. data/app/controllers/concerns/glib/json/traversal.rb +0 -0
  5. data/app/controllers/glib/home_controller.rb +0 -0
  6. data/app/helpers/glib/dynamic_images_helper.rb +0 -0
  7. data/app/helpers/glib/dynamic_texts_helper.rb +0 -0
  8. data/app/helpers/glib/forms_helper.rb +0 -0
  9. data/app/helpers/glib/json_ui/abstract_builder.rb +0 -0
  10. data/app/helpers/glib/json_ui/action_builder.rb +0 -0
  11. data/app/helpers/glib/json_ui/action_builder/dialogs.rb +0 -0
  12. data/app/helpers/glib/json_ui/action_builder/sheets.rb +0 -0
  13. data/app/helpers/glib/json_ui/action_builder/snackbars.rb +0 -0
  14. data/app/helpers/glib/json_ui/action_builder/windows.rb +0 -0
  15. data/app/helpers/glib/json_ui/generic_builders.rb +0 -0
  16. data/app/helpers/glib/json_ui/list_builders.rb +0 -0
  17. data/app/helpers/glib/json_ui/menu_builder.rb +0 -0
  18. data/app/helpers/glib/json_ui/page_helper.rb +6 -0
  19. data/app/helpers/glib/json_ui/response_helper.rb +0 -0
  20. data/app/helpers/glib/json_ui/split_builders.rb +0 -0
  21. data/app/helpers/glib/json_ui/styling_helper.rb +0 -0
  22. data/app/helpers/glib/json_ui/table_builders.rb +0 -0
  23. data/app/helpers/glib/json_ui/view_builder.rb +0 -0
  24. data/app/helpers/glib/json_ui/view_builder/banners.rb +0 -0
  25. data/app/helpers/glib/json_ui/view_builder/fields.rb +0 -0
  26. data/app/helpers/glib/json_ui/view_builder/panels.rb +11 -0
  27. data/app/models/glib/active_storage/attachment.rb +0 -0
  28. data/app/models/glib/active_storage/blob.rb +0 -0
  29. data/app/models/glib/dynamic_text_record.rb +0 -0
  30. data/app/models/glib/text.rb +0 -0
  31. data/app/policies/glib/application_policy.rb +0 -0
  32. data/app/validators/email_typo_validator.rb +38 -0
  33. data/app/validators/email_validator.rb +0 -0
  34. data/app/validators/url_validator.rb +0 -0
  35. data/app/views/app/views/json_ui/vue/renderer.html.erb +0 -0
  36. data/app/views/json_ui/garage/_nav_menu.json.jbuilder +0 -0
  37. data/app/views/json_ui/garage/actions/_dialogs.json.jbuilder +0 -0
  38. data/app/views/json_ui/garage/actions/_sheets.json.jbuilder +0 -0
  39. data/app/views/json_ui/garage/actions/_snackbars.json.jbuilder +0 -0
  40. data/app/views/json_ui/garage/actions/_timeouts.json.jbuilder +18 -0
  41. data/app/views/json_ui/garage/actions/_windows.json.jbuilder +0 -0
  42. data/app/views/json_ui/garage/actions/index.json.jbuilder +2 -0
  43. data/app/views/json_ui/garage/forms/_alert_post_data.json.jbuilder +0 -0
  44. data/app/views/json_ui/garage/forms/basic.json.jbuilder +8 -5
  45. data/app/views/json_ui/garage/forms/basic_post.json.jbuilder +0 -0
  46. data/app/views/json_ui/garage/forms/checkboxes.json.jbuilder +0 -0
  47. data/app/views/json_ui/garage/forms/dynamic_group.json.jbuilder +0 -0
  48. data/app/views/json_ui/garage/forms/dynamic_select.json.jbuilder +2 -0
  49. data/app/views/json_ui/garage/forms/dynamic_select_data.json.jbuilder +1 -18
  50. data/app/views/json_ui/garage/forms/file_upload.json.jbuilder +0 -0
  51. data/app/views/json_ui/garage/forms/floating_submit.json.jbuilder +0 -0
  52. data/app/views/json_ui/garage/forms/generic_post.json.jbuilder +0 -0
  53. data/app/views/json_ui/garage/forms/get_request.json.jbuilder +0 -0
  54. data/app/views/json_ui/garage/forms/index.json.jbuilder +0 -0
  55. data/app/views/json_ui/garage/forms/pickers.json.jbuilder +0 -0
  56. data/app/views/json_ui/garage/forms/rich_text.json.jbuilder +0 -0
  57. data/app/views/json_ui/garage/forms/selects.json.jbuilder +0 -0
  58. data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +0 -0
  59. data/app/views/json_ui/garage/forms/styled_boxes.json.jbuilder +9 -0
  60. data/app/views/json_ui/garage/forms/submission_flow.json.jbuilder +0 -0
  61. data/app/views/json_ui/garage/forms/submission_flow_post.json.jbuilder +0 -0
  62. data/app/views/json_ui/garage/forms/submission_indicator.json.jbuilder +54 -10
  63. data/app/views/json_ui/garage/forms/submission_indicator_post.json.jbuilder +21 -1
  64. data/app/views/json_ui/garage/forms/text_validation.json.jbuilder +3 -0
  65. data/app/views/json_ui/garage/home/blank.json.jbuilder +0 -0
  66. data/app/views/json_ui/garage/home/index.json.jbuilder +0 -0
  67. data/app/views/json_ui/garage/home/slow.json.jbuilder +11 -0
  68. data/app/views/json_ui/garage/lists/_infinite_scroll_section.json.jbuilder +0 -0
  69. data/app/views/json_ui/garage/lists/edit_actions.json.jbuilder +0 -0
  70. data/app/views/json_ui/garage/lists/fab.json.jbuilder +0 -0
  71. data/app/views/json_ui/garage/lists/index.json.jbuilder +0 -0
  72. data/app/views/json_ui/garage/lists/infinite_scroll.json.jbuilder +10 -7
  73. data/app/views/json_ui/garage/lists/templating.json.jbuilder +0 -0
  74. data/app/views/json_ui/garage/notifications/index.json.jbuilder +55 -9
  75. data/app/views/json_ui/garage/notifications/web_socket.json.jbuilder +62 -0
  76. data/app/views/json_ui/garage/pages/flat_centered.json.jbuilder +0 -0
  77. data/app/views/json_ui/garage/pages/full_width.json.jbuilder +0 -0
  78. data/app/views/json_ui/garage/pages/full_width_height.json.jbuilder +0 -0
  79. data/app/views/json_ui/garage/pages/index.json.jbuilder +9 -5
  80. data/app/views/json_ui/garage/pages/layout.json.jbuilder +0 -0
  81. data/app/views/json_ui/garage/pages/loading_indicator.json.jbuilder +10 -0
  82. data/app/views/json_ui/garage/pages/nav_buttons.json.jbuilder +0 -0
  83. data/app/views/json_ui/garage/pages/tab_bar.json.jbuilder +0 -0
  84. data/app/views/json_ui/garage/panels/_styled.json.jbuilder +0 -0
  85. data/app/views/json_ui/garage/panels/card.json.jbuilder +0 -0
  86. data/app/views/json_ui/garage/panels/carousel.json.jbuilder +0 -0
  87. data/app/views/json_ui/garage/panels/custom.json.jbuilder +0 -0
  88. data/app/views/json_ui/garage/panels/flow.json.jbuilder +0 -0
  89. data/app/views/json_ui/garage/panels/horizontal.json.jbuilder +0 -0
  90. data/app/views/json_ui/garage/panels/index.json.jbuilder +0 -0
  91. data/app/views/json_ui/garage/panels/outlined.json.jbuilder +0 -0
  92. data/app/views/json_ui/garage/panels/responsive.json.jbuilder +1 -1
  93. data/app/views/json_ui/garage/panels/split.json.jbuilder +0 -0
  94. data/app/views/json_ui/garage/panels/vertical.json.jbuilder +0 -0
  95. data/app/views/json_ui/garage/services/dynamic_text.json.jbuilder +0 -0
  96. data/app/views/json_ui/garage/services/image.json.jbuilder +0 -0
  97. data/app/views/json_ui/garage/services/index.json.jbuilder +10 -11
  98. data/app/views/json_ui/garage/tables/_autoload_section.json.jbuilder +0 -0
  99. data/app/views/json_ui/garage/tables/autoload_all.json.jbuilder +0 -0
  100. data/app/views/json_ui/garage/tables/export_import.json.jbuilder +0 -0
  101. data/app/views/json_ui/garage/tables/horizontal_scroll.json.jbuilder +0 -0
  102. data/app/views/json_ui/garage/tables/index.json.jbuilder +0 -0
  103. data/app/views/json_ui/garage/tables/layout.json.jbuilder +0 -0
  104. data/app/views/json_ui/garage/views/banners.json.jbuilder +0 -0
  105. data/app/views/json_ui/garage/views/calendar_data.json.jbuilder +0 -0
  106. data/app/views/json_ui/garage/views/carousels.json.jbuilder +0 -0
  107. data/app/views/json_ui/garage/views/charts.json.jbuilder +0 -0
  108. data/app/views/json_ui/garage/views/images.json.jbuilder +0 -0
  109. data/app/views/json_ui/garage/views/index.json.jbuilder +0 -0
  110. data/app/views/json_ui/garage/views/links.json.jbuilder +0 -0
  111. data/app/views/json_ui/garage/views/map_data.json.jbuilder +0 -0
  112. data/app/views/json_ui/garage/views/misc.json.jbuilder +0 -0
  113. data/app/views/json_ui/garage/views/texts.json.jbuilder +0 -0
  114. data/config/routes.rb +0 -0
  115. data/lib/generators/glib/install_generator.rb +0 -0
  116. data/lib/generators/templates/20191017062519_create_texts.rb +0 -0
  117. data/lib/generators/templates/20191024063257_add_scope_to_texts.rb +0 -0
  118. data/lib/generators/templates/20191112095018_add_lang_to_texts.rb +0 -0
  119. data/lib/generators/templates/20191126071051_create_active_storage_tables.active_storage.rb +0 -0
  120. data/lib/generators/templates/database.yml +0 -0
  121. data/lib/generators/templates/dynamic_text.rb +0 -0
  122. data/lib/glib-web.rb +1 -0
  123. data/lib/glib/crypt.rb +1 -0
  124. data/lib/glib/crypt/utils.rb +26 -0
  125. data/lib/glib/dynamic_text.rb +1 -1
  126. data/lib/glib/dynamic_text/config.rb +0 -0
  127. data/lib/glib/engine.rb +0 -0
  128. data/lib/glib/json_crawler.rb +0 -0
  129. data/lib/glib/json_crawler/action_crawler.rb +3 -3
  130. data/lib/glib/json_crawler/action_crawlers/action_http.rb +0 -0
  131. data/lib/glib/json_crawler/action_crawlers/forms_submit.rb +20 -6
  132. data/lib/glib/json_crawler/action_crawlers/nav_initiate.rb +0 -0
  133. data/lib/glib/json_crawler/action_crawlers/windows_open.rb +0 -0
  134. data/lib/glib/json_crawler/coverage.rb +0 -0
  135. data/lib/glib/json_crawler/http.rb +0 -0
  136. data/lib/glib/json_crawler/router.rb +21 -9
  137. data/lib/glib/value.rb +0 -0
  138. data/lib/glib/version.rb +0 -0
  139. data/lib/tasks/db.rake +0 -0
  140. metadata +9 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2158feb2985dca0cb028b034fbd8b9d9ba94924b
4
- data.tar.gz: 5319d4abaa9541211a111ed57c1d505e7a50e154
2
+ SHA256:
3
+ metadata.gz: 21a31310ee9b0f143ab08cef06bfde8f49915864bae1585585477180c9de97c9
4
+ data.tar.gz: dc0b4e1737ec4e90f3d13f7345f05315f6885731843dd514b41a2b0b7531432c
5
5
  SHA512:
6
- metadata.gz: 472b176e7a2e6bacb8d3f0e8c562df8e7ac339618f544f4685344d2a2efd04fad2ccdd42735ad134223d447b90fd4dbb89ce4b1dfa31e7780e904149634801ef
7
- data.tar.gz: 921148bf350fa27bbd43a8b13770551af7cf872c3fe49944e7f9e2a4b14a51aa16688c1755b2490f707ee69a9a4140a9e13505717a04af4825a08806cae7daab
6
+ metadata.gz: '071090af5a108ce8129d207e1c8dd280b1a676102f0842df9152e1bf387c0ead4884b914fb1c92a8fd95a63c96fe10be0ccd2e17497800608b58a82a56c3b13e'
7
+ data.tar.gz: 826145993c7b9e492328ed4b8f751654b52874d7bdedbd9d56c6541e2df509c699ba802c5374998d640a2ecf7706902b07ce7171aa7e74b8b9a292202b7a1171
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -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
File without changes
@@ -1,6 +1,8 @@
1
1
  class Glib::JsonUi::ViewBuilder
2
2
  module Panels
3
3
  class Form < View
4
+ action :onSubmit
5
+ string :paramNameForFormData
4
6
  # boolean :local
5
7
 
6
8
  def is_array_association?(prop)
@@ -97,6 +99,8 @@ class Glib::JsonUi::ViewBuilder
97
99
 
98
100
  class List < View
99
101
  hash :nextPage
102
+ action :onScrollToTop
103
+ action :onScrollToBottom
100
104
 
101
105
  def firstSection(block)
102
106
  json.sections [1] do
@@ -149,6 +153,7 @@ class Glib::JsonUi::ViewBuilder
149
153
 
150
154
  class Responsive < View
151
155
  views :childViews
156
+ string :align
152
157
  end
153
158
 
154
159
  class Column < View
@@ -188,6 +193,12 @@ class Glib::JsonUi::ViewBuilder
188
193
  class Custom < View
189
194
  string :template
190
195
  hash :data
196
+
197
+ def content(block)
198
+ json.data do
199
+ block.call page.view_builder
200
+ end
201
+ end
191
202
  end
192
203
 
193
204
  class Ul < View
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,38 @@
1
+ class EmailTypoValidator < ActiveModel::EachValidator
2
+ COMMON_FORMAT = {
3
+ '\.\.' => '.',
4
+ '.con\z' => '.com',
5
+ '.coj\z' => '.com',
6
+ '.vom\z' => '.com',
7
+ '.xom\z' => '.com',
8
+ '.com[a-z]\z' => '.com',
9
+ '.con.' => '.com.',
10
+ '.orf\z' => '.org',
11
+ '.orf.' => '.org.',
12
+ '@hitmail.' => '@hotmail.',
13
+ '@htomail.' => '@hotmail.',
14
+ '@hotnail.' => '@hotmail.',
15
+ '@hotmil.' => '@hotmail.',
16
+ '@hotmal.' => '@hotmail.',
17
+ '@hoymail.' => '@hotmail.',
18
+ '@hormail.' => '@hotmail.',
19
+ '@hotmsil.' => '@hotmail.',
20
+ '@gail.' => '@gmail.',
21
+ '@gnail.' => '@gmail.',
22
+ '@gmil.' => '@gmail.',
23
+ '@gmal.' => '@gmail.',
24
+ '@gmai.' => '@gmail.',
25
+ '@yahho.' => '@yahoo.',
26
+ '@yaho.' => '@yahoo.',
27
+ }
28
+
29
+ def validate_each(record, attribute, value)
30
+ COMMON_FORMAT.keys.each do |format_key|
31
+ regex = Regexp.new(format_key)
32
+ if match = regex.match(value)
33
+ record.errors.add(attribute, "Invalid, replace #{match[0]} with #{COMMON_FORMAT[format_key]}")
34
+ break
35
+ end
36
+ end
37
+ end
38
+ end
File without changes
File without changes
@@ -0,0 +1,18 @@
1
+
2
+ section.header padding: glib_json_padding_list, childViews: ->(header) do
3
+ header.h3 text: 'Timeouts'
4
+ end
5
+
6
+ section.rows builder: ->(template) do
7
+ template.thumbnail title: 'timeouts/set', onClick: ->(action) do
8
+ action.timeouts_set interval: 1000, onTimeout: ->(subaction) do
9
+ subaction.snackbars_alert message: 'Timeout elapsed'
10
+ end
11
+ end
12
+ end
13
+
14
+ # section.rows builder: ->(template) do
15
+ # template.thumbnail title: 'timeouts/clear', onClick: ->(action) do
16
+ # action.windows_open url: json_ui_garage_url(path: 'home/blank')
17
+ # end
18
+ # end
@@ -12,6 +12,8 @@ json_ui_page json do |page|
12
12
  render "#{@path_prefix}/actions/sheets", section: section
13
13
  end, ->(section) do
14
14
  render "#{@path_prefix}/actions/windows", section: section
15
+ end, ->(section) do
16
+ render "#{@path_prefix}/actions/timeouts", section: section
15
17
  end, ->(section) do
16
18
  section.header padding: glib_json_padding_list, childViews: ->(header) do
17
19
  header.h3 text: 'Reload'
@@ -2,11 +2,11 @@ json.title 'Forms'
2
2
 
3
3
  json_ui_page json do |page|
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
-
5
+
6
6
  page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
7
7
  form.fields_text name: 'user[name]', width: 'matchParent', label: 'Name'
8
8
  form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
9
-
9
+
10
10
  # form.panels_split width: 'matchParent', leftViews: ->(split) do
11
11
  # if params[:mode] == 'dialog'
12
12
  # split.button styleClass: 'link', text: 'cancel', onClick: ->(action) { action.dialogs_close }
@@ -14,7 +14,7 @@ json_ui_page json do |page|
14
14
  # end, rightViews: ->(split) do
15
15
  # split.button text: 'Submit', onClick: ->(action) { action.forms_submit }
16
16
  # end
17
-
17
+
18
18
  form.panels_split width: 'matchParent', content: ->(split) do
19
19
  split.left childViews: ->(left) do
20
20
  if params[:mode] == 'dialog'
@@ -25,7 +25,10 @@ json_ui_page json do |page|
25
25
  right.button text: 'Submit', onClick: ->(action) { action.forms_submit }
26
26
  end
27
27
  end
28
-
28
+
29
29
  end
30
-
30
+ # , paramNameForFormData: 'formData', onSubmit: ->(action) do
31
+ # action.http_post url: json_ui_garage_url(path: 'forms/generic_post')
32
+ # end
33
+
31
34
  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
@@ -5,8 +5,17 @@ json_ui_page json do |page|
5
5
 
6
6
  page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
7
7
  form.fields_text name: 'user[name]', width: 'matchParent', label: 'Search', styleClasses: ['outlined', 'rounded']
8
+
9
+ form.spacer height: 14
8
10
  form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password', placeholder: 'Type your password', styleClass: 'outlined'
9
11
 
12
+ form.spacer height: 14
13
+ form.fields_stripeToken name: 'user[stripe_token_outlined]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'outlined'
14
+
15
+ form.spacer height: 14
16
+ form.fields_stripeToken name: 'user[stripe_token_individual]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'individual'
17
+
18
+ form.spacer height: 14
10
19
  form.panels_split width: 'matchParent', content: ->(split) do
11
20
  # split.left childViews: ->(left) do
12
21
  # if params[:mode] == 'dialog'
@@ -1,19 +1,63 @@
1
1
  json.title 'Forms'
2
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_indicator_post'), method: 'post', padding: { top: 12, left: 20, right: 20, bottom: 12 }, childViews: ->(form) do
3
+ page = json_ui_page json
4
+ render "#{@path_prefix}/nav_menu", json: json, page: page
5
+
6
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
7
+ scroll.panels_form width: 'matchParent', styleClasses: ['card', 'outlined'], padding: glib_json_padding_body, url: json_ui_garage_url(path: 'forms/submission_indicator_post'), method: 'post', childViews: ->(form) do
7
8
  form.label text: 'These buttons get disabled on submit'
8
- form.spacer height: 10
9
+ form.spacer height: 14
9
10
  form.button text: 'Normal Button', onClick: ->(action) { action.forms_submit }
10
- form.spacer height: 10
11
+ form.spacer height: 14
11
12
  form.fields_submit text: 'Submit Button'
12
13
 
13
- # This needs to be long enough that the FAB is roughly at the bottom of a mobile screen.
14
- # Ideally the spacer can expand dynamically depending on available space.
15
- form.spacer height: 400
16
-
17
14
  form.fab icon: 'send', onClick: ->(action) { action.forms_submit }
18
15
  end
16
+
17
+ scroll.spacer height: 14
18
+
19
+ scroll.panels_form width: 'matchParent', styleClasses: ['card', 'outlined'], padding: glib_json_padding_body, url: json_ui_garage_url(path: 'forms/submission_indicator_post', mode: 'slow_open'), method: 'post', childViews: ->(form) do
20
+ form.fields_submit text: 'Submit button with slow window/open'
21
+ end
22
+
23
+ scroll.spacer height: 14
24
+
25
+ scroll.panels_form width: 'matchParent', styleClasses: ['card', 'outlined'], padding: glib_json_padding_body, url: json_ui_garage_url(path: 'forms/submission_indicator_post', mode: 'slow_openWeb'), method: 'post', childViews: ->(form) do
26
+ form.fields_submit text: 'Submit button with slow window/openWeb'
27
+ end
28
+
29
+ scroll.spacer height: 14
30
+
31
+ scroll.panels_form width: 'matchParent', styleClasses: ['card', 'outlined'], padding: glib_json_padding_body, url: json_ui_garage_url(path: 'forms/submission_indicator_post', mode: 'timeout_once'), method: 'post', childViews: ->(form) do
32
+ form.fields_submit text: 'Submit Button with timeouts/set once'
33
+ end
34
+
35
+ scroll.spacer height: 14
36
+
37
+ scroll.panels_form width: 'matchParent', styleClasses: ['card', 'outlined'], padding: glib_json_padding_body, url: json_ui_garage_url(path: 'forms/submission_indicator_post', mode: 'timeout_chain', count: 0), method: 'post', childViews: ->(form) do
38
+ form.fields_submit text: 'Submit Button with timeouts/set chain'
39
+ end
40
+
41
+ # This needs to be long enough that the FAB is roughly at the bottom of a mobile screen.
42
+ # Ideally the spacer can expand dynamically depending on available space.
43
+ scroll.spacer height: 400
44
+
19
45
  end
46
+
47
+ # page.form url: json_ui_garage_url(path: 'forms/submission_indicator_post'), method: 'post', padding: { top: 12, left: 20, right: 20, bottom: 12 }, childViews: ->(form) do
48
+ # form.label text: 'These buttons get disabled on submit'
49
+ # form.spacer height: 10
50
+ # form.button text: 'Normal Button', onClick: ->(action) { action.forms_submit }
51
+ # form.spacer height: 10
52
+ # form.fields_submit text: 'Submit Button'
53
+
54
+ # # This needs to be long enough that the FAB is roughly at the bottom of a mobile screen.
55
+ # # Ideally the spacer can expand dynamically depending on available space.
56
+ # form.spacer height: 400
57
+
58
+ # form.fab icon: 'send', onClick: ->(action) { action.forms_submit }
59
+ # end
60
+
61
+ # page.form url: json_ui_garage_url(path: 'forms/submission_indicator_post', timeout: true), method: 'post', padding: { top: 12, left: 20, right: 20, bottom: 12 }, childViews: ->(form) do
62
+ # form.fields_submit text: 'Submit Button with Timeout'
63
+ # end
@@ -1,5 +1,25 @@
1
1
  sleep 0.5
2
2
 
3
3
  json_ui_response json do |action|
4
- action.dialogs_alert message: 'Success!'
4
+ case params[:mode]
5
+ when 'timeout_once'
6
+ action.timeouts_set interval: 2000, onTimeout: ->(subaction) do
7
+ subaction.dialogs_alert message: 'Success!'
8
+ end
9
+ when 'timeout_chain'
10
+ count = params[:count].to_i
11
+ if count > 3
12
+ action.dialogs_alert message: 'Success!'
13
+ else
14
+ action.timeouts_set interval: 500, onTimeout: ->(subaction) do
15
+ subaction.http_post url: json_ui_garage_url(path: 'forms/submission_indicator_post', mode: 'timeout_chain', count: count + 1)
16
+ end
17
+ end
18
+ when 'slow_open'
19
+ action.windows_open url: json_ui_garage_url(path: 'home/slow')
20
+ when 'slow_openWeb'
21
+ action.windows_openWeb url: 'https://www.google.com'
22
+ else
23
+ action.dialogs_alert message: 'Success!'
24
+ end
5
25
  end
@@ -10,6 +10,9 @@ json_ui_page json do |page|
10
10
  form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
11
11
  form.fields_textarea name: 'user[textarea]', width: 'matchParent', label: 'Textarea with maxLength', maxLength: 50, validation: { required: { message: 'Required' } }
12
12
 
13
+ options = ['male', 'female'].map { |i| { text: i.humanize, value: i } }
14
+ form.fields_select name: 'user[gender]', width: 'matchParent', label: 'Gender', validation: { required: { message: 'Required' } }, options: options
15
+
13
16
  form.spacer height: 20
14
17
  form.fields_stripeToken name: 'user[stripe_token]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx'
15
18