glib-web 3.24.4 → 3.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/glib/json/new_dynamic_text.rb +0 -0
  3. data/app/helpers/glib/app_feature_support_helper.rb +0 -0
  4. data/app/helpers/glib/dynamic_texts_helper.rb +0 -0
  5. data/app/helpers/glib/json_ui/action_builder/components.rb +6 -0
  6. data/app/helpers/glib/json_ui/action_builder/sheets.rb +0 -0
  7. data/app/helpers/glib/json_ui/action_builder/windows.rb +7 -0
  8. data/app/helpers/glib/json_ui/action_builder.rb +41 -0
  9. data/app/helpers/glib/json_ui/analytics_helper.rb +0 -0
  10. data/app/helpers/glib/json_ui/generic_builders.rb +0 -0
  11. data/app/helpers/glib/json_ui/page_helper.rb +6 -0
  12. data/app/helpers/glib/json_ui/styling_helper.rb +11 -0
  13. data/app/helpers/glib/json_ui/view_builder/fields.rb +6 -0
  14. data/app/models/glib/active_storage/attachment.rb +0 -0
  15. data/app/models/glib/active_storage/blob.rb +0 -0
  16. data/app/models/glib/dynamic_text_record.rb +0 -0
  17. data/app/models/glib/text.rb +0 -0
  18. data/app/validators/email_typo_validator.rb +0 -0
  19. data/app/validators/email_validator.rb +0 -0
  20. data/app/validators/url_validator.rb +0 -0
  21. data/app/views/json_ui/garage/actions/_cookies.json.jbuilder +12 -0
  22. data/app/views/json_ui/garage/actions/_list.json.jbuilder +2 -0
  23. data/app/views/json_ui/garage/actions/dialogs_oauth_post.json.jbuilder +0 -0
  24. data/app/views/json_ui/garage/forms/dynamic_select_data.json.jbuilder +0 -0
  25. data/app/views/json_ui/garage/forms/generic_post.json.jbuilder +0 -0
  26. data/app/views/json_ui/garage/forms/pickers.json.jbuilder +76 -3
  27. data/app/views/json_ui/garage/forms/selects.json.jbuilder +6 -2
  28. data/app/views/json_ui/garage/forms/submission_flow.json.jbuilder +0 -0
  29. data/app/views/json_ui/garage/forms/submission_flow_post.json.jbuilder +0 -0
  30. data/app/views/json_ui/garage/forms/submission_indicator.json.jbuilder +0 -0
  31. data/app/views/json_ui/garage/forms/submission_indicator_post.json.jbuilder +0 -0
  32. data/app/views/json_ui/garage/home/blank.json.jbuilder +0 -0
  33. data/app/views/json_ui/garage/home/slow.json.jbuilder +0 -0
  34. data/app/views/json_ui/garage/lists/autoload_all.json.jbuilder +0 -0
  35. data/app/views/json_ui/garage/lists/autoload_as_needed.json.jbuilder +0 -0
  36. data/app/views/json_ui/garage/lists/chat_ui.json.jbuilder +0 -0
  37. data/app/views/json_ui/garage/lists/fab.json.jbuilder +0 -0
  38. data/app/views/json_ui/garage/notifications/web_socket.json.jbuilder +0 -0
  39. data/app/views/json_ui/garage/pages/custom_style_class.json.jbuilder +0 -0
  40. data/app/views/json_ui/garage/pages/full_width.json.jbuilder +0 -0
  41. data/app/views/json_ui/garage/pages/full_width_height.json.jbuilder +0 -0
  42. data/app/views/json_ui/garage/pages/layout.json.jbuilder +0 -0
  43. data/app/views/json_ui/garage/pages/lifecycle_hooks.json.jbuilder +0 -0
  44. data/app/views/json_ui/garage/pages/loading_indicator.json.jbuilder +0 -0
  45. data/app/views/json_ui/garage/pages/nested_scroll.json.jbuilder +0 -0
  46. data/app/views/json_ui/garage/pages/redirect_onload.json.jbuilder +0 -0
  47. data/app/views/json_ui/garage/panels/_styled.json.jbuilder +0 -0
  48. data/app/views/json_ui/garage/panels/card.json.jbuilder +0 -0
  49. data/app/views/json_ui/garage/panels/custom.json.jbuilder +0 -0
  50. data/app/views/json_ui/garage/panels/outlined.json.jbuilder +0 -0
  51. data/app/views/json_ui/garage/services/dynamic_text.json.jbuilder +0 -0
  52. data/app/views/json_ui/garage/services/image.json.jbuilder +0 -0
  53. data/app/views/json_ui/garage/services/index.json.jbuilder +0 -0
  54. data/app/views/json_ui/garage/tables/_autoload_section.json.jbuilder +0 -0
  55. data/app/views/json_ui/garage/tables/autoload_all.json.jbuilder +0 -0
  56. data/app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder +0 -0
  57. data/app/views/json_ui/garage/tables/export_import.json.jbuilder +0 -0
  58. data/app/views/json_ui/garage/tables/index.json.jbuilder +0 -0
  59. data/app/views/json_ui/garage/views/calendar_data.json.jbuilder +0 -0
  60. data/app/views/json_ui/garage/views/charts.json.jbuilder +26 -0
  61. data/app/views/json_ui/garage/views/links.json.jbuilder +0 -0
  62. data/app/views/json_ui/garage/views/map_data.json.jbuilder +0 -0
  63. data/app/views/json_ui/garage/views/multimedia.json.jbuilder +0 -0
  64. data/app/views/layouts/json_ui/no_custom.html.erb +0 -0
  65. data/lib/generators/glib/install_generator.rb +0 -0
  66. data/lib/generators/templates/20191017062519_create_texts.rb +0 -0
  67. data/lib/generators/templates/20191024063257_add_scope_to_texts.rb +0 -0
  68. data/lib/generators/templates/20191112095018_add_lang_to_texts.rb +0 -0
  69. data/lib/generators/templates/20191126071051_create_active_storage_tables.active_storage.rb +0 -0
  70. data/lib/generators/templates/database.yml +0 -0
  71. data/lib/generators/templates/dynamic_text.rb +0 -0
  72. data/lib/glib/dynamic_text/config.rb +0 -0
  73. data/lib/glib/dynamic_text.rb +0 -0
  74. data/lib/glib/json_crawler/action_crawler.rb +0 -0
  75. data/lib/glib/json_crawler/action_crawlers/action_http.rb +0 -0
  76. data/lib/glib/json_crawler/action_crawlers/dialogs_alert.rb +0 -0
  77. data/lib/glib/json_crawler/action_crawlers/menu.rb +0 -0
  78. data/lib/glib/json_crawler/action_crawlers/run_multiple.rb +0 -0
  79. data/lib/glib/json_crawler/action_crawlers/windows_open.rb +0 -0
  80. data/lib/glib/json_crawler/coverage.rb +0 -0
  81. data/lib/glib/value.rb +0 -0
  82. data/lib/glib/version.rb +0 -0
  83. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aba0dc03db2778a7a62e6222b3024ace73faa22c47d158a9088ed334db9515b0
