glib-web 0.5.69 → 0.5.73

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/glib/enum_helper.rb +10 -0
  3. data/app/helpers/glib/json_ui/abstract_builder.rb +16 -1
  4. data/app/helpers/glib/json_ui/action_builder/windows.rb +2 -0
  5. data/app/helpers/glib/json_ui/styling_helper.rb +8 -0
  6. data/app/helpers/glib/json_ui/view_builder.rb +8 -0
  7. data/app/helpers/glib/json_ui/view_builder/fields.rb +14 -3
  8. data/app/helpers/glib/json_ui/view_builder/panels.rb +5 -0
  9. data/app/models/glib/application_record.rb +4 -4
  10. data/app/views/json_ui/garage/forms/dynamic_select.json.jbuilder +2 -0
  11. data/app/views/json_ui/garage/forms/index.json.jbuilder +2 -5
  12. data/app/views/json_ui/garage/forms/{misc_two.json.jbuilder → online_participant1.json.jbuilder} +5 -1
  13. data/app/views/json_ui/garage/forms/online_participant2.json.jbuilder +25 -0
  14. data/app/views/json_ui/garage/forms/pickers.json.jbuilder +8 -6
  15. data/app/views/json_ui/garage/forms/selects.json.jbuilder +9 -1
  16. data/app/views/json_ui/garage/forms/timers.json.jbuilder +120 -0
  17. data/app/views/json_ui/garage/lists/index.json.jbuilder +6 -0
  18. data/app/views/json_ui/garage/panels/flow.json.jbuilder +10 -0
  19. data/app/views/json_ui/garage/panels/index.json.jbuilder +7 -1
  20. data/app/views/json_ui/garage/panels/ul.json.jbuilder +33 -0
  21. data/app/views/json_ui/garage/panels/web.json.jbuilder +15 -0
  22. data/app/views/json_ui/garage/views/controls.json.jbuilder +37 -0
  23. data/app/views/json_ui/garage/views/icons.json.jbuilder +1 -0
  24. data/app/views/json_ui/garage/views/index.json.jbuilder +3 -0
  25. data/app/views/json_ui/garage/views/misc.json.jbuilder +8 -8
  26. data/app/views/json_ui/garage/views/texts.json.jbuilder +0 -9
  27. metadata +7 -3
  28. data/app/views/json_ui/garage/forms/misc.json.jbuilder +0 -71
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0c606dd2f857ea559047dd6cb9fe6fe64785186b42fb07c0a58b7ac25031efb
4
- data.tar.gz: 064c3e2fff0dc2081e2c757e218c83dc95e6f768b17738f1f46b122b84cd3003
3
+ metadata.gz: 2f4ae4213c1c8cd32dd3f1726335e8ad63f878ae480bc83792636f217b88cd5e
4
+ data.tar.gz: 8b395ee2a1f16ae8c9c9b0af8ecaf9aca9e03b2c0cb819d8217281229b2cbc56
5
5
  SHA512:
6
- metadata.gz: 93bc51ea044677fc2845faf25c39b3fa22c8c48c5b9cc3847ec2c27b7a74a739c9756e942b9c13aa9497df4e0b499031060a3f5c11d6ed083dadef65c9f77029
7
- data.tar.gz: 97321511bd98a9498ed8332fb1404dbdb13033e2f51cad39aea5d6c0527793028e6e039fe598cdeb254afea8cdfc7ed774525580dccdb43af6f1fc392d40c646
6
+ metadata.gz: 8c61abfa42bba5bcbd11d70ac9840b0e6aed1a1dae7b01e480615ff650161e330a4fae35937d7a2f1e9e513126b5f016a5828dfb85e91e362b80b4d7782a78dc
7
+ data.tar.gz: 6432a393428e3568832d9c8e7e07ba851ac0326479277bdce8e80c7969f22752e5f7634953349f707dec71b5801cebdc9aa2bb117e9b4eabbccf42b6ba881cbd
@@ -4,5 +4,15 @@ module Glib
4
4
  keys ||= clazz.send("#{enum_field}s").keys
