glib-web 0.5.3 → 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) 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/concerns/glib/json/ui.rb +7 -0
  6. data/app/controllers/glib/home_controller.rb +1 -1
  7. data/app/helpers/glib/app_feature_support_helper.rb +16 -0
  8. data/app/helpers/glib/dynamic_images_helper.rb +0 -0
  9. data/app/helpers/glib/dynamic_texts_helper.rb +0 -0
  10. data/app/helpers/glib/forms_helper.rb +0 -0
  11. data/app/helpers/glib/json_ui/abstract_builder.rb +9 -3
  12. data/app/helpers/glib/json_ui/action_builder.rb +36 -6
  13. data/app/helpers/glib/json_ui/action_builder/dialogs.rb +0 -0
  14. data/app/helpers/glib/json_ui/action_builder/http.rb +0 -0
  15. data/app/helpers/glib/json_ui/action_builder/sheets.rb +0 -0
  16. data/app/helpers/glib/json_ui/action_builder/snackbars.rb +0 -0
  17. data/app/helpers/glib/json_ui/action_builder/windows.rb +1 -0
  18. data/app/helpers/glib/json_ui/generic_builders.rb +0 -0
  19. data/app/helpers/glib/json_ui/list_builders.rb +0 -0
  20. data/app/helpers/glib/json_ui/menu_builder.rb +0 -0
  21. data/app/helpers/glib/json_ui/page_helper.rb +13 -5
  22. data/app/helpers/glib/json_ui/response_helper.rb +1 -1
  23. data/app/helpers/glib/json_ui/split_builders.rb +0 -0
  24. data/app/helpers/glib/json_ui/styling_helper.rb +22 -0
  25. data/app/helpers/glib/json_ui/table_builders.rb +0 -0
  26. data/app/helpers/glib/json_ui/view_builder.rb +16 -16
  27. data/app/helpers/glib/json_ui/view_builder/banners.rb +0 -0
  28. data/app/helpers/glib/json_ui/view_builder/fields.rb +9 -1
  29. data/app/helpers/glib/json_ui/view_builder/panels.rb +2 -0
  30. data/app/helpers/glib/urls_helper.rb +7 -0
  31. data/app/models/glib/active_storage/attachment.rb +0 -0
  32. data/app/models/glib/active_storage/blob.rb +0 -0
  33. data/app/models/glib/dynamic_text_record.rb +0 -0
  34. data/app/models/glib/text.rb +0 -0
  35. data/app/policies/glib/application_policy.rb +27 -30
  36. data/app/validators/email_typo_validator.rb +0 -0
  37. data/app/validators/email_validator.rb +0 -0
  38. data/app/validators/url_validator.rb +0 -0
  39. data/app/views/app/views/json_ui/vue/renderer.html.erb +0 -0
  40. data/app/views/json_ui/garage/_nav_menu.json.jbuilder +0 -0
  41. data/app/views/json_ui/garage/actions/_dialogs.json.jbuilder +20 -14
  42. data/app/views/json_ui/garage/actions/_http.json.jbuilder +0 -0
  43. data/app/views/json_ui/garage/actions/_reload.json.jbuilder +0 -0
  44. data/app/views/json_ui/garage/actions/_sheets.json.jbuilder +0 -0
  45. data/app/views/json_ui/garage/actions/_snackbars.json.jbuilder +0 -0
  46. data/app/views/json_ui/garage/actions/_timeouts.json.jbuilder +0 -0
  47. data/app/views/json_ui/garage/actions/_windows.json.jbuilder +0 -0
  48. data/app/views/json_ui/garage/actions/dialogs_oauth_post.json.jbuilder +0 -0
  49. data/app/views/json_ui/garage/actions/index.json.jbuilder +2 -2
  50. data/app/views/json_ui/garage/forms/_alert_post_data.json.jbuilder +0 -0
  51. data/app/views/json_ui/garage/forms/basic.json.jbuilder +0 -0
  52. data/app/views/json_ui/garage/forms/basic_post.json.jbuilder +0 -0
  53. data/app/views/json_ui/garage/forms/checkboxes.json.jbuilder +0 -0
  54. data/app/views/json_ui/garage/forms/dynamic_group.json.jbuilder +9 -18
  55. data/app/views/json_ui/garage/forms/dynamic_select.json.jbuilder +0 -0
  56. data/app/views/json_ui/garage/forms/dynamic_select_data.json.jbuilder +0 -0
  57. data/app/views/json_ui/garage/forms/file_upload.json.jbuilder +0 -0
  58. data/app/views/json_ui/garage/forms/floating_submit.json.jbuilder +0 -0
  59. data/app/views/json_ui/garage/forms/generic_post.json.jbuilder +0 -0
  60. data/app/views/json_ui/garage/forms/get_request.json.jbuilder +0 -0
  61. data/app/views/json_ui/garage/forms/index.json.jbuilder +0 -0
  62. data/app/views/json_ui/garage/forms/pickers.json.jbuilder +6 -3
  63. data/app/views/json_ui/garage/forms/rich_text.json.jbuilder +0 -0
  64. data/app/views/json_ui/garage/forms/selects.json.jbuilder +0 -0
  65. data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +20 -3
  66. data/app/views/json_ui/garage/forms/styled_boxes.json.jbuilder +4 -1
  67. data/app/views/json_ui/garage/forms/submission_flow.json.jbuilder +0 -0
  68. data/app/views/json_ui/garage/forms/submission_flow_post.json.jbuilder +0 -0
  69. data/app/views/json_ui/garage/forms/submission_indicator.json.jbuilder +0 -0
  70. data/app/views/json_ui/garage/forms/submission_indicator_post.json.jbuilder +0 -0
  71. data/app/views/json_ui/garage/forms/text_validation.json.jbuilder +1 -1
  72. data/app/views/json_ui/garage/home/blank.json.jbuilder +0 -0
  73. data/app/views/json_ui/garage/home/index.json.jbuilder +0 -0
  74. data/app/views/json_ui/garage/home/slow.json.jbuilder +0 -0
  75. data/app/views/json_ui/garage/lists/_infinite_scroll_section.json.jbuilder +15 -5
  76. data/app/views/json_ui/garage/lists/edit_actions.json.jbuilder +0 -0
  77. data/app/views/json_ui/garage/lists/fab.json.jbuilder +0 -0
  78. data/app/views/json_ui/garage/lists/index.json.jbuilder +0 -0
  79. data/app/views/json_ui/garage/lists/infinite_scroll.json.jbuilder +0 -0
  80. data/app/views/json_ui/garage/lists/templating.json.jbuilder +0 -0
  81. data/app/views/json_ui/garage/notifications/index.json.jbuilder +0 -43
  82. data/app/views/json_ui/garage/notifications/web_socket.json.jbuilder +19 -21
  83. data/app/views/json_ui/garage/pages/flat_centered.json.jbuilder +0 -0
  84. data/app/views/json_ui/garage/pages/full_width.json.jbuilder +0 -0
  85. data/app/views/json_ui/garage/pages/full_width_height.json.jbuilder +0 -0
  86. data/app/views/json_ui/garage/pages/index.json.jbuilder +11 -0
  87. data/app/views/json_ui/garage/pages/layout.json.jbuilder +12 -13
  88. data/app/views/json_ui/garage/pages/loading_indicator.json.jbuilder +0 -0
  89. data/app/views/json_ui/garage/pages/nav_buttons.json.jbuilder +28 -16
  90. data/app/views/json_ui/garage/pages/nested_scroll.json.jbuilder +40 -0
  91. data/app/views/json_ui/garage/pages/tab_bar.json.jbuilder +0 -0
  92. data/app/views/json_ui/garage/panels/_styled.json.jbuilder +0 -0
  93. data/app/views/json_ui/garage/panels/card.json.jbuilder +0 -0
  94. data/app/views/json_ui/garage/panels/carousel.json.jbuilder +24 -3
  95. data/app/views/json_ui/garage/panels/custom.json.jbuilder +0 -0
  96. data/app/views/json_ui/garage/panels/flow.json.jbuilder +0 -0
  97. data/app/views/json_ui/garage/panels/horizontal.json.jbuilder +0 -0
  98. data/app/views/json_ui/garage/panels/index.json.jbuilder +0 -0
  99. data/app/views/json_ui/garage/panels/outlined.json.jbuilder +0 -0
  100. data/app/views/json_ui/garage/panels/responsive.json.jbuilder +0 -0
  101. data/app/views/json_ui/garage/panels/split.json.jbuilder +0 -0
  102. data/app/views/json_ui/garage/panels/vertical.json.jbuilder +0 -0
  103. data/app/views/json_ui/garage/services/dynamic_text.json.jbuilder +0 -0
  104. data/app/views/json_ui/garage/services/image.json.jbuilder +0 -0
  105. data/app/views/json_ui/garage/services/index.json.jbuilder +0 -0
  106. data/app/views/json_ui/garage/tables/_autoload_section.json.jbuilder +0 -0
  107. data/app/views/json_ui/garage/tables/autoload_all.json.jbuilder +0 -0
  108. data/app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder +39 -0
  109. data/app/views/json_ui/garage/tables/export_import.json.jbuilder +0 -0
  110. data/app/views/json_ui/garage/tables/horizontal_scroll.json.jbuilder +0 -0
  111. data/app/views/json_ui/garage/tables/index.json.jbuilder +3 -0
  112. data/app/views/json_ui/garage/tables/layout.json.jbuilder +0 -0
  113. data/app/views/json_ui/garage/views/_chart_data.json.jbuilder +1 -1
  114. data/app/views/json_ui/garage/views/banners.json.jbuilder +0 -0
  115. data/app/views/json_ui/garage/views/calendar_data.json.jbuilder +23 -27
  116. data/app/views/json_ui/garage/views/charts.json.jbuilder +0 -0
  117. data/app/views/json_ui/garage/views/icons.json.jbuilder +22 -0
  118. data/app/views/json_ui/garage/views/images.json.jbuilder +4 -4
  119. data/app/views/json_ui/garage/views/index.json.jbuilder +3 -3
  120. data/app/views/json_ui/garage/views/links.json.jbuilder +0 -0
  121. data/app/views/json_ui/garage/views/map_data.json.jbuilder +0 -0
  122. data/app/views/json_ui/garage/views/misc.json.jbuilder +0 -0
  123. data/app/views/json_ui/garage/views/texts.json.jbuilder +0 -0
  124. data/config/routes.rb +0 -0
  125. data/lib/generators/glib/install_generator.rb +0 -0
  126. data/lib/generators/templates/20191017062519_create_texts.rb +0 -0
  127. data/lib/generators/templates/20191024063257_add_scope_to_texts.rb +0 -0
  128. data/lib/generators/templates/20191112095018_add_lang_to_texts.rb +0 -0
  129. data/lib/generators/templates/20191126071051_create_active_storage_tables.active_storage.rb +0 -0
  130. data/lib/generators/templates/database.yml +0 -0
  131. data/lib/generators/templates/dynamic_text.rb +0 -0
  132. data/lib/glib-web.rb +0 -0
  133. data/lib/glib/crypt.rb +1 -1
  134. data/lib/glib/crypt/utils.rb +0 -0
  135. data/lib/glib/dynamic_text.rb +1 -1
  136. data/lib/glib/dynamic_text/config.rb +0 -0
  137. data/lib/glib/engine.rb +0 -0
  138. data/lib/glib/json_crawler.rb +1 -0
  139. data/lib/glib/json_crawler/action_crawler.rb +0 -0
  140. data/lib/glib/json_crawler/action_crawlers/action_http.rb +0 -0
  141. data/lib/glib/json_crawler/action_crawlers/forms_submit.rb +1 -1
  142. data/lib/glib/json_crawler/action_crawlers/menu.rb +12 -0
  143. data/lib/glib/json_crawler/action_crawlers/nav_initiate.rb +1 -1
  144. data/lib/glib/json_crawler/action_crawlers/windows_open.rb +0 -0
  145. data/lib/glib/json_crawler/coverage.rb +0 -0
  146. data/lib/glib/json_crawler/http.rb +7 -4
  147. data/lib/glib/json_crawler/router.rb +2 -1
  148. data/lib/glib/test_helpers.rb +4 -4
  149. data/lib/glib/value.rb +0 -0
  150. data/lib/glib/version.rb +0 -0
  151. data/lib/tasks/db.rake +0 -0
  152. metadata +8 -3
  153. data/app/views/json_ui/garage/views/carousels.json.jbuilder +0 -37
