glib-web 3.28.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/concerns/glib/json/libs.rb +4 -4
- data/app/helpers/glib/json_ui/abstract_builder.rb +0 -8
- data/app/helpers/glib/json_ui/action_builder/components.rb +0 -5
- data/app/helpers/glib/json_ui/action_builder/dialogs.rb +0 -23
- data/app/helpers/glib/json_ui/action_builder/logics.rb +11 -0
- data/app/helpers/glib/json_ui/action_builder/popovers.rb +0 -9
- data/app/helpers/glib/json_ui/action_builder/windows.rb +1 -5
- data/app/helpers/glib/json_ui/action_builder.rb +0 -24
- data/app/helpers/glib/json_ui/builder/mouse_events.rb +0 -7
- data/app/helpers/glib/json_ui/default.rb +4 -4
- data/app/helpers/glib/json_ui/list_builders.rb +0 -3
- data/app/helpers/glib/json_ui/page_helper.rb +7 -1
- data/app/helpers/glib/json_ui/view_builder/fields.rb +7 -38
- data/app/helpers/glib/json_ui/view_builder/panels.rb +1 -0
- data/app/helpers/glib/json_ui/view_builder.rb +3 -14
- data/app/policies/glib/application_policy.rb +0 -6
- data/app/views/json_ui/garage/actions/_components.json.jbuilder +2 -6
- data/app/views/json_ui/garage/actions/_dialogs.json.jbuilder +0 -14
- data/app/views/json_ui/garage/actions/_reload.json.jbuilder +1 -1
- data/app/views/json_ui/garage/actions/partial_update.json.jbuilder +1 -1
- data/app/views/json_ui/garage/forms/_alert_post_data.json.jbuilder +1 -3
- data/app/views/json_ui/garage/forms/_partial_update_execute.json.jbuilder +1 -1
- data/app/views/json_ui/garage/forms/_read_more_text.json.jbuilder +27 -20
- data/app/views/json_ui/garage/forms/conditional_value.json.jbuilder +49 -68
- data/app/views/json_ui/garage/forms/dirty_prompt.json.jbuilder +0 -28
- data/app/views/json_ui/garage/forms/file_upload.json.jbuilder +1 -3
- data/app/views/json_ui/garage/forms/otp_field.json.jbuilder +11 -9
- data/app/views/json_ui/garage/forms/rich_text_preview.json.jbuilder +0 -1
- data/app/views/json_ui/garage/forms/selects.json.jbuilder +17 -24
- data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +317 -271
- data/app/views/json_ui/garage/forms/timers.json.jbuilder +0 -90
- data/app/views/json_ui/garage/notifications/action_cable.json.jbuilder +3 -3
- data/app/views/json_ui/garage/pages/lifecycle_hooks.json.jbuilder +4 -0
- data/app/views/json_ui/garage/views/{components_update.json.jbuilder → components_replace.json.jbuilder} +6 -6
- data/app/views/json_ui/garage/views/controls.json.jbuilder +0 -32
- data/lib/glib/test_helpers.rb +2 -0
- metadata +3 -2
@@ -3,9 +3,6 @@ json.title 'Forms'
|
|
3
3
|
page = json_ui_page json
|
4
4
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
5
|
|
6
|
-
online_channel = 'OnlineChannel'
|
7
|
-
first_user = User.first
|
8
|
-
second_user = User.second
|
9
6
|
|
10
7
|
page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
|
11
8
|
form.spacer height: 20
|
@@ -26,8 +23,6 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
|
|
26
23
|
|
27
24
|
form.spacer height: 6
|
28
25
|
form.fields_timer name: 'user[days_timer2]', value: 10.seconds.from_now, styleClasses: ['days']
|
29
|
-
form.spacer height: 6
|
30
|
-
form.p text: '🏁 Finished!', showIf: { "<=": [{ "var": "user[days_timer2]" }, '0'] }
|
31
26
|
|
32
27
|
form.spacer height: 20
|
33
28
|
form.h2 text: 'Stop Watch (Forward)'
|
@@ -41,91 +36,6 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
|
|
41
36
|
max: 20,
|
42
37
|
forward: true
|
43
38
|
|
44
|
-
form.spacer height: 20
|
45
|
-
form.h2 text: 'Reset timer by ActionCable'
|
46
|
-
online_participant1_config = {
|
47
|
-
channel: online_channel,
|
48
|
-
filterKey: first_user.id
|
49
|
-
}
|
50
|
-
|
51
|
-
|
52
|
-
form.fields_timer \
|
53
|
-
width: 120,
|
54
|
-
actionCable: online_participant1_config,
|
55
|
-
name: 'user[online_timer1]',
|
56
|
-
value: 3,
|
57
|
-
min: 0
|
58
|
-
|
59
|
-
form.label \
|
60
|
-
text: 'Participant One is online',
|
61
|
-
color: glib_color_success,
|
62
|
-
showIf: {
|
63
|
-
">": [
|
64
|
-
{
|
65
|
-
"var": 'user[online_timer1]'
|
66
|
-
},
|
67
|
-
0
|
68
|
-
]
|
69
|
-
}
|
70
|
-
|
71
|
-
form.label \
|
72
|
-
text: 'Participant One is offline',
|
73
|
-
color: glib_color_error,
|
74
|
-
showIf: {
|
75
|
-
"<=": [
|
76
|
-
{
|
77
|
-
"var": 'user[online_timer1]'
|
78
|
-
},
|
79
|
-
0
|
80
|
-
]
|
81
|
-
}
|
82
|
-
|
83
|
-
form.spacer height: 10
|
84
|
-
form.label text: 'Open Participant One', onClick: ->(action) do
|
85
|
-
action.windows_openWeb url: json_ui_garage_url(path: 'forms/online_participant1')
|
86
|
-
end
|
87
|
-
form.spacer height: 20
|
88
|
-
|
89
|
-
online_participant2_config = {
|
90
|
-
channel: online_channel,
|
91
|
-
filterKey: second_user.id
|
92
|
-
}
|
93
|
-
form.fields_timer \
|
94
|
-
width: 120,
|
95
|
-
actionCable: online_participant2_config,
|
96
|
-
name: 'user[online_timer2]',
|
97
|
-
value: 3,
|
98
|
-
min: 0
|
99
|
-
|
100
|
-
form.label \
|
101
|
-
text: 'Participant Two is online',
|
102
|
-
color: glib_color_success,
|
103
|
-
showIf: {
|
104
|
-
">": [
|
105
|
-
{
|
106
|
-
"var": 'user[online_timer2]'
|
107
|
-
},
|
108
|
-
0
|
109
|
-
]
|
110
|
-
}
|
111
|
-
|
112
|
-
form.label \
|
113
|
-
text: 'Participant Two is offline',
|
114
|
-
color: glib_color_error,
|
115
|
-
showIf: {
|
116
|
-
"<=": [
|
117
|
-
{
|
118
|
-
"var": 'user[online_timer2]'
|
119
|
-
},
|
120
|
-
0
|
121
|
-
]
|
122
|
-
}
|
123
|
-
|
124
|
-
form.spacer height: 10
|
125
|
-
form.label text: 'Open Participant Two', onClick: ->(action) do
|
126
|
-
action.windows_openWeb url: json_ui_garage_url(path: 'forms/online_participant2')
|
127
|
-
end
|
128
|
-
|
129
39
|
form.spacer height: 40
|
130
40
|
form.fields_submit text: 'Submit'
|
131
41
|
end
|
@@ -19,17 +19,17 @@ if room.present?
|
|
19
19
|
}
|
20
20
|
],
|
21
21
|
onOpen: ->(action) do
|
22
|
-
action.
|
22
|
+
action.components_replace targetId: 'label-1', newView: ->(view) do
|
23
23
|
view.p text: "Room ##{room.upcase}"
|
24
24
|
end
|
25
25
|
end,
|
26
26
|
onClose: ->(action) do
|
27
|
-
action.
|
27
|
+
action.components_replace targetId: 'label-1', newView: ->(view) do
|
28
28
|
view.p text: "Room ##{room.upcase} (OFF)"
|
29
29
|
end
|
30
30
|
end,
|
31
31
|
onError: ->(action) do
|
32
|
-
action.
|
32
|
+
action.components_replace targetId: 'label-1', newView: ->(view) do
|
33
33
|
view.p text: "Room ##{room.upcase} (ERROR)"
|
34
34
|
end
|
35
35
|
end
|
@@ -8,6 +8,10 @@ page.on load: ->(action) do
|
|
8
8
|
action.dialogs_alert message: 'This is an onLoad action'
|
9
9
|
end
|
10
10
|
|
11
|
+
page.on unload: ->(action) do
|
12
|
+
action.dialogs_alert message: 'This is an onUnload action'
|
13
|
+
end
|
14
|
+
|
11
15
|
page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
12
16
|
scroll.label text: 'A dialog should appear automatically.'
|
13
17
|
end
|
@@ -30,7 +30,7 @@ page.body padding: glib_json_padding_body, childViews: ->(body) do
|
|
30
30
|
hori.button text: 'change bgcolor', onClick: ->(action) do
|
31
31
|
action.runMultiple childActions: ->(saction) do
|
32
32
|
comp_ids.each do |id, method|
|
33
|
-
saction.
|
33
|
+
saction.components_replace targetId: id, newView: ->(view) do
|
34
34
|
if id == 'pflow'
|
35
35
|
view.public_send(method, { backgroundColor: '#00FFFF', innerPadding: { bottom: 0 } })
|
36
36
|
else
|
@@ -43,23 +43,23 @@ page.body padding: glib_json_padding_body, childViews: ->(body) do
|
|
43
43
|
|
44
44
|
hori.button text: 'change text (p & label)', onClick: ->(action) do
|
45
45
|
action.runMultiple childActions: ->(saction) do
|
46
|
-
saction.
|
46
|
+
saction.components_replace targetId: 'paragraph', newView: ->(view) do
|
47
47
|
view.p text: 'changed!'
|
48
48
|
end
|
49
|
-
saction.
|
49
|
+
saction.components_replace targetId: 'label', newView: ->(view) do
|
50
50
|
view.label text: 'changed!'
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
hori.button text: 'Change fields text', onClick: ->(action) do
|
56
|
-
action.
|
56
|
+
action.components_replace targetId: 'inp-text', newView: ->(view) do
|
57
57
|
view.fields_text name: 'user[city]', value: 'Jakarta', placeholder: 'City', label: 'City'
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
hori.button text: 'Change fields select', onClick: ->(action) do
|
62
|
-
action.
|
62
|
+
action.components_replace targetId: 'inp-select', newView: ->(view) do
|
63
63
|
view.fields_select options: cities + [{ text: 'Taipei', value: 'taipei' }]
|
64
64
|
end
|
65
65
|
end
|
@@ -71,7 +71,7 @@ page.body padding: glib_json_padding_body, childViews: ->(body) do
|
|
71
71
|
hori.button text: 'Add child to panel', onClick: ->(action) do
|
72
72
|
action.runMultiple childActions: ->(saction) do
|
73
73
|
panels_ids.each do |id, method|
|
74
|
-
saction.
|
74
|
+
saction.components_replace targetId: id, newView: ->(view) do
|
75
75
|
props = {
|
76
76
|
childViews: ->(sview) do
|
77
77
|
sview.label text: method
|
@@ -31,22 +31,6 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
|
31
31
|
|
32
32
|
scroll.spacer height: 10
|
33
33
|
scroll.button text: 'Button with dropdown', onClick: ->(action) do
|
34
|
-
# action.popovers_open \
|
35
|
-
# key: 'menu',
|
36
|
-
# placement: 'left',
|
37
|
-
# childViews: ->(view) do
|
38
|
-
# view.panels_responsive styleClass: 'popover-menu', width: 200, childViews: ->(res) do
|
39
|
-
# res.label text: 'Item 1', styleClass: 'popover-menu-item', onClick: ->(saction) do
|
40
|
-
# saction.popovers_close key: 'menu'
|
41
|
-
# end
|
42
|
-
# res.label text: 'Item 2', styleClass: 'popover-menu-item', onClick: ->(saction) do
|
43
|
-
# saction.popovers_close key: 'menu'
|
44
|
-
# end
|
45
|
-
# res.label text: 'Item 3', styleClass: 'popover-menu-item', onClick: ->(saction) do
|
46
|
-
# saction.popovers_close key: 'menu'
|
47
|
-
# end
|
48
|
-
# end
|
49
|
-
# end
|
50
34
|
|
51
35
|
action.popovers_show \
|
52
36
|
key: 'menu',
|
@@ -73,22 +57,6 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
|
73
57
|
text: 'Button with tooltip and dropdown',
|
74
58
|
tooltip: { text: 'Tooltip 1' },
|
75
59
|
onClick: ->(action) do
|
76
|
-
# action.popovers_open \
|
77
|
-
# key: 'menu',
|
78
|
-
# placement: 'bottom-start',
|
79
|
-
# styleClass: 'popover-menu',
|
80
|
-
# width: 200,
|
81
|
-
# childViews: ->(res) do
|
82
|
-
# res.label text: 'Item 1', styleClass: 'popover-menu-item', onClick: ->(saction) do
|
83
|
-
# saction.popovers_close key: 'menu'
|
84
|
-
# end
|
85
|
-
# res.label text: 'Item 2', styleClass: 'popover-menu-item', onClick: ->(saction) do
|
86
|
-
# saction.popovers_close key: 'menu'
|
87
|
-
# end
|
88
|
-
# res.label text: 'Item 3 with very very very very very long name', styleClass: 'popover-menu-item', onClick: ->(saction) do
|
89
|
-
# saction.popovers_close key: 'menu'
|
90
|
-
# end
|
91
|
-
# end
|
92
60
|
|
93
61
|
action.popovers_show \
|
94
62
|
key: 'menu',
|
data/lib/glib/test_helpers.rb
CHANGED
@@ -20,7 +20,9 @@ module Glib
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
# See https://stackoverflow.com/questions/51583321/it-is-safe-to-use-lvh-me-instead-of-localhost-for-testing
|
23
24
|
HOST = 'www.lvh.me:3000'
|
25
|
+
|
24
26
|
# LOG_DIR = File.expand_path(
|
25
27
|
# File.join(File.dirname(__FILE__), 'integration/json_ui_crawler_test_results')
|
26
28
|
# )
|
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
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- app/helpers/glib/json_ui/action_builder/global_states.rb
|
104
104
|
- app/helpers/glib/json_ui/action_builder/http.rb
|
105
105
|
- app/helpers/glib/json_ui/action_builder/iap.rb
|
106
|
+
- app/helpers/glib/json_ui/action_builder/logics.rb
|
106
107
|
- app/helpers/glib/json_ui/action_builder/panels.rb
|
107
108
|
- app/helpers/glib/json_ui/action_builder/popovers.rb
|
108
109
|
- app/helpers/glib/json_ui/action_builder/sheets.rb
|
@@ -274,8 +275,8 @@ files:
|
|
274
275
|
- app/views/json_ui/garage/views/banners.json.jbuilder
|
275
276
|
- app/views/json_ui/garage/views/calendar_data.json.jbuilder
|
276
277
|
- app/views/json_ui/garage/views/charts.json.jbuilder
|
278
|
+
- app/views/json_ui/garage/views/components_replace.json.jbuilder
|
277
279
|
- app/views/json_ui/garage/views/components_set.json.jbuilder
|
278
|
-
- app/views/json_ui/garage/views/components_update.json.jbuilder
|
279
280
|
- app/views/json_ui/garage/views/controls.json.jbuilder
|
280
281
|
- app/views/json_ui/garage/views/fields_focus.json.jbuilder
|
281
282
|
- app/views/json_ui/garage/views/iap.json.jbuilder
|