5
5
  keys.map { |i| { text: clazz.glib_enum_humanize(enum_field, i), value: i } }
6
6
  end
7
+
8
+ # See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones and description
9
+ def glib_time_zone_options
10
+ ActiveSupport::TimeZone.all.sort { |a, b|
11
+ a.utc_offset <=> b.utc_offset
12
+ }.collect { |tz|
13
+ utc_offset = "#{tz.utc_offset >= 0 ? '+' : ''}#{tz.utc_offset / 60 / 60}h"
14
+ { value: tz.tzinfo.identifier, text: "#{utc_offset} #{tz.name}" }
15
+ }
16
+ end
7
17
  end
8
18
  end
@@ -48,6 +48,8 @@ module Glib
48
48
  class JsonUiElement
49
49
  attr_reader :json, :page
50
50
 
51
+ @@_required_properties = {}
52
+
51
53
  def initialize(json, page)
52
54
  @json = json
53
55
  @page = page
@@ -60,6 +62,11 @@ module Glib
60
62
  args.each do |k, v|
61
63
  send(k, v)
62
64
  end
65
+
66
+ required_properties = @@_required_properties[self.class.component_name] || []
67
+ required_properties.each do |prop|
68
+ raise "Property required: #{prop}. Properties provided: #{args}. Component: #{self.class.component_name}" unless args[prop].present?
69
+ end
63
70
  else
64
71
  raise "Invalid properties: #{args}"
65
72
  end
@@ -68,6 +75,10 @@ module Glib
68
75
  end
69
76
 
70
77
  private
78
+ def self.component_name
79
+ @component_name ||= self.name.sub('Glib::JsonUi::ActionBuilder::', '')
80
+ end
81
+
71
82
  def self.any(propName)
72
83
  define_method(propName) do |value|
73
84
  json.set! propName, value
@@ -106,7 +117,7 @@ module Glib
106
117
  define_method(propName) do |value|
107
118
  if (value = value&.to_s)
108
119
  if !Rails.env.production?
109
- if !value.match /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/i
120
+ if !value.match /^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/i
110
121
  raise "Invalid color: #{value}"
111
122
  end
112
123
  end
@@ -285,6 +296,10 @@ module Glib
285
296
  end
286
297
  end
287
298
 
299
+ def self.required(*prop_names)
300
+ @@_required_properties[self.component_name] = prop_names
301
+ end
302
+
288
303
  def created
289
304
  # To be overridden
290
305
  end
@@ -26,6 +26,8 @@ class Glib::JsonUi::ActionBuilder
26
26
  class CloseWithReload < Action
27
27
  string :fallbackUrl
28
28
  action :onReload
29
+
30
+ required :fallbackUrl
29
31
  end
30
32
  end
31
33
  end
@@ -40,6 +40,14 @@ module Glib
40
40
  '#b3bac2'
41
41
  end
42
42
 
43
+ def glib_color_success
44
+ '#4caf50'
45
+ end
46
+
47
+ def glib_color_error
48
+ '#ff5252'
49
+ end
50
+
43
51
  ###
44
52
 
45
53
  end
@@ -171,6 +171,14 @@ module Glib
171
171
  action :onClick
172
172
  end
173
173
 
174
+ class Switch < View
175
+ string :text, cache: true
176
+ bool :enabled
177
+
178
+ action :onEnabled
179
+ action :onDisabled
180
+ end
181
+
174
182
  class Hr < View
175
183
  color :color
176
184
  end
@@ -98,11 +98,10 @@ class Glib::JsonUi::ViewBuilder
98
98
  end
99
99
 
100
100
  class Timer < Text
101
- bool :forward
102
101
  hash :actionCable
103
- action :onZero
104
102
  int :min
105
103
  int :max
104
+ bool :forward
106
105
  end
107
106
 
108
107
  # Benefits of using `fields/submit` over `button`
@@ -129,7 +128,7 @@ class Glib::JsonUi::ViewBuilder
129
128
  @value = value if value != Glib::Value::DEFAULT
130
129
  end
131
130
 
