glib-web 0.5.68 → 0.5.72

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: a3ea43fdde7d1ab15242e1f8d47072c954b9523061a9c2424d10b54ec768ae5e
4
- data.tar.gz: a601ac954542c5f4cf13ca04b92b6da1b758862d1e69d83449b12ce03ad1a3b3
3
+ metadata.gz: 1e3001e9079ccbaddf587e2c9e250583aaf43023f7e5e9a5e6e3414942218491
4
+ data.tar.gz: e7cf33f501702156519eace2e073f3710915b2c76601eceed3a2b8f9d0b48a08
5
5
  SHA512:
6
- metadata.gz: e45ff332882a5526ea0f4d56d940f5f703affdf0a6f0b5648fa207406490d665a3675a7f70d6ef6a37260d41606e032aa069bf7ef9c4fb9b828cdd3892acc3a4
7
- data.tar.gz: 3b8e3e37cf5f24082a4e3423ee96cc4936f839b9bdbbdc541d4008bc00aeee63ef1ce6766a1e18747aa83a52644520ff4fcde62d800e713b46412d9cb533c1fb
6
+ metadata.gz: 5d2f35e52eb74adc79c3427c65f8bd16d78ce0bf2806a29ec47a092ca5bf0ce81a3c4b9af6f94c36ca87c032c0fd83a0d37cd6ed3e9cdb228fb875c8050a91a3
7
+ data.tar.gz: 4ad64336279bf03dacf046c21cda48b0215aecad68563dc52934edb092fcd8d91aba7f8ea146a859a1aa33afce6627e319db2a58502a0a350cc1bb973df1c10e
@@ -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.68
4
+ version: 0.5.72
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