4
- data.tar.gz: 2aa5ad7d865b21b3ae466aec5213af9553b118ac73db120a8def60aa624bee0a
3
+ metadata.gz: d2f5d2ae1abeb1b4204f3879a5561f0396f610ebc2805ff684ce1989b08041f5
4
+ data.tar.gz: 2ceb705bdc581a4e4fcf1b3f70b9ace090fb4af8576995310f2ec46813c7c1eb
5
5
  SHA512:
6
- metadata.gz: 2798441528eaab4548b034b65f79704daf77295ef8ed6751f2e1ea3f1719e9df12308d823fb251a0427d012e6bc5298bcbaf232ba47ada41128738bd8feee6a1
7
- data.tar.gz: c83bbb97e419a24350383d4a6ad3e83322a5a153f4da1437f028437aef50987721a494d58e9cf20ad5ae5efc356d757eb16112c2716bb82e931ce40063157290
6
+ metadata.gz: 1f97d523b8eedd779e93c2cd54a27d5af356e4fc16287d141c0b3ec647596e7d0661713a2849c27b255684b2d7c8185a77f5a43bdcd625f15a621f86cacfa6dd
7
+ data.tar.gz: a87a2e17a6763771cb606910f3ce9c3011bde9b8e6d935c7a44616a66713ccc4aabade5d0b849b2b1c6ac078308c24ebc32ddecf7bbeb99ef6984f991be5cdda
File without changes
File without changes
@@ -16,6 +16,12 @@ class Glib::JsonUi::ActionBuilder
16
16
  end