132
- # Where possible, use value instead of this
131
+ # TODO: Remove (deprecated). Where possible, use value instead of this
133
132
  bool :checked
134
133
  end
135
134
 
@@ -153,6 +152,18 @@ class Glib::JsonUi::ViewBuilder
153
152
  hash :append
154
153
  end
155
154
 
155
+ class TimeZone < AbstractField
156
+ include Glib::EnumHelper
157
+
158
+ # Override
159
+ def created
160
+ super
161
+
162
+ json.options glib_time_zone_options
163
+ end
164
+ end
165
+
166
+ # TODO: Remove (deprecated)
156
167
  class Autocomplete < AbstractField
157
168
  array :options
158
169
  # bool :readOnly
@@ -212,6 +212,7 @@ class Glib::JsonUi::ViewBuilder
212
212
  end
213
213
 
214
214
  class Flow < View
215
+ hash :innerPadding
215
216
  views :childViews
216
217
  end
217
218
 
@@ -237,6 +238,10 @@ class Glib::JsonUi::ViewBuilder
237
238
  end
238
239
  end
239
240
 
241
+ class Web < View
242
+ string :url
243
+ end
244
+
240
245
  class Ul < View
241
246
  views :childViews
242
247
 
@@ -5,13 +5,13 @@ module Glib
5
5
  scope :created_asc, -> { order(created_at: :asc) }
6
6
  scope :created_desc, -> { order(created_at: :desc) }
7
7
 
8
- def glib_enum_humanize(enum_name)
9
- self.class.glib_enum_humanize(enum_name, send(enum_name))
8
+ def glib_enum_humanize(enum_name, default_value = nil)
9
+ self.class.glib_enum_humanize(enum_name, send(enum_name), default_value)
10
10
  end
11
11
 
12
- def self.glib_enum_humanize(enum_name, enum_value)
12
+ def self.glib_enum_humanize(enum_name, enum_value, default_value = nil)
13
13
  if enum_value
14
- I18n.t("activerecord.attributes.#{model_name.i18n_key}.#{enum_name.to_s.pluralize}.#{enum_value}")
14
+ I18n.t("activerecord.attributes.#{model_name.i18n_key}.#{enum_name.to_s.pluralize}.#{enum_value}", default: default_value)
15
15
  end
16
16
  end
17
17
  end
@@ -6,6 +6,8 @@ render "#{@path_prefix}/nav_menu", json: json, page: page
6
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.h2 text: 'Dynamic Select'
8
8
  form.spacer height: 6
9
+ form.label text: 'Dynamically loads options from the server. Useful for a huge list (e.g. 1000+ items)'
10
+ form.spacer height: 14
9
11
 
10
12
  form.fields_dynamicSelect name: 'user[primary_language]', width: 'matchParent', label: 'Primary Language',
11
13
  selectedOptions: [ { value: 'id3', text: 'Item 3' } ],
