glib-web 0.5.40 → 0.5.45
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/helpers/glib/json_ui/page_helper.rb +7 -2
- data/app/helpers/glib/json_ui/view_builder.rb +1 -0
- data/app/helpers/glib/json_ui/view_builder/fields.rb +6 -7
- data/app/helpers/glib/json_ui/view_builder/panels.rb +6 -1
- data/app/views/json_ui/garage/actions/index.json.jbuilder +19 -20
- data/app/views/json_ui/garage/forms/basic.json.jbuilder +13 -14
- data/app/views/json_ui/garage/forms/checkboxes.json.jbuilder +34 -35
- data/app/views/json_ui/garage/forms/text_validation.json.jbuilder +46 -11
- data/app/views/json_ui/garage/views/map_cluster_data.json.jbuilder +3 -0
- data/app/views/json_ui/garage/views/map_data.json.jbuilder +10 -2
- data/app/views/json_ui/garage/views/maps.json.jbuilder +0 -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: b863f20666907aa007728759d473d1e8dad478ba7efffcb66aa94fb898536a35
|
4
|
+
data.tar.gz: 21e14417f6a72d74e58a8e5ee1ebce72d2a21c11c6e5ba4fb363b7a6820f4c0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15f888278858a1e6b8ebdc9944c6abcf07e4b0746dc91ffd3694be98552026a43a664e9da8c8fb63c45c8eb31f6506c487f40b98de5c92bca3679b341612ae8d
|
7
|
+
data.tar.gz: 3e2bdb8dbfeddacccbe3269bfe9973bd65cb398faa25207d315d1970b951647a1854d415db4004fd6485d335186ca1286b30c2397c588ae5d0104447b0e8fe42
|
@@ -48,10 +48,15 @@ module Glib
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def json_ui_action(json)
|
51
|
-
@
|
52
|
-
@
|
51
|
+
@__json_ui_action ||= Page.new(json, self)
|
52
|
+
@__json_ui_action.action_builder
|
53
53
|
end
|
54
54
|
|
55
|
+
# def json_ui_view(json)
|
56
|
+
# @__json_ui_view ||= Page.new(json, self)
|
57
|
+
# @__json_ui_view.view_builder
|
58
|
+
# end
|
59
|
+
|
55
60
|
def json_ui_action_payload(&block)
|
56
61
|
dataJson = Jbuilder.new
|
57
62
|
block&.call Page.new(dataJson, self).action_builder
|
@@ -4,6 +4,7 @@ class Glib::JsonUi::ViewBuilder
|
|
4
4
|
class AbstractField < View
|
5
5
|
bool :readOnly
|
6
6
|
hash :validation
|
7
|
+
# string :label
|
7
8
|
|
8
9
|
def label(label)
|
9
10
|
@label = label
|
@@ -39,16 +40,13 @@ class Glib::JsonUi::ViewBuilder
|
|
39
40
|
|
40
41
|
def prop(prop)
|
41
42
|
@prop = prop
|
42
|
-
# if (form = page.current_form)
|
43
|
-
# @name ||= form.field_name(prop)
|
44
|
-
# @value ||= form.field_value(prop)
|
45
|
-
# end
|
46
|
-
|
47
43
|
end
|
48
44
|
|
49
45
|
# Override
|
50
46
|
def created
|
51
47
|
if @prop && (form = page.current_form)
|
48
|
+
form.field_assert_respond_to(@prop)
|
49
|
+
|
52
50
|
@name ||= form.field_name(@prop, @multiple || false)
|
53
51
|
@value ||= form.field_value(@prop)
|
54
52
|
@label ||= form.field_label(@prop, @label_args || {})
|
@@ -56,7 +54,6 @@ class Glib::JsonUi::ViewBuilder
|
|
56
54
|
@placeholder ||= form.placeholder_label(@prop, @placeholder_args || {})
|
57
55
|
|
58
56
|
@validation ||= form.field_validation(@prop)
|
59
|
-
|
60
57
|
end
|
61
58
|
json.name @name
|
62
59
|
json.value @value if @value
|
@@ -68,13 +65,15 @@ class Glib::JsonUi::ViewBuilder
|
|
68
65
|
# - Placeholder competes with label for space
|
69
66
|
json.placeholder @placeholder if @placeholder
|
70
67
|
|
71
|
-
|
68
|
+
# TODO: Add a flag so the framework's user can turn it on and off.
|
69
|
+
# json.validation @validation if @validation
|
72
70
|
end
|
73
71
|
|
74
72
|
end
|
75
73
|
|
76
74
|
class Text < AbstractField
|
77
75
|
int :maxLength
|
76
|
+
icon :leftIcon
|
78
77
|
end
|
79
78
|
|
80
79
|
class Number < Text
|
@@ -16,6 +16,11 @@ class Glib::JsonUi::ViewBuilder
|
|
16
16
|
@model.class.try(:reflect_on_association, prop)&.macro == :has_many
|
17
17
|
end
|
18
18
|
|
19
|
+
def field_assert_respond_to(prop)
|
20
|
+
# Identify a prop being used on a nil model or incorrect model.
|
21
|
+
raise "Invalid property `#{prop}` on '#{@model.class}'" unless @model.respond_to?(prop)
|
22
|
+
end
|
23
|
+
|
19
24
|
def field_name(prop, multiple)
|
20
25
|
suffix = is_array_association?(prop) || multiple ? '[]' : ''
|
21
26
|
"#{@model_name}[#{prop}]#{suffix}"
|
@@ -88,7 +93,7 @@ class Glib::JsonUi::ViewBuilder
|
|
88
93
|
json.childViews do
|
89
94
|
if @method != :get
|
90
95
|
json.child! do
|
91
|
-
json.view 'fields/hidden
|
96
|
+
json.view 'fields/hidden'
|
92
97
|
json.name 'authenticity_token'
|
93
98
|
json.value page.context.form_authenticity_token
|
94
99
|
end
|
@@ -1,23 +1,22 @@
|
|
1
1
|
json.title 'Actions'
|
2
2
|
|
3
|
-
json_ui_page json
|
4
|
-
|
3
|
+
page = json_ui_page json
|
4
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page, top_nav: true
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
6
|
+
page.list sections: [
|
7
|
+
->(section) do
|
8
|
+
render "#{@path_prefix}/actions/reload", section: section
|
9
|
+
end, ->(section) do
|
10
|
+
render "#{@path_prefix}/actions/dialogs", section: section
|
11
|
+
end, ->(section) do
|
12
|
+
render "#{@path_prefix}/actions/snackbars", section: section
|
13
|
+
end, ->(section) do
|
14
|
+
render "#{@path_prefix}/actions/sheets", section: section
|
15
|
+
end, ->(section) do
|
16
|
+
render "#{@path_prefix}/actions/windows", section: section
|
17
|
+
end, ->(section) do
|
18
|
+
render "#{@path_prefix}/actions/timeouts", section: section
|
19
|
+
end, ->(section) do
|
20
|
+
render "#{@path_prefix}/actions/http", section: section
|
21
|
+
end
|
22
|
+
]
|
@@ -1,22 +1,21 @@
|
|
1
1
|
json.title 'Forms'
|
2
2
|
|
3
|
-
json_ui_page json
|
4
|
-
|
3
|
+
page = json_ui_page json
|
4
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
|
7
|
+
form.fields_text name: 'user[name]', width: 'matchParent', label: 'Name'
|
8
|
+
form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|
16
|
-
split.right childViews: ->(right) do
|
17
|
-
# right.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
18
|
-
right.fields_submit text: 'Submit'
|
10
|
+
form.panels_split width: 'matchParent', content: ->(split) do
|
11
|
+
split.left childViews: ->(left) do
|
12
|
+
if params[:mode] == 'dialog'
|
13
|
+
left.button styleClass: 'link', text: 'cancel', onClick: ->(action) { action.dialogs_close }
|
19
14
|
end
|
20
15
|
end
|
16
|
+
split.right childViews: ->(right) do
|
17
|
+
# right.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
18
|
+
right.fields_submit text: 'Submit'
|
19
|
+
end
|
21
20
|
end
|
22
21
|
end
|
@@ -1,44 +1,43 @@
|
|
1
1
|
json.title 'Forms'
|
2
2
|
|
3
|
-
json_ui_page json
|
4
|
-
|
5
|
-
|
6
|
-
page.scroll childViews: ->(scroll) do
|
3
|
+
page = json_ui_page json
|
4
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
6
|
+
page.scroll childViews: ->(scroll) do
|
7
|
+
|
8
|
+
scroll.panels_form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
|
9
|
+
form.spacer height: 20
|
10
|
+
form.h2 text: 'Check Group'
|
11
|
+
form.fields_checkGroup name: 'user[skills][]', uncheckValue: 1, childViews: ->(group) do
|
12
|
+
form.fields_check value: 2, label: 'Game Development'
|
13
|
+
form.fields_check value: 3, label: 'Web Development'
|
14
|
+
form.fields_check value: 4, label: 'Mobile Development'
|
15
|
+
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
17
|
+
form.spacer height: 20
|
18
|
+
form.h2 text: 'Rating'
|
19
|
+
form.spacer height: 6
|
20
|
+
form.fields_radioGroup name: 'user[rating1][]', iconOfSelected: 'star', iconOfBeforeSelected: 'star', iconOfAfterSelected: 'star_border', childViews: ->(panel) do
|
21
|
+
panel.panels_horizontal childViews: ->(panel) do
|
22
|
+
panel.fields_radio value: 1
|
23
|
+
panel.fields_radio value: 2
|
24
|
+
panel.fields_radio value: 3
|
25
|
+
panel.fields_radio value: 4
|
26
|
+
panel.fields_radio value: 5
|
28
27
|
end
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
28
|
+
end
|
29
|
+
form.fields_radioGroup name: 'user[rating2][]', iconOfSelected: 'star', iconOfBeforeSelected: 'star', iconOfAfterSelected: 'star_border', value: 1, childViews: ->(panel) do
|
30
|
+
panel.panels_horizontal childViews: ->(panel) do
|
31
|
+
panel.fields_radio value: 1
|
32
|
+
panel.fields_radio value: 2
|
33
|
+
panel.fields_radio value: 3
|
34
|
+
panel.fields_radio value: 4
|
35
|
+
panel.fields_radio value: 5
|
37
36
|
end
|
38
|
-
|
39
|
-
form.spacer height: 20
|
40
|
-
form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
41
37
|
end
|
42
|
-
|
38
|
+
|
39
|
+
form.spacer height: 20
|
40
|
+
form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
43
41
|
end
|
42
|
+
|
44
43
|
end
|
@@ -1,22 +1,57 @@
|
|
1
1
|
json.title 'Forms'
|
2
2
|
|
3
|
-
json_ui_page json
|
4
|
-
|
3
|
+
page = json_ui_page json
|
4
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
form.
|
6
|
+
page.form \
|
7
|
+
url: json_ui_garage_url(path: 'forms/generic_post'),
|
8
|
+
method: 'post',
|
9
|
+
padding: glib_json_padding_body,
|
10
|
+
childViews: ->(form) do
|
11
|
+
form.fields_email \
|
12
|
+
name: 'user[email]',
|
13
|
+
width: 'matchParent',
|
14
|
+
label: 'Email'
|
15
|
+
|
16
|
+
form.fields_url \
|
17
|
+
name: 'user[url]',
|
18
|
+
width: 'matchParent',
|
19
|
+
label: 'URL'
|
20
|
+
|
21
|
+
form.fields_number \
|
22
|
+
name: 'user[number]',
|
23
|
+
width: 'matchParent',
|
24
|
+
label: 'Number',
|
25
|
+
validation: { required: { message: 'Required' } },
|
26
|
+
leftIcon: 'attach_money'
|
27
|
+
|
28
|
+
form.fields_password \
|
29
|
+
name: 'user[password]',
|
30
|
+
width: 'matchParent',
|
31
|
+
label: 'Password',
|
32
|
+
hint: 'Should contain at least 6 characters'
|
33
|
+
|
34
|
+
form.fields_textarea \
|
35
|
+
name: 'user[textarea]',
|
36
|
+
width: 'matchParent',
|
37
|
+
label: 'Textarea with maxLength',
|
38
|
+
maxLength: 50,
|
39
|
+
validation: { required: { message: 'Required' } }
|
12
40
|
|
13
41
|
options = ['male', 'female'].map { |i| { text: i.humanize, value: i } }
|
14
|
-
form.fields_select
|
42
|
+
form.fields_select \
|
43
|
+
name: 'user[gender]',
|
44
|
+
width: 'matchParent',
|
45
|
+
label: 'Gender',
|
46
|
+
validation: { required: { message: 'Required' } },
|
47
|
+
options: options
|
15
48
|
|
16
49
|
form.spacer height: 20
|
17
|
-
form.fields_stripeToken
|
50
|
+
form.fields_stripeToken \
|
51
|
+
name: 'user[stripe_token]',
|
52
|
+
width: 'matchParent',
|
53
|
+
publicKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx'
|
18
54
|
|
19
55
|
form.spacer height: 30
|
20
56
|
form.fields_submit text: 'Submit'
|
21
57
|
end
|
22
|
-
end
|
@@ -24,12 +24,15 @@ json.pins do
|
|
24
24
|
{ lat: -42.734358, lng: 147.501315 },
|
25
25
|
{ lat: -42.735258, lng: 147.438 },
|
26
26
|
{ lat: -43.999792, lng: 170.463352 },
|
27
|
+
{ lat: 49.003109, lng: 108.490479, size: 3500000 },
|
28
|
+
{ lat: -6.611423, lng: 141.922091, size: 3700 },
|
27
29
|
];
|
28
30
|
|
29
31
|
locations.each do |location|
|
30
32
|
json.child! do
|
31
33
|
json.latitude location[:lat]
|
32
34
|
json.longitude location[:lng]
|
35
|
+
json.clusterSize location[:size]
|
33
36
|
json.infoWindow do
|
34
37
|
json.title "TEST #{rand(1000)}"
|
35
38
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
|
2
|
-
json
|
2
|
+
page = json_ui_page json
|
3
3
|
|
4
|
+
json.pins do
|
4
5
|
latitude = params[:lat]&.to_f
|
5
6
|
longitude = params[:long]&.to_f
|
6
7
|
|
@@ -37,7 +38,14 @@ json.pins do
|
|
37
38
|
json.infoWindow do
|
38
39
|
json.title 'You'
|
39
40
|
json.subtitle 'Current location'
|
40
|
-
|
41
|
+
|
42
|
+
json.body do
|
43
|
+
page.vertical_content padding: { top: 10 }, childViews: ->(body) do
|
44
|
+
body.button text: 'Info', onClick: ->(action) do
|
45
|
+
action.dialogs_alert message: "#{latitude}, #{longitude}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
41
49
|
end
|
42
50
|
end
|
43
51
|
end
|
File without changes
|