17
17
 
18
18
  # Experimental
19
+ class ReplaceChildren < Action
20
+ string :targetId
21
+ views :childViews
22
+ end
23
+
24
+ # Experimental. Can this be merged with `components_set` ?
19
25
  class Replace < Action
20
26
  string :targetId
21
27
  action :onReplace
File without changes
@@ -30,6 +30,13 @@ class Glib::JsonUi::ActionBuilder
30
30
  required :fallbackUrl
31
31
  end
32
32
 
33
+ class CloseWithOpen < Action
34
+ string :url
35
+ action :onOpen
36
+
37
+ required :url
38
+ end
39
+
33
40
  # Any component can listen to the refresh_state event and react appropriately.
34
41
  # E.g. Stripe credit card component can refresh its token to make sure it is not stale.
35
42
  class RefreshState < Action
@@ -109,6 +109,30 @@ module Glib
109
109
  end
110
110
  end
111
111
 
112
+ module Logics
113
+ # Future: Replace showIf and loadIf
114
+ # Example:
115
+ # `submitWhenNotDisplayed` is false by default
116
+ # fields_text id: 'my_text', displayed: false, submitWhenNotDisplayed: true
117
+ #
118
+ # logics_if condition: { '==', BLAH1, BLAH2 }, true: ->(action) do
119
+ # action.components_set targetId: 'my_text', displayed: true
120
+ # end
121
+ #
122
+ # class If < Action
123
+ # hash :condition
124
+ # action :true
125
+ # action :false
126
+ # end
127
+
128
+ class Set < Action
129
+ string :targetId
130
+ hash :conditionalData
131
+ hash :variables
132
+ action :onSet
133
+ end
134
+ end
135
+
112
136
  module Timeouts
113
137
  class Set < Action
114
138
  string :timerId
@@ -141,7 +165,24 @@ module Glib
141
165
  end
142
166
  end
143
167
 
168
+ module Cookies
169
+ class Save < Action
170
+ string :key
171
+ string :value
172
+ action :onSave
173
+ end
174
+
175
+ # FUTURE
176
+ # class Remove < Action
177
+ # end
178
+
179
+ # FUTURE
180
+ # class Clear < Action
181
+ # end
182
+ end
183
+
144
184
  # FUTURE
185
+
145
186
  module Data
146
187
  class Save < Action
147
188
  string :key
File without changes
File without changes
@@ -183,6 +183,12 @@ module Glib
183
183
  end
184
184
  end
185
185
 
186
+ def bodyFooter(options = {})
187
+ json.bodyFooter do
188
+ vertical_content(options)
189
+ end
190
+ end
191
+
186
192
  def header(options = {})
187
193
  json.header do
188
194
  vertical_content(options)
@@ -50,6 +50,17 @@ module Glib
50
50
 
51
51
  ###
52
52
 
53
+ ### Chart
54
+
55
+ def glib_chart_tooltip_template(options)
56
+ %{
57
+ <div style="border: 1px solid gray; border-radius: 6px;">
58
+ <div style="border-radius: 6px 6px 0 0; background-color: gray; padding: 4px; color: white;">#{options[:title]}</div>
59
+ <div style="border-radius: 0 0 6px 6px; background-color: white; padding: 4px" color: black;>#{options[:content]}</div>
60
+ </div>
61
+ }
62
+ end
63
+
53
64
  end
54
65
  end
55
66
  end
@@ -10,6 +10,7 @@ class Glib::JsonUi::ViewBuilder
10
10
  bool :disableDirtyCheck
11
11
  action :onChange
12
12
  string :paramNameForFormData
13
+ string :paramNameForFieldName
13
14
 
14
15
  def default_url_options
15
16
  { only_path: true }
@@ -172,6 +173,11 @@ class Glib::JsonUi::ViewBuilder
172
173
  string :cacheKey
173
174
  end
174
175
 
176
+ # Deprecated
177
+ # Just use fields_select with options provided by the backend. This allows greater flexibility,
178
+ # which is important because different systems might want to use different values for
179
+ # countries as well as for regions, e.g. alpha2 vs alpha3
180
+ # See app/views/json_ui/garage/forms/pickers.json.jbuilder for an example
175
181
  class Country < AbstractField