@@ -62,11 +62,8 @@ page.list sections: [
62
62
  template.thumbnail title: 'Ratings', onClick: ->(action) do
63
63
  action.windows_open url: json_ui_garage_url(path: 'forms/ratings')
64
64
  end
65
- template.thumbnail title: 'Misc 1', onClick: ->(action) do
66
- action.windows_open url: json_ui_garage_url(path: 'forms/misc')
67
- end
68
- template.thumbnail title: 'Misc 2', onClick: ->(action) do
69
- action.windows_open url: json_ui_garage_url(path: 'forms/misc_two')
65
+ template.thumbnail title: 'Timers', onClick: ->(action) do
66
+ action.windows_open url: json_ui_garage_url(path: 'forms/timers')
70
67
  end
71
68
  end
72
69
  end, ->(section) do
@@ -16,6 +16,10 @@ json.actionCable online_socket_config
16
16
 
17
17
  page.on load: ->(action) do
18
18
  action.timeouts_set interval: 1000, repeat: true, onTimeout: ->(subaction) do
19
- subaction.cables_push channel: online_channel, event: event, payload: { status: true, user_id: first_user.id, reset_value: 10 }
19
+ subaction.cables_push channel: online_channel, event: event, payload: { status: true, user_id: first_user.id, reset_value: 3 }
20
20
  end
21
21
  end
22
+
23
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
24
+ scroll.label text: 'Participant One is now online'
25
+ end
@@ -0,0 +1,25 @@
1
+ json.title 'Forms'
2
+
3
+ page = json_ui_page json
4
+ render "#{@path_prefix}/nav_menu", json: json, page: page
5
+
6
+ online_channel = 'OnlineChannel'
7
+ event = 'online_status'
8
+ second_user = User.second
9
+
10
+ online_socket_config = {
11
+ channel: online_channel,
12
+ filterKey: nil,
13
+ params: {}
14
+ }
15
+ json.actionCable online_socket_config
16
+
17
+ page.on load: ->(action) do
18
+ action.timeouts_set interval: 1000, repeat: true, onTimeout: ->(subaction) do
19
+ subaction.cables_push channel: online_channel, event: event, payload: { status: true, user_id: second_user.id, reset_value: 3 }
20
+ end
21
+ end
22
+
23
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
24
+ scroll.label text: 'Participant Two is now online'
25
+ end
@@ -30,12 +30,14 @@ page.form \
30
30
  name: 'user[employer]',
31
31
  checkValue: 1,
32
32
  label: 'I am an employer (no default value)'
33
- form.fields_check \
34
- name: 'user[enabled]',
35
- checkValue: true,
36
- label: 'Enable',
37
- styleClass: 'switch',
38
- value: 'true'
33
+
34
+ # Use `switch` component instead.
35
+ # form.fields_check \
36
+ # name: 'user[enabled]',
37
+ # styleClass: 'switch',
38
+ # checkValue: true,
39
+ # label: 'Enable',
40
+ # value: 'true'
39
41
 
40
42
  form.spacer height: 20
41
43
  form.h2 text: 'Date/Time'
@@ -72,7 +72,15 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
72
72
  form.fields_select name: 'user[mixed_default][]', width: 'matchParent', label: 'Mixed Default', options: languages.map { |k, v| { value: k, text: v } }, value: ['', 'specified', nil], multiple: true
73
73
 
74
74
  form.spacer height: 20
75
- form.h2 text: 'Autocomplete (select with manual entry)'
75
+ form.h2 text: 'Timezone selection'
76
+ form.spacer height: 6
77
+ form.label text: 'The select field defaults to the device\'s time zone.'
78
+ form.spacer height: 6
79
+ form.fields_timeZone name: 'user[time_zone]', width: 'matchParent', label: 'Time Zone'
80
+
81
+ # TODO: Remove
82
+ form.spacer height: 20
83
+ form.h2 text: 'Autocomplete (select with manual entry) -- DEPRECATED: Confusing UX, promote bad backend design'
76
84
  form.spacer height: 6
77
85
  skills = ['Singing', 'Dancing', 'Fighting']
78
86
  form.fields_autocomplete name: 'user[skill]', width: 'matchParent', label: 'Skill', options: skills, value: 'Singing'
@@ -0,0 +1,120 @@
1
+ json.title 'Forms'
2
+
3
+ page = json_ui_page json
4
+ render "#{@path_prefix}/nav_menu", json: json, page: page
5
+
6
+ online_channel = 'OnlineChannel'
7
+ first_user = User.first
8
+ second_user = User.second
9
+
10
+ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
11
+ form.spacer height: 20
12
+ form.h2 text: 'Standard (Backward)'
13
+ form.spacer height: 6
14
+ form.fields_timer \
15
+ width: 160,
16
+ styleClasses: ['outlined'],
17
+ label: 'Timer',
18
+ name: 'user[timer]',
19
+ value: 60,
20
+ min: 30
21
+
22
+ form.spacer height: 20
23
+ form.h2 text: 'Stop Watch (Forward)'
24
+ form.spacer height: 6
25
+ form.fields_timer \
26
+ width: 160,
27
+ styleClasses: ['outlined'],
28
+ label: 'Stop Watch',
29
+ name: 'user[stop_watch]',
30
+ value: 10,
31
+ max: 20,
32
+ forward: true
33
+
34
+ form.spacer height: 20
35
+ form.h2 text: 'Reset timer by ActionCable'
36
+ online_participant1_config = {
37
+ channel: online_channel,
38
+ filterKey: first_user.id
39
+ }
40
+
41
+ form.fields_timer \
42
+ width: 120,
43
+ actionCable: online_participant1_config,
44
+ name: 'user[online_timer1]',
45
+ value: 3,
46
+ min: 0
47
+
48
+ form.label \
49
+ text: 'Participant One is online',
50
+ color: glib_color_success,
51
+ showIf: {
52
+ ">": [
53
+ {
54
+ "var": 'user[online_timer1]'
55
+ },
56
+ 0
57
+ ]
58
+ }
59
+
60
+ form.label \
61
+ text: 'Participant One is offline',
62
+ color: glib_color_error,
63
+ showIf: {
64
+ "<=": [
65
+ {
66
+ "var": 'user[online_timer1]'
67
+ },
68
+ 0
69
+ ]
70
+ }
71
+
72
+ form.spacer height: 10
73
+ form.label text: 'Open Participant One', onClick: ->(action) do
74
+ action.windows_openWeb url: json_ui_garage_url(path: 'forms/online_participant1')
75
+ end
76
+ form.spacer height: 20
77
+
78
+ online_participant2_config = {
79
+ channel: online_channel,
80
+ filterKey: second_user.id
81
+ }
82
+ form.fields_timer \
83
+ width: 120,
84
+ actionCable: online_participant2_config,
85
+ name: 'user[online_timer2]',
86
+ value: 3,
87
+ min: 0
88
+
89
+ form.label \
90
+ text: 'Participant Two is online',
91
+ color: glib_color_success,
92
+ showIf: {
93
+ ">": [
94
+ {
95
+ "var": 'user[online_timer2]'
96
+ },
97
+ 0
98
+ ]
99
+ }
100
+
101
+ form.label \
102
+ text: 'Participant Two is offline',
103
+ color: glib_color_error,
104
+ showIf: {
105
+ "<=": [
106
+ {
107
+ "var": 'user[online_timer2]'
108
+ },
109
+ 0
110
+ ]
111
+ }
112
+
113
+ form.spacer height: 10
114
+ form.label text: 'Open Participant Two', onClick: ->(action) do
115
+ action.windows_openWeb url: json_ui_garage_url(path: 'forms/online_participant2')
116
+ end
117
+
118
+ form.spacer height: 40
119
+ form.fields_submit text: 'Submit'
120
+ end
@@ -4,6 +4,12 @@ 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 firstSection: ->(section) do
7
+ section.header padding: glib_json_padding_list, childViews: ->(header) do
8
+ header.label text: 'The List panel is useful for displaying a large number of items that are uniform, which is especially important in mobile apps because the rows can be reused for efficiency.'
9
+ header.spacer height: 6
10
+ header.label text: 'So, following the mobile-first paradigm, do not ever display large numbers of items using other components.'
11
+ end
12
+
7
13
  section.rows builder: ->(template) do
8
14
  template.thumbnail icon: 'list', title: 'Templating', onClick: ->(action) do
9
15
  action.windows_open url: json_ui_garage_url(path: 'lists/templating')
@@ -29,6 +29,16 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
29
29
  panel.button text: '5'
30
30
  end
31
31
 
32
+ scroll.label text: "\n"
33
+ scroll.h1 text: 'Inner Paddings'
34
+ scroll.panels_flow innerPadding: { top: 10, bottom: 10, left: 10, right: 10 }, width: 300, backgroundColor: '#b3bac2', childViews: ->(panel) do
35
+ panel.button text: '1'
36
+ panel.button text: '2'
37
+ panel.button text: '3'
38
+ panel.button text: '4'
39
+ panel.button text: '5'
40
+ end
41
+
32
42
  # scroll.label text: "\n"
33
43
  # scroll.h1 text: 'Alignments'
34
44
  # scroll.panels_horizontal align: 'top', childViews: ->(panel) do
@@ -27,6 +27,10 @@ json_ui_page json do |page|
27
27
  template.thumbnail title: 'Responsive', subtitle: 'Arrange *column panels* horizontally using flex', onClick: ->(action) do
28
28
  action.windows_open url: json_ui_garage_url(path: 'panels/responsive')
29
29
  end
30
+ template.thumbnail title: 'Unordered List', subtitle: 'Bullet points similar to HTML\'s <ul> tag', onClick: ->(action) do
31
+ action.windows_open url: json_ui_garage_url(path: 'panels/ul')
32
+ end
33
+
30
34
 
31
35
  end
32
36
  end, ->(section) do
@@ -82,7 +86,6 @@ json_ui_page json do |page|
82
86
  template.thumbnail title: 'Column', subtitle: 'Adds control over layout inside a responsive panel', onClick: ->(action) do
83
87
  action.windows_open url: json_ui_garage_url(path: 'panels/responsive')
84
88
  end
85
-
86
89
  end
87
90
  end, ->(section) do
88
91
  section.header padding: glib_json_padding_list, childViews: ->(header) do
@@ -93,6 +96,9 @@ json_ui_page json do |page|
93
96
  template.thumbnail title: 'Custom', onClick: ->(action) do
94
97
  action.windows_open url: json_ui_garage_url(path: 'panels/custom')
95
98
  end
99
+ template.thumbnail title: 'Web', onClick: ->(action) do
100
+ action.windows_open url: json_ui_garage_url(path: 'panels/web')
101
+ end
96
102
 
97
103
  end
98
104
  end, ->(section) do
@@ -0,0 +1,33 @@
1
+ json.title 'Unordered List'
2
+
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.h2 text: 'Standard Usage'
8
+ scroll.spacer height: 6
9
+ scroll.panels_ul childViews: ->(ul) do
10
+ ul.button text: 'Button', styleClass: 'link', onClick: ->(action) do
11
+ action.windows_open url: json_ui_garage_url(path: 'home/blank')
12
+ end
13
+ ul.label text: 'Label'
14
+ end
15
+
16
+ scroll.spacer height: 14
17
+ scroll.h2 text: 'Breadcrumbs'
18
+ scroll.spacer height: 6
19
+ scroll.panels_ul \
20
+ width: 'matchParent',
21
+ backgroundColor: '#eeeeee',
22
+ padding: { top: 10, right: 20, bottom: 10, left: 20 },
23
+ styleClass: 'breadcrumbs',
24
+ childViews: ->(ul) do
25
+ ul.button text: 'Level 1', styleClass: 'link', onClick: ->(action) do
26
+ action.windows_open url: json_ui_garage_url(path: 'home/blank')
27
+ end
28
+ ul.button text: 'Level 2', styleClass: 'link', onClick: ->(action) do
29
+ action.windows_open url: json_ui_garage_url(path: 'home/blank')
30
+ end
31
+ ul.label text: 'Level 3'
32
+ end
33
+ end
@@ -0,0 +1,15 @@
1
+ json.title 'Panels'
2
+
3
+ page = json_ui_page json
4
+ render "#{@path_prefix}/nav_menu", json: json, page: page
5
+
6
+ page.header padding: glib_json_padding_body, backgroundColor: '#b3bac2', childViews: ->(header) do
7
+ header.h1 text: 'Web View'
8
+ end
9
+
10
+ page.body height: 'matchParent', padding: glib_json_padding_body, childViews: ->(body) do
11
+ body.panels_web \
12
+ width: 'matchParent',
13
+ height: 'matchParent',
14
+ url: 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf'
15
+ end
@@ -0,0 +1,37 @@
1
+ json.title 'Views'
2
+
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.h2 text: 'Button'
8
+ scroll.spacer height: 6
9
+ scroll.button text: 'Click me', onClick: ->(action) do
10
+ action.dialogs_alert message: 'Perform action'
11
+ end
12
+
13
+ scroll.spacer height: 20
14
+ scroll.h2 text: 'Chip'
15
+ scroll.spacer height: 6
16
+ scroll.chip styleClass: 'success', text: 'pending'
17
+ scroll.spacer height: 6
18
+ scroll.chip text: 'Skills', onClick: ->(action) do
19
+ action.dialogs_alert message: 'Perform action'
20
+ end
21
+
22
+ scroll.spacer height: 20
23
+ scroll.h2 text: 'Switch'
24
+ scroll.spacer height: 6
25
+ scroll.switch \
26
+ text: 'Email notification',
27
+ onEnabled: ->(action) do
28
+ action.dialogs_alert message: 'Enabled'
29
+ end
30
+ scroll.switch \
31
+ enabled: true,
32
+ text: 'Push notification',
33
+ onDisabled: ->(action) do
34
+ action.dialogs_alert message: 'Disabled'
35
+ end
36
+
37
+ end
@@ -11,4 +11,5 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
11
11
  scroll.spacer height: 20
12
12
  scroll.h2 text: 'Icon with color'
13
13
  scroll.icon name: 'home', color: '#9370DB'
14
+ scroll.icon name: 'home', color: '#9370DB80'
14
15
  end
@@ -13,6 +13,9 @@ json_ui_page json do |page|
13
13
  template.thumbnail title: 'Texts', onClick: ->(action) do
14
14
  action.windows_open url: json_ui_garage_url(path: 'views/texts')
15
15
  end
16
+ template.thumbnail title: 'Controls', onClick: ->(action) do
17
+ action.windows_open url: json_ui_garage_url(path: 'views/controls')
18
+ end
16
19
  template.thumbnail title: 'Images', onClick: ->(action) do
17
20
  action.windows_open url: json_ui_garage_url(path: 'views/images')
18
21
  end
@@ -5,14 +5,14 @@ json_ui_page json do |page|
5
5
 
6
6
  page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
7
7
 
8
- scroll.h2 text: 'Unordered List'
9
- scroll.spacer height: 6
10
- scroll.panels_ul childViews: ->(ul) do
11
- ul.button text: 'Button', styleClass: 'link', onClick: ->(action) do
12
- action.windows_open url: json_ui_garage_url(path: 'home/blank')
13
- end
14
- ul.label text: 'Label'
15
- end
8
+ # scroll.h2 text: 'Unordered List'
9
+ # scroll.spacer height: 6
10
+ # scroll.panels_ul childViews: ->(ul) do
11
+ # ul.button text: 'Button', styleClass: 'link', onClick: ->(action) do
12
+ # action.windows_open url: json_ui_garage_url(path: 'home/blank')
13
+ # end
14
+ # ul.label text: 'Label'
15
+ # end
16
16
 
17
17
  scroll.spacer height: 20
18
18
  scroll.h2 text: 'Time'
@@ -32,13 +32,4 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
32
32
  ' comes from a line in section 1.10.32.' + "\n\n" +
33
33
  'The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum"'\
34
34
  ' by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.'
35
-
36
- scroll.spacer height: 20
37
- scroll.h2 text: 'Chip'
38
- scroll.spacer height: 6
39
- scroll.chip styleClass: 'success', text: 'pending'
40
- scroll.spacer height: 6
41
- scroll.chip text: 'Skills', onClick: ->(action) do
42
- action.dialogs_alert message: 'Perform action'
43
- end
44
35
  end
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.5.69
4
+ version: 0.5.73
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -146,9 +146,9 @@ files:
146
146
  - app/views/json_ui/garage/forms/generic_post.json.jbuilder
147
147
  - app/views/json_ui/garage/forms/get_request.json.jbuilder
148
148
  - app/views/json_ui/garage/forms/index.json.jbuilder
149
- - app/views/json_ui/garage/forms/misc.json.jbuilder
150
- - app/views/json_ui/garage/forms/misc_two.json.jbuilder
151
149
  - app/views/json_ui/garage/forms/new_rich_text.json.jbuilder
150
+ - app/views/json_ui/garage/forms/online_participant1.json.jbuilder
151
+ - app/views/json_ui/garage/forms/online_participant2.json.jbuilder
152
152
  - app/views/json_ui/garage/forms/pickers.json.jbuilder
153
153
  - app/views/json_ui/garage/forms/ratings.json.jbuilder
154
154
  - app/views/json_ui/garage/forms/rich_text.json.jbuilder
@@ -160,6 +160,7 @@ files:
160
160
  - app/views/json_ui/garage/forms/submission_indicator.json.jbuilder
161
161
  - app/views/json_ui/garage/forms/submission_indicator_post.json.jbuilder
162
162
  - app/views/json_ui/garage/forms/text_validation.json.jbuilder
163
+ - app/views/json_ui/garage/forms/timers.json.jbuilder
163
164
  - app/views/json_ui/garage/home/blank.json.jbuilder
164
165
  - app/views/json_ui/garage/home/index.json.jbuilder
165
166
  - app/views/json_ui/garage/home/slow.json.jbuilder
@@ -196,7 +197,9 @@ files:
196
197
  - app/views/json_ui/garage/panels/outlined.json.jbuilder
197
198
  - app/views/json_ui/garage/panels/responsive.json.jbuilder
198
199
  - app/views/json_ui/garage/panels/split.json.jbuilder
200
+ - app/views/json_ui/garage/panels/ul.json.jbuilder
199
201
  - app/views/json_ui/garage/panels/vertical.json.jbuilder
202
+ - app/views/json_ui/garage/panels/web.json.jbuilder
200
203
  - app/views/json_ui/garage/services/dynamic_text.json.jbuilder
201
204
  - app/views/json_ui/garage/services/image.json.jbuilder
202
205
  - app/views/json_ui/garage/services/index.json.jbuilder
@@ -211,6 +214,7 @@ files:
211
214
  - app/views/json_ui/garage/views/banners.json.jbuilder
212
215
  - app/views/json_ui/garage/views/calendar_data.json.jbuilder
213
216
  - app/views/json_ui/garage/views/charts.json.jbuilder
217
+ - app/views/json_ui/garage/views/controls.json.jbuilder
214
218
  - app/views/json_ui/garage/views/icon_names.json.jbuilder
215
219
  - app/views/json_ui/garage/views/icons.json.jbuilder
216
220
  - app/views/json_ui/garage/views/images.json.jbuilder
@@ -1,71 +0,0 @@
1
- json.title 'Forms'
2
-
3
- page = json_ui_page json
4
- render "#{@path_prefix}/nav_menu", json: json, page: page
5
-
6
- online_channel = 'OnlineChannel'
7
- first_user = User.first
8
-
9
- page.form \
10
- url: json_ui_garage_url(path: 'forms/generic_post'),
11
- method: 'post',
12
- padding: glib_json_padding_body,
13
- childViews: ->(form) do
14
-
15
- form.spacer height: 20
16
- form.h2 text: 'Standard (Backward)'
17
- form.spacer height: 6
18
- form.fields_timer \
19
- name: 'user[timer]',
20
- value: 60,
21
- min: 30
22
-
23
- form.spacer height: 20
24
- form.h2 text: 'Stop Watch (Forward)'
25
- form.spacer height: 6
26
- form.fields_timer \
27
- name: 'user[stop_watch]',
28
- value: 10,
29
- max: 20,
30
- forward: true
31
-
32
- form.spacer height: 20
33
- form.h2 text: 'Reset timer by ActionCable'
34
- online_socket_config = {
35
- channel: online_channel,
36
- filterKey: first_user.id,
37
- params: {
38
- conversation: 2
39
- }
40
- }
41
-
42
- form.fields_timer \
43
- actionCable: online_socket_config,
44
- name: 'user[online_timer]',
45
- value: 10
46
-
47
- form.label \
48
- text: 'Participant is online',
49
- showIf: {
50
- ">": [
51
- {
52
- "var": 'user[online_timer]'
53
- },
54
- 0
55
- ]
56
- }
57
-
58
- form.label \
59
- text: 'Participant is offline',
60
- showIf: {
61
- "<=": [
62
- {
63
- "var": 'user[online_timer]'
64
- },
65
- 0
66
- ]
67
- }
68
-
69
- form.spacer height: 20
70
- form.fields_submit text: 'Submit'
71
- end