File without changes
File without changes
File without changes
@@ -79,20 +79,26 @@ section.rows builder: ->(template) do
79
79
  end
80
80
 
81
81
  template.thumbnail title: 'dialogs/oauth', onClick: ->(action) do
82
- provider = {
83
- name: "facebook",
84
- webRequestUrl: user_facebook_omniauth_authorize_url(format: nil, _render: nil),
85
- requestUrl: user_facebook_omniauth_authorize_url(format: nil),
86
- clientId: Devise.omniauth_configs[:facebook].strategy[:client_id],
87
- permissions: Devise.omniauth_configs[:facebook].strategy[:scope],
88
- redirectUrl: user_facebook_omniauth_callback_url(format: nil)
89
- }
90
-
91
- action.dialogs_oauth provider: provider, providerParamName: "session[oauth_provider]", callbackUrlParamName: "session[[oauth_callback_url]", onSuccess: ->(action) do
92
- action.http_post url: json_ui_garage_url(path: 'actions/dialogs_oauth_post'), formData: {
93
- authenticity_token: form_authenticity_token
82
+ if respond_to?(:user_facebook_omniauth_authorize_url)
83
+ provider = {
84
+ name: 'facebook',
85
+ webRequestUrl: user_facebook_omniauth_authorize_url(format: nil, _render: nil),
86
+ requestUrl: user_facebook_omniauth_authorize_url(format: nil),
87
+ clientId: Devise.omniauth_configs[:facebook].strategy[:client_id],
88
+ permissions: Devise.omniauth_configs[:facebook].strategy[:scope],
89
+ redirectUrl: user_facebook_omniauth_callback_url(format: nil)
94
90
  }
91
+ action.dialogs_oauth provider: provider, providerParamName: 'session[oauth_provider]', callbackUrlParamName: 'session[[oauth_callback_url]', onSuccess: ->(subaction) do
92
+ subaction.http_post url: json_ui_garage_url(path: 'actions/dialogs_oauth_post'), formData: {
93
+ authenticity_token: form_authenticity_token
94
+ }
95
+ end
96
+ else
97
+ action.dialogs_alert message: 'To enable this, set up omniauth using devise'
98
+ # E.g.
99
+ # Add `devise :omniauthable, omniauth_providers: %i[facebook]` to user.rb
100
+ # Add `gem 'omniauth-facebook'` to Gemfile
101
+ # Add `config.omniauth :facebook` to devise.rb
95
102
  end
96
103
  end
97
-
98
- end
104
+ end
@@ -5,6 +5,8 @@ json_ui_page json do |page|
5
5
 
6
6
  page.list sections: [
7
7
  ->(section) do
8
+ render "#{@path_prefix}/actions/reload", section: section
9
+ end, ->(section) do
8
10
  render "#{@path_prefix}/actions/dialogs", section: section
9
11
  end, ->(section) do
10
12
  render "#{@path_prefix}/actions/snackbars", section: section
@@ -16,8 +18,6 @@ json_ui_page json do |page|
16
18
  render "#{@path_prefix}/actions/timeouts", section: section
17
19
  end, ->(section) do
18
20
  render "#{@path_prefix}/actions/http", section: section
19
- end, ->(section) do
20
- render "#{@path_prefix}/actions/reload", section: section
21
21
  end
22
22
  ]
23
23
  end
@@ -10,7 +10,8 @@ json_ui_page json do |page|
10
10
  value = [
11
11
  {
12
12
  'question': 'Punctuality',
13
- 'type': 'rating'
13
+ 'type': 'rating',
14
+ 'enabled': '1'
14
15
  },
15
16
  {
16
17
  'question': 'Quality of work',
@@ -21,30 +22,20 @@ json_ui_page json do |page|
21
22
  'type': 'yes_no'
22
23
  }
23
24
  ]
24
- # form.fields_dynamicGroup width: 'matchParent', name: 'user[evaluation]', value: value, groupTitlePrefix: 'Entry', groupTemplateViews: ->(group) do
25
- # group.spacer height: 10
26
- # group.fields_text width: 'matchParent', name: 'question', label: 'Question'
27
- # group.fields_text width: 'matchParent', name: 'type', label: 'Answer type'
28
- # end
29
-
30
- # form.fields_dynamicGroup width: 'matchParent', name: 'user[evaluation]', value: value, group: ->(group) do
31
- # group.titlePrefix 'Entry'
32
- # group.template childViews: ->(template) do
33
- # template.spacer height: 10
34
- # template.fields_text width: 'matchParent', name: 'question', label: 'Question'
35
- # template.fields_text width: 'matchParent', name: 'type', label: 'Answer type'
36
- # end
37
- # end
38
25
 
39
26
  form.fields_dynamicGroup width: 'matchParent', name: 'user[evaluation]', value: value, titlePrefix: 'Entry', content: ->(group) do
40
27
  group.template padding: { left: 32 }, childViews: ->(template) do
41
28
  template.spacer height: 10
42
- template.fields_text width: 'matchParent', name: 'question', label: 'Question'
43
- template.fields_text width: 'matchParent', name: 'type', label: 'Answer type'
29
+ template.fields_text width: 'matchParent', name: 'question', label: 'Question', placeholder: 'Question'
30
+ options = [ :rating, :yes_no ]
31
+ template.fields_select width: 'matchParent', name: 'type', label: 'Answer Type', placeholder: 'Answer Type', options: options.map { |o| { text: o.to_s.humanize, value: o } }
32
+ template.fields_check width: 'matchParent', name: 'enabled', label: 'Enable', checkValue: '1'
33
+
34
+ template.spacer height: 14
44
35
  end
45
36
  end
46
37
 
47
38
  form.spacer height: 20
48
- form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
39
+ form.fields_submit text: 'Submit'
49
40
  end
50
41
  end
@@ -8,14 +8,16 @@ json_ui_page json do |page|
8
8
  form.spacer height: 6
9
9
  form.h4 text: 'Gender'
10
10
  form.fields_radioGroup name: 'user[gender]', value: 'F', childViews: ->(group) do
11
+ group.fields_radio value: '', label: 'Unknown'
11
12
  group.fields_radio value: 'M', label: 'Male'
12
13
  group.fields_radio value: 'F', label: 'Female'
13
14
  end
14
15
 
15
16
  form.spacer height: 20
16
17
  form.h2 text: 'Single Checkbox'
17
- form.fields_check name: 'user[age_range]', value: '16+', uncheckValue: '0-16', label: 'I am over 16 (has default value)'
18
- form.fields_check name: 'user[employer]', value: 1, label: 'I am an employer (no default value)'
18
+ form.fields_check name: 'user[age_range]', value: '16+', checkValue: '16+', uncheckValue: '0-16', label: 'I am over 16 (has default value)'
19
+ form.fields_check name: 'user[employer]', checkValue: 1, label: 'I am an employer (no default value)'
20
+ form.fields_check name: 'user[enabled]', checkValue: true, label: 'Enable', styleClass: 'switch', value: 'true'
19
21
 
20
22
  form.spacer height: 20
21
23
  form.h2 text: 'Date/Time'
@@ -36,7 +38,8 @@ json_ui_page json do |page|
36
38
  latitudeField: { name: 'user[latitude]', label: 'Lat', value: -33.8523063, readOnly: true },
37
39
  longitudeField: { name: 'user[longitude]', label: 'Long', value: 151.21078710000006, readOnly: true }
38
40
 
39
- form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
41
+ form.spacer height: 20
42
+ form.fields_submit text: 'Submit'
40
43
 
41
44
  end
42
45
 
@@ -3,7 +3,7 @@ json.title 'Forms'
3
3
  page = json_ui_page json
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
5
 
6
- page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
6
+ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
7
7
  form.h1 text: 'Text'
8
8
  form.fields_password name: 'user[text1]', width: 'matchParent', label: 'Type "show"'
9
9
  form.label text: 'Typed', showIf: {
@@ -29,7 +29,7 @@ page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', pad
29
29
 
30
30
  form.spacer height: 20
31
31
  form.h1 text: 'Check'
32
- form.fields_check name: 'user[check1]', value: 'on', label: 'Show text'
32
+ form.fields_check name: 'user[check1]', checkValue: 'on', label: 'Show text'
33
33
  form.spacer height: 10
34
34
  form.label text: 'Checked', showIf: {
35
35
  "==": [
@@ -70,7 +70,7 @@ page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', pad
70
70
  }
71
71
 
72
72
  form.spacer height: 20
73
- form.h1 text: 'Combo1'
73
+ form.h1 text: 'Combined conditions'
74
74
  form.label text: 'Select the same option on both the radio and select fields above'
75
75
  form.spacer height: 10
76
76
  form.h3 text: 'Same!', showIf: {
@@ -84,5 +84,22 @@ page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', pad
84
84
  ]
85
85
  }
86
86
 
87
+ form.spacer height: 20
88
+ form.h1 text: 'Show/hide another field'
89
+ form.label text: ''
90
+ form.spacer height: 10
91
+ form.fields_check name: 'user[check2]', checkValue: 'on', label: 'Show field'
92
+ form.spacer height: 10
93
+ form.fields_text width: 'matchParent', label: 'Comment (optional)', name: 'user[comment]', value: 'This field can be submitted when it is hidden, but it is not necessary (i.e. up to the app)', showIf: {
94
+ "==": [
95
+ {
96
+ "var": 'user[check2]'
97
+ },
98
+ 'on'
99
+ ]
100
+ }
101
+
102
+ form.spacer height: 20
103
+ form.fields_submit text: 'Submit'
87
104
  form.spacer height: 40
88
105
  end
@@ -4,11 +4,14 @@ 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
- form.fields_text name: 'user[name]', width: 'matchParent', label: 'Search', styleClasses: ['outlined', 'rounded']
7
+ form.fields_text name: 'user[name]', width: 'matchParent', label: 'Search', placeholder: 'Enter a keyword', styleClasses: ['outlined', 'rounded']
8
8
 
9
9
  form.spacer height: 14
10
10
  form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password', placeholder: 'Type your password', styleClass: 'outlined'
11
11
 
12
+ form.spacer height: 14
13
+ form.fields_textarea name: 'user[bio]', width: 'matchParent', label: 'Bio', placeholder: 'Enter your bio', styleClasses: ['outlined']
14
+
12
15
  form.spacer height: 14
13
16
  form.fields_stripeToken name: 'user[stripe_token_outlined]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'outlined'
14
17
 
@@ -7,7 +7,7 @@ json_ui_page json do |page|
7
7
  form.fields_email name: 'user[email]', width: 'matchParent', label: 'Email'
8
8
  form.fields_url name: 'user[url]', width: 'matchParent', label: 'URL'
9
9
  form.fields_number name: 'user[number]', width: 'matchParent', label: 'Number', validation: { required: { message: 'Required' } }
10
- form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
10
+ form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password', hint: 'Should contain at least 6 characters'
11
11
  form.fields_textarea name: 'user[textarea]', width: 'matchParent', label: 'Textarea with maxLength', maxLength: 50, validation: { required: { message: 'Required' } }
12
12
 
13
13
  options = ['male', 'female'].map { |i| { text: i.humanize, value: i } }
@@ -1,10 +1,20 @@
1
- json.rows do
1
+
2
+ # json.rows do
3
+ # batch_count = 30
4
+ # batch_count.times do |i|
5
+ # index = page * batch_count + i
6
+ # json.child! do
7
+ # json.template 'thumbnail'
8
+ # json.title "Item #{index}"
9
+ # end
10
+ # end
11
+ # end
12
+
13
+ section = json_ui_section json
14
+ section.rows builder: ->(row) do
2
15
  batch_count = 30
3
16
  batch_count.times do |i|
4
17
  index = page * batch_count + i
5
- json.child! do
6
- json.template 'thumbnail'
7
- json.title "Item #{index}"
8
- end
18
+ row.thumbnail title: "Item #{index}"
9
19
  end
10
20
  end
@@ -1,23 +1,5 @@
1
1
  json.title 'Notifications'
2
2
 
3
- # json.ws({
4
- # "socket" => {
5
- # "endpoint" => "/socket/websocket",
6
- # "params" => {
7
- # "vsn": "2.0.0"
8
- # }
9
- # },
10
- # # "topic" => "room:30",
11
- # # "event" => "comments_updated",
12
- # "topic" => "links",
13
- # "event" => "new_link_added",
14
- # "header" => {
15
- # "user_id" => 2,
16
- # "prev_item_id" => nil,
17
- # "last_item_id" => nil
18
- # }
19
- # })
20
-
21
3
  page = json_ui_page json
22
4
  render "#{@path_prefix}/nav_menu", json: json, page: page, top_nav: true
23
5
 
@@ -31,31 +13,6 @@ page.list firstSection: ->(section) do
31
13
 
32
14
  template.thumbnail title: 'WebSocket Real-time Update', onClick: ->(action) do
33
15
  action.windows_open url: json_ui_garage_url(path: 'notifications/web_socket')
34
- # dialogs_notification title: 'Hello World', message: 'This is a notification', onClick: ->(subaction) do
35
- # subaction.dialogs_alert message: 'Perform action'
36
- # end
37
16
  end
38
-
39
- # template.thumbnail title: 'Send WebSocket Notification', onClick: ->(action) do
40
- # json.action "ws/push"
41
- # json.topic "links"
42
- # json.event "new_link"
43
- # json.payload({
44
- # "club_id": "2",
45
- # "room_id": "30",
46
- # "user_id": "2"
47
- # # title: "TITLE",
48
- # # url: "URL"
49
- # })
50
-
51
- # # "topic": "room:30",
52
- # # "event": "create_comment",
53
- # # "payload": {
54
- # # "club_id": "2",
55
- # # "room_id": "30",
56
- # # "user_id": "2"
57
- # # }
58
-
59
- # end
60
17
  end
61
18
  end
@@ -14,7 +14,7 @@ json.ws({
14
14
  # "topic" => "room:30",
15
15
  # "event" => "comments_updated",
16
16
  "topic" => "links",
17
- "event" => "new_link_added",
17
+ "events" => ["new_link_added"],
18
18
  "header" => {
19
19
  "user_id" => 2,
20
20
  "prev_item_id" => nil,
@@ -23,31 +23,29 @@ json.ws({
23
23
  })
24
24
 
25
25
  page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: glib_json_padding_body, paramNameForFormData: 'formData', onSubmit: ->(action) do
26
- # action.dialogs_alert
27
-
28
- json.action "ws/push"
29
- json.topic "links"
30
- json.event "new_link"
31
- json.payload({
32
- "club_id": "2",
33
- "room_id": "30",
34
- "user_id": "2"
35
- # title: "TITLE",
36
- # url: "URL"
37
- })
38
-
39
- # "topic": "room:30",
40
- # "event": "create_comment",
41
- # "payload": {
42
- # "club_id": "2",
43
- # "room_id": "30",
44
- # "user_id": "2"
45
- # }
26
+ json.action "ws/push"
27
+ json.topic "links"
28
+ json.event "new_link"
29
+ json.payload({
30
+ "club_id": "2",
31
+ "room_id": "30",
32
+ "user_id": "2"
33
+ # title: "TITLE",
34
+ # url: "URL"
35
+ })
46
36
 
47
37
  end, childViews: ->(form) do
38
+ form.spacer height: 14
39
+ form.label text: "Message: #{params[:message]}"
40
+ form.spacer height: 14
41
+
48
42
  form.fields_text name: 'user[name]', width: 'matchParent', label: 'Name'
43
+
44
+ # TODO: Change this to radio for selecting alert vs reload response
49
45
  form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
50
46
 
47
+ form.fields_hidden name: 'baseUrl', width: 'matchParent', value: json_ui_garage_url(path: 'notifications/web_socket')
48
+
51
49
  form.panels_split width: 'matchParent', content: ->(split) do
52
50
  # split.left childViews: ->(left) do
53
51
  # if params[:mode] == 'dialog'
@@ -41,6 +41,17 @@ json_ui_page json do |page|
41
41
  action.windows_open url: json_ui_garage_url(path: 'pages/full_width')
42
42
  end
43
43
  end
44
+ end,
45
+ ->(section) do
46
+ section.header padding: glib_json_padding_list, childViews: ->(header) do
47
+ header.h2 text: 'Misc (Web Only)'
48
+ end
49
+
50
+ section.rows builder: ->(template) do
51
+ template.thumbnail title: 'Nested Scroll', onClick: ->(action) do
52
+ action.windows_open url: json_ui_garage_url(path: 'pages/nested_scroll')
53
+ end
54
+ end
44
55
  end
45
56
  ]
46
57