176
182
  hash :region
177
183
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,12 @@
1
+
2
+ section.header padding: glib_json_padding_list, childViews: ->(header) do
3
+ header.h3 id: 'cookie', text: 'Cookies'
4
+ end
5
+
6
+ section.rows builder: ->(template) do
7
+ template.thumbnail title: 'cookies/save', onClick: ->(action) do
8
+ action.cookies_save key: 'glib_cookie', value: "test_cookie_#{DateTime.current.to_i}", onSave: ->(subaction) do
9
+ subaction.snackbars_alert message: 'Saved'
10
+ end
11
+ end
12
+ end
@@ -23,5 +23,7 @@ panel.panels_list id: 'action_list', sections: [
23
23
  render "#{@path_prefix}/actions/components", section: section
24
24
  end, ->(section) do
25
25
  render "#{@path_prefix}/actions/fields", section: section
26
+ end, ->(section) do
27
+ render "#{@path_prefix}/actions/cookies", section: section
26
28
  end
27
29
  ]
@@ -81,9 +81,82 @@ page.form \
81
81
  form.spacer height: 20
82
82
  form.h2 text: 'Country'
83
83
  form.spacer height: 6
84
- region_field = { name: 'user[city]', label: 'City' }
85
- form.fields_country name: 'user[country]', width: 'matchParent', label: 'Country', region: nil
86
- form.fields_country name: 'user[country_with_region]', width: 'matchParent', label: 'Country with region', region: region_field
84
+ # region_field = { name: 'user[city]', label: 'City' }
85
+ # form.fields_country name: 'user[country]', width: 'matchParent', label: 'Country', region: nil
86
+ # form.fields_country name: 'user[country_with_region]', width: 'matchParent', label: 'Country with region', region: region_field
87
+
88
+ countries = [
89
+ {
90
+ code: 'AU',
91
+ name: 'Australia',
92
+ regions: ['ACT', 'New South Wales', 'Victoria', 'Western Australia']
93
+ },
94
+ {
95
+ code: 'ID',
96
+ name: 'Indonesia',
97
+ regions: ['Jawa Barat', 'Java Tengah', 'Jawa Timur', 'Sumatra Utara', 'Sumatra Barat', 'Sumatra Selatan']
98
+ }
99
+ ]
100
+ region_registry = countries.map do |c|
101
+ [c[:code], c[:regions].map { |r| { value: r, text: r } } ]
102
+ end.to_h
103
+ form.fields_select \
104
+ name: 'user[country1]',
105
+ width: 'matchParent',
106
+ label: 'Country',
107
+ options: countries.map { |c| { value: c[:code], text: c[:name] } },
108
+ paramNameForFormData: 'variables',
109
+ onChange: ->(action) do
110
+ action.logics_set targetId: 'region_code1', conditionalData: {
111
+ options: {
112
+ '[]' => [{ 'var': 'static[region_registry]' }, { 'var': 'user[country1]' }]
113
+ }
114
+ }, variables: {
115
+ 'static[region_registry]' => region_registry
116
+ }
117
+ end
118
+
119
+ form.fields_select \
120
+ name: 'user[region1]',
121
+ width: 'matchParent',
122
+ label: 'Region',
123
+ id: 'region_code1',
124
+ options: []
125
+
126
+ form.spacer height: 20
127
+
128
+ selected_country = 'AU'
129
+ form.fields_select \
130
+ name: 'user[country2]',
131
+ width: 'matchParent',
132
+ label: 'Country',
133
+ options: countries.map { |c| { value: c[:code], text: c[:name] } },
134
+ paramNameForFormData: 'variables',
135
+ value: selected_country,
136
+ onChange: ->(action) do
137
+ action.logics_set targetId: 'region_code2', conditionalData: {
138
+ options: {
139
+ '??' => [
140
+ {
141
+ '[]' => [{ 'var': 'static[region_registry]' }, { 'var': 'user[country2]' }]
142
+ },
143
+ []
144
+ ]
145
+ },
146
+ value: nil
147
+ }, variables: {
148
+ 'static[region_registry]' => region_registry
149
+ }
150
+ end
151
+
152
+ form.fields_select \
153
+ name: 'user[region2]',
154
+ width: 'matchParent',
155
+ label: 'Region',
156
+ id: 'region_code2',
157
+ value: 'Victoria',
158
+ options: region_registry[selected_country]
159
+ form.label text: 'This select options should not be blank'
87
160
 
