glib-web 0.5.28 → 0.5.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/glib/json_ui/action_builder.rb +3 -0
- data/app/helpers/glib/json_ui/action_builder/http.rb +28 -8
- data/app/helpers/glib/json_ui/list_builders.rb +1 -0
- data/app/helpers/glib/json_ui/view_builder/fields.rb +15 -6
- data/app/helpers/glib/json_ui/view_builder/panels.rb +3 -1
- data/app/views/json_ui/garage/actions/_http.json.jbuilder +1 -1
- data/app/views/json_ui/garage/forms/styled_boxes.json.jbuilder +9 -8
- data/app/views/json_ui/garage/lists/chat_ui.json.jbuilder +2 -21
- data/app/views/json_ui/garage/notifications/web_socket.json.jbuilder +3 -3
- data/lib/glib/json_crawler/router.rb +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b59fad27046de460148c8944bc780f516a85783e9226c694e0f31e83970194ad
|
4
|
+
data.tar.gz: e4d9cf6b52c361f41ea114fefd6fef9d1726af5231c8beb21a385063a02474f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '052297f7cbf48213322253214e9bacebad001e58c39168cf0825ac006e9bc72a12218dab6b1901ce7f3562ca002639e272d1b6ea94414b66940aaaab060f2b10'
|
7
|
+
data.tar.gz: 6c95b179be6b8ace6c0204e030edbc6f598e10a16073d3f75fb82be45365f2f01da44c468f1b362ce9b76c405b3dc81f5879e36a3741963da8f92f447f49269b
|
@@ -1,18 +1,38 @@
|
|
1
1
|
class Glib::JsonUi::ActionBuilder
|
2
2
|
module Http
|
3
|
-
class
|
3
|
+
class AbstractHttp < Action
|
4
4
|
string :url, cache: true
|
5
|
-
|
5
|
+
|
6
|
+
def formData(hash)
|
7
|
+
form_data = {}
|
8
|
+
hash.each do |key, value|
|
9
|
+
flatten_nested_params(form_data, key, value)
|
10
|
+
end
|
11
|
+
json.formData form_data
|
12
|
+
end
|
13
|
+
|
14
|
+
def flatten_nested_params(form_data, key, value)
|
15
|
+
if value.is_a?(Hash)
|
16
|
+
value.each do |nested_key, nested_value|
|
17
|
+
flatten_nested_params(form_data, "#{key}[#{nested_key}]", nested_value)
|
18
|
+
end
|
19
|
+
else
|
20
|
+
form_data[key] = value
|
21
|
+
end
|
22
|
+
end
|
6
23
|
end
|
7
24
|
|
8
|
-
class
|
9
|
-
string :url, cache: true
|
10
|
-
hash :formData
|
25
|
+
class Post < AbstractHttp
|
11
26
|
end
|
12
27
|
|
13
|
-
class
|
14
|
-
string :url, cache: true
|
15
|
-
hash :formData
|
28
|
+
class Patch < AbstractHttp
|
29
|
+
# string :url, cache: true
|
30
|
+
# hash :formData
|
31
|
+
end
|
32
|
+
|
33
|
+
class Delete < AbstractHttp
|
34
|
+
# string :url, cache: true
|
35
|
+
# hash :formData
|
16
36
|
end
|
17
37
|
|
18
38
|
end
|
@@ -2,6 +2,7 @@ class Glib::JsonUi::ViewBuilder
|
|
2
2
|
module Fields
|
3
3
|
|
4
4
|
class AbstractField < View
|
5
|
+
bool :readOnly
|
5
6
|
hash :validation
|
6
7
|
|
7
8
|
def label(label)
|
@@ -68,7 +69,6 @@ class Glib::JsonUi::ViewBuilder
|
|
68
69
|
|
69
70
|
class Text < AbstractField
|
70
71
|
int :maxLength
|
71
|
-
bool :readOnly
|
72
72
|
end
|
73
73
|
|
74
74
|
class Number < Text
|
@@ -130,7 +130,7 @@ class Glib::JsonUi::ViewBuilder
|
|
130
130
|
|
131
131
|
class Select < AbstractField
|
132
132
|
array :options
|
133
|
-
bool :readOnly
|
133
|
+
# bool :readOnly
|
134
134
|
bool :multiple, cache: true
|
135
135
|
# bool :manualEntry
|
136
136
|
hash :append
|
@@ -138,7 +138,7 @@ class Glib::JsonUi::ViewBuilder
|
|
138
138
|
|
139
139
|
class Autocomplete < AbstractField
|
140
140
|
array :options
|
141
|
-
bool :readOnly
|
141
|
+
# bool :readOnly
|
142
142
|
bool :multiple, cache: true
|
143
143
|
# bool :manualEntry
|
144
144
|
hash :append
|
@@ -164,11 +164,17 @@ class Glib::JsonUi::ViewBuilder
|
|
164
164
|
# views :groupTemplateViews
|
165
165
|
end
|
166
166
|
|
167
|
-
class RadioGroup <
|
168
|
-
string :name
|
169
|
-
string :value
|
167
|
+
class RadioGroup < AbstractField
|
168
|
+
# string :name
|
169
|
+
# string :value
|
170
170
|
views :childViews
|
171
171
|
|
172
|
+
# Override
|
173
|
+
def value(value)
|
174
|
+
# Convert to string to make sure the value matches with Radio#value
|
175
|
+
@value = value.to_s if value != Glib::Value::DEFAULT
|
176
|
+
end
|
177
|
+
|
172
178
|
string :iconOfBeforeSelected
|
173
179
|
string :iconOfSelected
|
174
180
|
string :iconOfAfterSelected
|
@@ -217,5 +223,8 @@ class Glib::JsonUi::ViewBuilder
|
|
217
223
|
string :publicKey
|
218
224
|
end
|
219
225
|
|
226
|
+
class CreditCard < AbstractField
|
227
|
+
string :publicKey
|
228
|
+
end
|
220
229
|
end
|
221
230
|
end
|
@@ -6,7 +6,7 @@ end
|
|
6
6
|
section.rows builder: ->(template) do
|
7
7
|
template.thumbnail title: 'http/post', onClick: ->(action) do
|
8
8
|
action.auth_saveCsrfToken token: form_authenticity_token, onSave: ->(subaction) do
|
9
|
-
subaction.http_post url: json_ui_garage_url(path: 'forms/basic_post'), formData: {
|
9
|
+
subaction.http_post url: json_ui_garage_url(path: 'forms/basic_post'), formData: { user: { name: { first: 'New', last: 'Joe' } } }
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -12,21 +12,22 @@ json_ui_page json do |page|
|
|
12
12
|
form.spacer height: 14
|
13
13
|
form.fields_textarea name: 'user[bio]', width: 'matchParent', label: 'Bio', placeholder: 'Enter your bio', styleClasses: ['outlined']
|
14
14
|
|
15
|
+
# form.spacer height: 14
|
16
|
+
# form.fields_stripeToken name: 'user[stripe_token_outlined]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'outlined'
|
17
|
+
|
18
|
+
# form.spacer height: 14
|
19
|
+
# form.fields_stripeToken name: 'user[stripe_token_individual]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'individual'
|
20
|
+
|
15
21
|
form.spacer height: 14
|
16
|
-
form.
|
22
|
+
form.fields_creditCard name: 'user[stripe_token_outlined]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'outlined'
|
17
23
|
|
18
24
|
form.spacer height: 14
|
19
|
-
form.
|
25
|
+
form.fields_creditCard name: 'user[stripe_token_individual]', width: 'matchParent', publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx', styleClass: 'individual'
|
20
26
|
|
21
27
|
form.spacer height: 14
|
22
28
|
form.panels_split width: 'matchParent', content: ->(split) do
|
23
|
-
# split.left childViews: ->(left) do
|
24
|
-
# if params[:mode] == 'dialog'
|
25
|
-
# left.button styleClass: 'link', text: 'cancel', onClick: ->(action) { action.dialogs_close }
|
26
|
-
# end
|
27
|
-
# end
|
28
29
|
split.right childViews: ->(right) do
|
29
|
-
right.
|
30
|
+
right.fields_submit text: 'Submit'
|
30
31
|
end
|
31
32
|
end
|
32
33
|
|
@@ -5,7 +5,7 @@ liked = params[:liked] == 'true'
|
|
5
5
|
page = json_ui_page json
|
6
6
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
7
7
|
|
8
|
-
json.
|
8
|
+
json.phoenixSocket({
|
9
9
|
"socket" => {
|
10
10
|
"endpoint" => "/socket/websocket",
|
11
11
|
"params" => {
|
@@ -24,7 +24,7 @@ json.ws({
|
|
24
24
|
})
|
25
25
|
|
26
26
|
list_ws = { topic: 'rooms', events: ['comments_updated'] }
|
27
|
-
page.list
|
27
|
+
page.list phoenixSocket: list_ws, firstSection: ->(section) do
|
28
28
|
section.header padding: { top: 12, left: 16, right: 16, bottom: 12 }, childViews: ->(header) do
|
29
29
|
header.h3 text: 'Chat with John Doe'
|
30
30
|
end
|
@@ -71,25 +71,6 @@ page.list ws: list_ws, firstSection: ->(section) do
|
|
71
71
|
end
|
72
72
|
|
73
73
|
page.footer padding: { top: 12, left: 16, right: 16, bottom: 12 }, childViews: ->(footer) do
|
74
|
-
# json.ws({
|
75
|
-
# "socket" => {
|
76
|
-
# "endpoint" => "/socket/websocket",
|
77
|
-
# "params" => {
|
78
|
-
# vsn: '2.0.0',
|
79
|
-
# token: 'TOKEN'
|
80
|
-
# }
|
81
|
-
# },
|
82
|
-
# # "topic" => "room:30",
|
83
|
-
# # "event" => "comments_updated",
|
84
|
-
# "topic" => "links",
|
85
|
-
# "events" => ["new_link_added"],
|
86
|
-
# "header" => {
|
87
|
-
# "user_id" => 2,
|
88
|
-
# "prev_item_id" => nil,
|
89
|
-
# "last_item_id" => nil
|
90
|
-
# }
|
91
|
-
# })
|
92
|
-
|
93
74
|
footer.panels_form width: 'matchParent', url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: glib_json_padding_body, paramNameForFormData: 'formData', onSubmit: ->(action) do
|
94
75
|
json.action "ws/push"
|
95
76
|
json.topic "rooms"
|
@@ -3,7 +3,7 @@ json.title 'Forms'
|
|
3
3
|
page = json_ui_page json
|
4
4
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
5
|
|
6
|
-
json.
|
6
|
+
json.phoenixSocket({
|
7
7
|
"socket" => {
|
8
8
|
"endpoint" => "/socket/websocket",
|
9
9
|
"params" => {
|
@@ -43,7 +43,7 @@ end, childViews: ->(form) do
|
|
43
43
|
|
44
44
|
# TODO: Change this to radio for selecting alert vs reload response
|
45
45
|
form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
|
46
|
-
|
46
|
+
|
47
47
|
form.fields_hidden name: 'baseUrl', width: 'matchParent', value: json_ui_garage_url(path: 'notifications/web_socket')
|
48
48
|
|
49
49
|
form.panels_split width: 'matchParent', content: ->(split) do
|
@@ -56,5 +56,5 @@ end, childViews: ->(form) do
|
|
56
56
|
right.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
57
57
|
end
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
end
|