glib-web 4.1.2 → 4.1.3

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: 59ce4822a2cbafa2933d7bf884df8eb63af65ebcd4046e4484a652fda583b5c6
4
+ data.tar.gz: f652bfbdb23e198af85cd46f0afef1f753da089a196ff18a13c4cbc57bf834b2
5
5
  SHA512:
6
- metadata.gz: 8bb4e390bb6058cfa4e262ca6da33770fe934508865790a08cfb42425603e3480ccc928f92ed81493fae82a953a15946f68231310a9983cfa42446361f8d56a7
7
- data.tar.gz: c62be0278b0a8f13005d250ffe06beb52cae2fc500eee818995209c8acde78174fc00b449a126ef37eae5f0336be611dbbbcbd4cdf7a0aa7359b7afdcd419bcb
6
+ metadata.gz: ed0d06a31f63ab5fe4deffdf1995f1a673d751595da56fbbc2e1e8b3e3c55d7466957945cbf17f6aa78f094130480ea9c41d29c092b17f45aa6f4c5b90df60e5
7
+ data.tar.gz: 3ffb43696bb3c525282eead1ecd4232078acddc578091d056964b3c774e35e4c3be464a0ddb2230176a08d1a4578c53118d1cfe61893c6f802133d8cceecd7f2
@@ -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,112 @@
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'
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_horizontal 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
+ end
46
+
47
+ form.spacer height: 8
48
+ form.hr width: 'matchParent'
49
+ form.spacer height: 8
50
+
51
+ validation = { required: { message: 'Required' } }
52
+ options = ['option1', 'option2', 'option3', 'option4'].map { |option| { 'text'=> option.humanize, 'value' => option } }
53
+
54
+ form.fields_date width: 'matchParent', name: 'user[date]', id: 'date', value: Date.new(2024, 7, 24), validation: validation
55
+ form.hr width: 'matchParent'
56
+ form.fields_select multiple: true, width: 'matchParent', name: 'user[select]', id: 'select', options: options, value: ['option1', 'option2'], validation: validation
57
+ form.hr width: 'matchParent'
58
+ form.fields_chipGroup width: 'matchParent', name: 'user[chip_group]', id: 'chip_group', options: options, value: ['option2'], validation: validation
59
+ form.hr width: 'matchParent'
60
+ form.fields_radioGroup width: 'matchParent', name: 'user[radio_group]', id: 'radio_group', value: 'option3', validation: validation, childViews: ->(radio) do
61
+ options.each do |option|
62
+ radio.fields_radio label: option['text'], value: option['value']
63
+ end
64
+ end
65
+ form.hr width: 'matchParent'
66
+ check_group_value = ['option3', 'option1']
67
+ form.fields_checkGroup width: 'matchParent', name: 'user[check_group]', id: 'check_group', value: check_group_value, validation: validation, childViews: ->(radio) do
68
+ options.each do |option|
69
+ radio.fields_check label: option['text'], value: check_group_value.include?(option['value']) ? option['value'] : nil, checkValue: option['value']
70
+ end
71
+ end
72
+ form.hr width: 'matchParent'
73
+ form.fields_text width: 'matchParent', name: 'user[text]', id: 'text', value: 'John Doe', validation: validation
74
+
75
+ form.hr width: 'matchParent'
76
+
77
+ form.fields_textarea width: 'matchParent', name: 'user[textarea]', id: 'textarea', value: 'Lorem ipsum et dumet bla bla bla...'
78
+
79
+ form.hr width: 'matchParent'
80
+ form.fields_submit text: 'submit'
81
+ form.spacer height: 2
82
+ form.fields_submit text: 'submit (if form valid)', disableIfFormInvalid: true
83
+ end
84
+
85
+
86
+ res.spacer height: 16
87
+
88
+ end
89
+
90
+
91
+ res.panels_column lg: { cols: 6 }, childViews: ->(col) do
92
+ res.h2 text: 'Dialog'
93
+ res.spacer height: 8
94
+ res.button text: 'Dialog updateExisting', onClick: ->(action) do
95
+ action.runMultiple childActions: ->(saction) do
96
+ saction.dialogs_show updateExisting: true, content: ->(dialog) do
97
+ dialog.body padding: glib_json_padding_body, childViews: ->(sbody) do
98
+ sbody.h1 text: 'Hello world'
99
+ sbody.button text: 'change dialog content', onClick: ->(ssaction) do
100
+ ssaction.dialogs_show updateExisting: true, disableCloseButton: true, content: ->(sdialog) do
101
+ sdialog.body padding: glib_json_padding_body, childViews: ->(ssbody) do
102
+ ssbody.h1 text: 'Hello world (updated)'
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
110
+ end
111
+ end
112
+ 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.3
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