88
161
  form.spacer height: 20
89
162
  form.h2 text: 'Map'
@@ -70,8 +70,12 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
70
70
  accessory.header padding: { x: 16, y: 10 }, childViews: ->(header) do
71
71
  header.label text: 'Header'
72
72
  end
73
- accessory.footer padding: { x: 16, y: 10 }, childViews: ->(footer) do
74
- footer.label text: 'Footer'
73
+ accessory.footer styleClass: 'select-footer', padding: { x: 16, y: 10 }, childViews: ->(footer) do
74
+ footer.h3 text: 'Footer'
75
+ # footer.spacer height: 4
76
+ footer.p styleClass: 'select-footer-paragraph', text: %(
77
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Tortor consequat id porta nibh venenatis cras sed. Amet consectetur adipiscing elit duis tristique sollicitudin nibh. Proin sagittis nisl rhoncus mattis rhoncus urna neque viverra justo. Velit egestas dui id ornare arcu odio. Pretium nibh ipsum consequat nisl vel pretium. Bibendum at varius vel pharetra. Leo duis ut diam quam nulla porttitor massa id. Consectetur libero id faucibus nisl tincidunt eget nullam non. Eu facilisis sed odio morbi quis. Eu volutpat odio facilisis mauris sit amet massa vitae tortor. Sed odio morbi quis commodo odio aenean sed. Sit amet justo donec enim diam. Ullamcorper a lacus vestibulum sed arcu non odio euismod.
78
+ )
75
79
  footer.spacer height: 14
76
80
  footer.label text: 'Click me', onClick: ->(action) do
77
81
  action.components_findClosest view: 'fields/select', onFind: ->(subaction) do
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -61,6 +61,32 @@ else
61
61
  # scroll.h1 text: 'Line chart using remote data'
62
62
  # render "#{@path_prefix}/views/chart_data", json: json, builder: scroll
63
63
 
64
+ scroll.h2 text: 'Line chart with custom tooltip'
65
+ scroll.charts_line \
66
+ plugins: { customTooltip: true },
67
+ colors: ['#79AC78', '#3085C3'], legend: { display: false },
68
+ dataSeries: [
69
+ -> do
70
+ json.title 'Line'
71
+
72
+ points = {
73
+ 'Jan' => 100,
74
+ 'Feb' => 78,
75
+ 'Mar' => 70,
76
+ 'Apr' => 62,
77
+ }
78
+ prev = points['Jan']
79
+
80
+
81
+ json.points points.map { |k, v|
82
+ delta = prev - v
83
+ tooltip = v < prev ? "<div>Delta</div><div>▼ #{delta}</div>" : "<div>Delta</div><div>▲ #{delta}</div>"
84
+ prev = v
85
+ { x: k, y: v, tooltip: glib_chart_tooltip_template(title: "Summary #{k}", content: tooltip) }
86
+ }
87
+ end
88
+ ]
89
+
64
90
  scroll.h2 text: 'Column chart (Clustered)'
65
91
  scroll.charts_column dataGroups: [
66
92
  -> do
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/lib/glib/value.rb CHANGED
File without changes
data/lib/glib/version.rb CHANGED
File without changes
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: 3.24.4
4
+ version: 3.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -140,6 +140,7 @@ files:
140
140
  - app/views/json_ui/garage/_nav_menu.json.jbuilder
141
141
  - app/views/json_ui/garage/actions/_commands.json.jbuilder
142
142
  - app/views/json_ui/garage/actions/_components.json.jbuilder
143
+ - app/views/json_ui/garage/actions/_cookies.json.jbuilder
143
144
  - app/views/json_ui/garage/actions/_dialogs.json.jbuilder
144
145
  - app/views/json_ui/garage/actions/_dialogs_show.json.jbuilder
145
146
  - app/views/json_ui/garage/actions/_fields.json.jbuilder
@@ -345,7 +346,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
345
346
  - !ruby/object:Gem::Version
346
347
  version: '0'
347
348
  requirements: []
348
- rubygems_version: 3.4.6
349
+ rubyforge_project:
350
+ rubygems_version: 2.7.6
349
351
  signing_key:
350
352
  specification_version: 4
351
353
  summary: ''