glib-web 4.1.2 → 4.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bbf47486dbe68678b731438238a642383682ac7fa2b5fd85c40784a46dd8b05e
4
- data.tar.gz: 48745d3666ada734c838020fc10828187d22c0d06b8f95ad8d45b942ad922518
3
+ metadata.gz: d36f47f5f0236550243e1344d2bdee89559141b549575142afbd1ea5a13464d1
4
+ data.tar.gz: c772a7b58eb06904c442d220a7eae112eaeb5416774a8db28623caa770ec95e5
5
5
  SHA512:
6
- metadata.gz: 8bb4e390bb6058cfa4e262ca6da33770fe934508865790a08cfb42425603e3480ccc928f92ed81493fae82a953a15946f68231310a9983cfa42446361f8d56a7
7
- data.tar.gz: c62be0278b0a8f13005d250ffe06beb52cae2fc500eee818995209c8acde78174fc00b449a126ef37eae5f0336be611dbbbcbd4cdf7a0aa7359b7afdcd419bcb
6
+ metadata.gz: 176d31f10a75945b693d0e0f26497d19a95ee63863d9cf585004cfe4b9011c64d5908ee622b3a0a83dd01b3a7d4c8babee9cd84af5c2ec3315aaac8e860dc536
7
+ data.tar.gz: e75efdc5c2b79a11c380d3905cb2d8d495c74cb01c88264dc0b362c0393007037d3bb814af0bb70ec0c82ce6779db51ca9ecd2be2f7ebb79a2880636645508ae
@@ -257,6 +257,10 @@ class Glib::JsonUi::ViewBuilder
257
257
  action :onClick
258
258
  string :offIcon
259
259
  string :onIcon
260
+ string :imageUrl
261
+ string :icon
262
+ string :iconColor
263
+ string :iconSize
260
264
 
261
265
  views :childViews
262
266
  end
@@ -10,7 +10,7 @@ end
10
10
 
11
11
 
12
12
  if local_assigns[:top_nav] || json_ui_app_is_web?
13
- page.leftDrawer styleClasses:['maxi'], content: ->(drawer) do
13
+ page.leftDrawer styleClasses: ['maxi'], content: ->(drawer) do
14
14
  drawer.header childViews: ->(header) do
15
15
  header.button text: 'App', styleClasses: ['link', 'logo'], onClick: ->(action) do
16
16
  action.windows_open url: root_url
@@ -51,6 +51,10 @@ if local_assigns[:top_nav] || json_ui_app_is_web?
51
51
  action.windows_open url: json_ui_garage_url(path: 'services/index')
52
52
  end
53
53
 
54
+ menu.button text: 'Test Page', onClick: ->(action) do
55
+ action.windows_open url: json_ui_garage_url(path: 'test_page/index')
56
+ end
57
+
54
58
  menu.divider
55
59
  menu.label text: 'Misc Menu'
56
60
 
@@ -106,8 +106,8 @@ page.form \
106
106
  end
107
107
  end,
108
108
  childViews: ->(group) do
109
- group.fields_radio value: 'show', label: 'Show'
110
- group.fields_radio value: 'hide', label: 'Hide'
109
+ group.fields_radio value: 'show', label: 'Show', icon: 'edit', iconSize: 40
110
+ group.fields_radio value: 'hide', label: 'Hide', imageUrl: 'https://cdn.pixabay.com/photo/2020/08/05/13/12/eco-5465432_1280.png'
111
111
  group.fields_radio value: '', label: 'Empty'
112
112
  end
113
113
  form.spacer height: 10
@@ -0,0 +1,120 @@
1
+ json.title 'Test Page'
2
+
3
+ page = json_ui_page json
4
+
5
+ page.body childViews: ->(body) do
6
+ body.panels_responsive padding: glib_json_padding_body, childViews: ->(res) do
7
+ res.panels_column lg: { cols: 6 }, childViews: ->(col) do
8
+ res.h2 text: 'Reactivity & validation'
9
+ res.spacer height: 8
10
+ res.panels_form \
11
+ url: json_ui_garage_url(path: 'forms/generic_post'),
12
+ method: 'post',
13
+ childViews: ->(form) do
14
+ form.panels_flow innerPadding: { bottom: 0 }, width: 'matchParent', childViews: ->(hori) do
15
+ hori.button text: 'components/set', onClick: ->(action) do
16
+ action.runMultiple childActions: ->(saction) do
17
+ saction.components_set targetId: 'text', data: { value: 'Doe John' }
18
+ saction.components_set targetId: 'textarea', data: { value: 'The quick brown fox jumps over the lazy dog' }
19
+ new_options = [{ text: 'Option99', value: 'option99' }]
20
+ ['select', 'chip_group'].each do |id|
21
+ saction.components_set targetId: id, data: { options: new_options, value: ['option99'] }
22
+ end
23
+ end
24
+ end
25
+ hori.spacer width: 4
26
+ hori.button text: 'logics/set', onClick: ->(action) do
27
+ action.logics_set targetId: 'date', conditionalData: { value: { "+": [{ "var": ['user[date]'] }, 60 * 60 * 24 * 3] } }
28
+ end
29
+ hori.spacer width: 4
30
+ hori.button text: 'components/replace', onClick: ->(action) do
31
+ action.runMultiple childActions: ->(saction) do
32
+ saction.components_replace targetId: 'radio_group', newView: ->(view) do
33
+ view.fields_radioGroup value: '', childViews: ->(sview) do
34
+ sview.fields_radio label: 'Option99', value: 'option99'
35
+ end
36
+ end
37
+
38
+ saction.components_replace targetId: 'check_group', newView: ->(view) do
39
+ view.fields_checkGroup value: '', childViews: ->(sview) do
40
+ sview.fields_check label: 'Option99', value: nil, checkValue: 'option99'
41
+ end
42
+ end
43
+ end
44
+ end
45
+ hori.spacer width: 4
46
+ hori.button text: 'hide select', onClick: ->(action) do
47
+ action.components_set targetId: 'select', data: { displayed: false }
48
+ end
49
+ end
50
+
51
+ form.spacer height: 8
52
+ form.hr width: 'matchParent'
53
+ form.spacer height: 8
54
+
55
+ validation = { required: { message: 'Required' } }
56
+ options = ['option1', 'option2', 'option3', 'option4'].map { |option| { 'text'=> option.humanize, 'value' => option } }
57
+
58
+ form.fields_date width: 'matchParent', name: 'user[date]', id: 'date', value: Date.new(2024, 7, 24), validation: validation
59
+ form.hr width: 'matchParent'
60
+ form.fields_select multiple: true, width: 'matchParent', name: 'user[select][]', id: 'select', options: options, value: ['option1', 'option2'], validation: validation
61
+ form.hr width: 'matchParent'
62
+ form.fields_chipGroup width: 'matchParent', name: 'user[chip_group]', id: 'chip_group', options: options, value: ['option2'], validation: validation
63
+ form.hr width: 'matchParent'
64
+ form.fields_radioGroup width: 'matchParent', name: 'user[radio_group]', id: 'radio_group', value: 'option3', validation: validation, childViews: ->(radio) do
65
+ options.each do |option|
66
+ radio.fields_radio label: option['text'], value: option['value']
67
+ end
68
+ end
69
+ form.hr width: 'matchParent'
70
+ check_group_value = ['option3', 'option1']
71
+ form.fields_checkGroup width: 'matchParent', name: 'user[check_group]', id: 'check_group', value: check_group_value, validation: validation, childViews: ->(radio) do
72
+ options.each do |option|
73
+ radio.fields_check label: option['text'], checkValue: option['value']
74
+ end
75
+ end
76
+ form.hr width: 'matchParent'
77
+ form.fields_text width: 'matchParent', name: 'user[text]', id: 'text', value: 'John Doe', validation: validation
78
+
79
+ form.hr width: 'matchParent'
80
+
81
+ form.fields_textarea width: 'matchParent', name: 'user[textarea]', id: 'textarea', value: 'Lorem ipsum et dumet bla bla bla...'
82
+
83
+ form.hr width: 'matchParent'
84
+ form.fields_submit text: 'submit'
85
+ form.spacer height: 2
86
+ form.fields_submit text: 'submit (if form valid)', disableIfFormInvalid: true
87
+ end
88
+
89
+
90
+ res.spacer height: 16
91
+
92
+ end
93
+
94
+
95
+ res.panels_column lg: { cols: 6 }, childViews: ->(col) do
96
+ res.h2 text: 'Dialog'
97
+ res.spacer height: 8
98
+ res.button text: 'Dialog updateExisting', onClick: ->(action) do
99
+ action.runMultiple childActions: ->(saction) do
100
+ saction.dialogs_show updateExisting: true, content: ->(dialog) do
101
+ dialog.body padding: glib_json_padding_body, childViews: ->(sbody) do
102
+ sbody.h1 text: 'Hello world'
103
+ sbody.button text: 'change dialog content', onClick: ->(ssaction) do
104
+ ssaction.dialogs_show updateExisting: true, disableCloseButton: true, content: ->(sdialog) do
105
+ sdialog.body padding: glib_json_padding_body, childViews: ->(ssbody) do
106
+ ssbody.h1 text: 'Hello world (updated)'
107
+ ssbody.spacer height: 8
108
+ ssbody.button text: 'close', onClick: ->(xaction) do
109
+ xaction.dialogs_close
110
+ end
111
+ end
112
+ end
113
+ end
114
+ end
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end
120
+ 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: 4.1.2
4
+ version: 4.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -271,6 +271,7 @@ files:
271
271
  - app/views/json_ui/garage/tables/index.json.jbuilder
272
272
  - app/views/json_ui/garage/tables/layout.json.jbuilder
273
273
  - app/views/json_ui/garage/tables/panel_content.json.jbuilder
274
+ - app/views/json_ui/garage/test_page/index.json.jbuilder
274
275
  - app/views/json_ui/garage/views/_chart_data.json.jbuilder
275
276
  - app/views/json_ui/garage/views/banners.json.jbuilder
276
277
  - app/views/json_ui/garage/views/calendar_data.json.jbuilder