glib-web 0.5.38 → 0.5.43
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/glib/json/ui.rb +1 -0
- data/app/helpers/glib/json_ui/abstract_builder.rb +8 -0
- data/app/helpers/glib/json_ui/list_builders.rb +12 -13
- data/app/helpers/glib/json_ui/page_helper.rb +7 -2
- data/app/helpers/glib/json_ui/view_builder.rb +3 -0
- data/app/helpers/glib/json_ui/view_builder/fields.rb +8 -4
- data/app/helpers/glib/json_ui/view_builder/panels.rb +16 -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/conditional_value.json.jbuilder +36 -0
- data/app/views/json_ui/garage/forms/index.json.jbuilder +3 -0
- data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +0 -0
- data/app/views/json_ui/garage/lists/edit_actions.json.jbuilder +12 -1
- data/app/views/json_ui/garage/lists/index.json.jbuilder +1 -1
- data/app/views/json_ui/garage/views/index.json.jbuilder +3 -0
- data/app/views/json_ui/garage/views/map_cluster_data.json.jbuilder +41 -0
- data/app/views/json_ui/garage/views/map_data.json.jbuilder +10 -2
- data/app/views/json_ui/garage/views/maps.json.jbuilder +31 -0
- data/app/views/json_ui/garage/views/misc.json.jbuilder +4 -4
- data/lib/glib/json_crawler/action_crawlers/nav_initiate.rb +3 -1
- data/lib/glib/json_crawler/action_crawlers/windows_open.rb +3 -1
- data/lib/glib/json_crawler/router.rb +2 -2
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b8d44468bb10a4b5bd570d12d233ea3a0057be5e666466575204e7e445de360
|
4
|
+
data.tar.gz: 3f9d79903871a7a8f59a786c637d42f7e33bba1dfccc8c652544201e9df77ae9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5dbedf4e29bc182bce5af77d0c9b392100e030a21fd8ed03dcd56bf1bb2c1c70f3f5d72cda358454e0058a88df16e1a2e83017bf983f42083c57da0f9187f1db
|
7
|
+
data.tar.gz: 1d80db9408c05b6ce3a2a9356e0aa01aa3f6489276424543996f0f248afe2366b687fc3127c4eda8f3e336d92b3479c88225f619d69df7ed1c9b2c52e1f921db
|
@@ -263,6 +263,14 @@ module Glib
|
|
263
263
|
end
|
264
264
|
end
|
265
265
|
|
266
|
+
def self.menu(propName)
|
267
|
+
define_method(propName) do |value|
|
268
|
+
json.set! propName do
|
269
|
+
value.call(page.menu_builder)
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
266
274
|
def self.singleton_array(singletonName, arrayName)
|
267
275
|
array arrayName
|
268
276
|
|
@@ -7,23 +7,22 @@ module Glib
|
|
7
7
|
end
|
8
8
|
|
9
9
|
class AbstractTemplate < JsonUiElement
|
10
|
-
|
11
|
-
|
10
|
+
menu :leftButtons
|
11
|
+
menu :rightButtons
|
12
|
+
menu :editButtons
|
13
|
+
menu :chips
|
14
|
+
|
15
|
+
# def editButtons(block)
|
16
|
+
# json.editButtons do
|
12
17
|
# block.call page.menu_builder
|
13
18
|
# end
|
14
19
|
# end
|
15
20
|
|
16
|
-
def
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
21
|
-
|
22
|
-
def chips(block)
|
23
|
-
json.chips do
|
24
|
-
block.call page.menu_builder
|
25
|
-
end
|
26
|
-
end
|
21
|
+
# def chips(block)
|
22
|
+
# json.chips do
|
23
|
+
# block.call page.menu_builder
|
24
|
+
# end
|
25
|
+
# end
|
27
26
|
end
|
28
27
|
|
29
28
|
class Standard < AbstractTemplate
|
@@ -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
|
@@ -30,6 +30,7 @@ module Glib
|
|
30
30
|
hash :padding
|
31
31
|
singleton_array :styleClass, :styleClasses
|
32
32
|
hash :showIf
|
33
|
+
hash :valueIf
|
33
34
|
hash :analytics
|
34
35
|
|
35
36
|
# def initialize(json, page)
|
@@ -147,6 +148,7 @@ module Glib
|
|
147
148
|
end
|
148
149
|
|
149
150
|
class Hr < View
|
151
|
+
color :color
|
150
152
|
end
|
151
153
|
|
152
154
|
class Spacer < View
|
@@ -157,6 +159,7 @@ module Glib
|
|
157
159
|
float :longitude
|
158
160
|
int :zoom
|
159
161
|
string :dataUrl
|
162
|
+
bool :cluster
|
160
163
|
end
|
161
164
|
|
162
165
|
class Chip < View
|
@@ -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,20 +40,20 @@ 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
43
|
end
|
47
44
|
|
48
45
|
# Override
|
49
46
|
def created
|
50
47
|
if @prop && (form = page.current_form)
|
48
|
+
form.field_assert_respond_to(@prop)
|
49
|
+
|
51
50
|
@name ||= form.field_name(@prop, @multiple || false)
|
52
51
|
@value ||= form.field_value(@prop)
|
53
52
|
@label ||= form.field_label(@prop, @label_args || {})
|
54
53
|
@hint ||= form.hint_label(@prop, @hint_args || {})
|
55
54
|
@placeholder ||= form.placeholder_label(@prop, @placeholder_args || {})
|
55
|
+
|
56
|
+
@validation ||= form.field_validation(@prop)
|
56
57
|
end
|
57
58
|
json.name @name
|
58
59
|
json.value @value if @value
|
@@ -63,6 +64,9 @@ class Glib::JsonUi::ViewBuilder
|
|
63
64
|
# - Placeholder gets hidden when there is input which may be confusing
|
64
65
|
# - Placeholder competes with label for space
|
65
66
|
json.placeholder @placeholder if @placeholder
|
67
|
+
|
68
|
+
# TODO: Add a flag so the framework's user can turn it on and off.
|
69
|
+
# json.validation @validation if @validation
|
66
70
|
end
|
67
71
|
|
68
72
|
end
|
@@ -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}"
|
@@ -41,6 +46,16 @@ class Glib::JsonUi::ViewBuilder
|
|
41
46
|
I18n.t("dt_models.#{@model_name}.#{prop}.placeholder", args.merge(default: nil))
|
42
47
|
end
|
43
48
|
|
49
|
+
def field_validation(prop)
|
50
|
+
validations = {}
|
51
|
+
@model.class.validators_on(prop).each do |validator|
|
52
|
+
if validator.kind == :presence
|
53
|
+
validations[:required] = { message: 'Required' }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
validations
|
57
|
+
end
|
58
|
+
|
44
59
|
def url(url)
|
45
60
|
@url = url
|
46
61
|
end
|
@@ -78,7 +93,7 @@ class Glib::JsonUi::ViewBuilder
|
|
78
93
|
json.childViews do
|
79
94
|
if @method != :get
|
80
95
|
json.child! do
|
81
|
-
json.view 'fields/hidden
|
96
|
+
json.view 'fields/hidden'
|
82
97
|
json.name 'authenticity_token'
|
83
98
|
json.value page.context.form_authenticity_token
|
84
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
|
@@ -0,0 +1,36 @@
|
|
1
|
+
json.title 'Forms'
|
2
|
+
|
3
|
+
page = json_ui_page json
|
4
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
|
+
|
6
|
+
page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
|
7
|
+
form.spacer height: 20
|
8
|
+
form.h2 text: 'Date'
|
9
|
+
form.spacer height: 6
|
10
|
+
form.fields_date name: 'user[date_start]', width: 'matchParent', label: 'Start Date', min: '2010-01-01', max: '2012-01-01', value: '2010-02-01'
|
11
|
+
form.fields_date name: 'user[date_end]', width: 'matchParent', label: 'End Date', min: '2010-01-01', max: '2012-01-01', valueIf: {
|
12
|
+
"+": [
|
13
|
+
{
|
14
|
+
"var": 'user[date_start]'
|
15
|
+
},
|
16
|
+
24 * 3600
|
17
|
+
]
|
18
|
+
}
|
19
|
+
|
20
|
+
form.spacer height: 20
|
21
|
+
form.h2 text: 'Date/Time'
|
22
|
+
form.spacer height: 6
|
23
|
+
form.fields_datetime name: 'user[datetime_start]', width: 'matchParent', label: 'Start Date', min: '2010-01-01', max: '2012-01-01', value: '2010-02-01T01:00'
|
24
|
+
form.fields_datetime name: 'user[datetime_end]', width: 'matchParent', label: 'End Date', min: '2010-01-01', max: '2012-01-01', valueIf: {
|
25
|
+
"+": [
|
26
|
+
{
|
27
|
+
"var": 'user[datetime_start]'
|
28
|
+
},
|
29
|
+
3600
|
30
|
+
]
|
31
|
+
}
|
32
|
+
|
33
|
+
form.spacer height: 20
|
34
|
+
form.fields_submit text: 'Submit'
|
35
|
+
form.spacer height: 40
|
36
|
+
end
|
@@ -36,6 +36,9 @@ json_ui_page json do |page|
|
|
36
36
|
template.thumbnail title: 'Show/Hide', onClick: ->(action) do
|
37
37
|
action.windows_open url: json_ui_garage_url(path: 'forms/show_hide')
|
38
38
|
end
|
39
|
+
template.thumbnail title: 'Conditional Value', onClick: ->(action) do
|
40
|
+
action.windows_open url: json_ui_garage_url(path: 'forms/conditional_value')
|
41
|
+
end
|
39
42
|
|
40
43
|
end
|
41
44
|
end, ->(section) do
|
File without changes
|
@@ -5,7 +5,18 @@ json_ui_page json do |page|
|
|
5
5
|
|
6
6
|
page.list firstSection: ->(section) do
|
7
7
|
section.rows builder: ->(template) do
|
8
|
-
template.thumbnail title: 'Click menu (web) or swipe left (Android/iOS)',
|
8
|
+
template.thumbnail title: 'Click menu (web) or swipe left (Android/iOS)', leftButtons: ->(menu) do
|
9
|
+
menu.button styleClass: 'icon', icon: 'check_box', onClick: ->(subaction) do
|
10
|
+
subaction.dialogs_alert message: 'Tick/untick'
|
11
|
+
end
|
12
|
+
end, rightButtons: ->(menu) do
|
13
|
+
menu.button styleClass: 'icon', icon: 'share', onClick: ->(subaction) do
|
14
|
+
subaction.dialogs_alert message: 'Share'
|
15
|
+
end
|
16
|
+
menu.button styleClass: 'icon', icon: 'open_in_new', onClick: ->(subaction) do
|
17
|
+
subaction.dialogs_alert message: 'Open'
|
18
|
+
end
|
19
|
+
end, editButtons: ->(menu) do
|
9
20
|
menu.button text: 'Edit', onClick: ->(action) do
|
10
21
|
action.dialogs_alert message: 'Perform action'
|
11
22
|
end
|
@@ -8,7 +8,7 @@ json_ui_page json do |page|
|
|
8
8
|
template.thumbnail icon: 'list', title: 'Templating', onClick: ->(action) do
|
9
9
|
action.windows_open url: json_ui_garage_url(path: 'lists/templating')
|
10
10
|
end
|
11
|
-
template.thumbnail title: '
|
11
|
+
template.thumbnail title: 'Action Buttons', onClick: ->(action) do
|
12
12
|
action.windows_open url: json_ui_garage_url(path: 'lists/edit_actions')
|
13
13
|
end
|
14
14
|
template.thumbnail title: 'FAB (Floating Action Button)', onClick: ->(action) do
|
@@ -22,6 +22,9 @@ json_ui_page json do |page|
|
|
22
22
|
template.thumbnail title: 'Banners', onClick: ->(action) do
|
23
23
|
action.windows_open url: json_ui_garage_url(path: 'views/banners')
|
24
24
|
end
|
25
|
+
template.thumbnail title: 'Maps', onClick: ->(action) do
|
26
|
+
action.windows_open url: json_ui_garage_url(path: 'views/maps')
|
27
|
+
end
|
25
28
|
template.thumbnail title: 'Misc', onClick: ->(action) do
|
26
29
|
action.windows_open url: json_ui_garage_url(path: 'views/misc')
|
27
30
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
json.pins do
|
3
|
+
locations = [
|
4
|
+
{ lat: -31.56391, lng: 147.154312 },
|
5
|
+
{ lat: -33.718234, lng: 150.363181 },
|
6
|
+
{ lat: -33.727111, lng: 150.371124 },
|
7
|
+
{ lat: -33.848588, lng: 151.209834 },
|
8
|
+
{ lat: -33.851702, lng: 151.216968 },
|
9
|
+
{ lat: -34.671264, lng: 150.863657 },
|
10
|
+
{ lat: -35.304724, lng: 148.662905 },
|
11
|
+
{ lat: -36.817685, lng: 175.699196 },
|
12
|
+
{ lat: -36.828611, lng: 175.790222 },
|
13
|
+
{ lat: -37.75, lng: 145.116667 },
|
14
|
+
{ lat: -37.759859, lng: 145.128708 },
|
15
|
+
{ lat: -37.765015, lng: 145.133858 },
|
16
|
+
{ lat: -37.770104, lng: 145.143299 },
|
17
|
+
{ lat: -37.7737, lng: 145.145187 },
|
18
|
+
{ lat: -37.774785, lng: 145.137978 },
|
19
|
+
{ lat: -37.819616, lng: 144.968119 },
|
20
|
+
{ lat: -38.330766, lng: 144.695692 },
|
21
|
+
{ lat: -39.927193, lng: 175.053218 },
|
22
|
+
{ lat: -41.330162, lng: 174.865694 },
|
23
|
+
{ lat: -42.734358, lng: 147.439506 },
|
24
|
+
{ lat: -42.734358, lng: 147.501315 },
|
25
|
+
{ lat: -42.735258, lng: 147.438 },
|
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 },
|
29
|
+
];
|
30
|
+
|
31
|
+
locations.each do |location|
|
32
|
+
json.child! do
|
33
|
+
json.latitude location[:lat]
|
34
|
+
json.longitude location[:lng]
|
35
|
+
json.clusterSize location[:size]
|
36
|
+
json.infoWindow do
|
37
|
+
json.title "TEST #{rand(1000)}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
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
|
@@ -0,0 +1,31 @@
|
|
1
|
+
json.title 'Views'
|
2
|
+
|
3
|
+
json_ui_page json do |page|
|
4
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
|
+
|
6
|
+
page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
7
|
+
scroll.spacer height: 20
|
8
|
+
scroll.h2 text: 'Map with Markers'
|
9
|
+
scroll.spacer height: 6
|
10
|
+
scroll.map \
|
11
|
+
width: 'matchParent',
|
12
|
+
latitude: 13.4837,
|
13
|
+
longitude: 144.7917,
|
14
|
+
zoom: 11,
|
15
|
+
height: 250,
|
16
|
+
dataUrl: json_ui_garage_url(path: 'views/map_data')
|
17
|
+
|
18
|
+
scroll.spacer height: 20
|
19
|
+
scroll.h2 text: 'Map with Clustered Markers'
|
20
|
+
scroll.spacer height: 6
|
21
|
+
scroll.map \
|
22
|
+
width: 'matchParent',
|
23
|
+
latitude: -42.162376,
|
24
|
+
longitude: 172.671437,
|
25
|
+
zoom: 7,
|
26
|
+
height: 480,
|
27
|
+
cluster: true,
|
28
|
+
dataUrl: json_ui_garage_url(path: 'views/map_cluster_data')
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
@@ -20,10 +20,10 @@ json_ui_page json do |page|
|
|
20
20
|
scroll.datetime value: 1.week.ago, format: 'YYYY-MM-DD'
|
21
21
|
scroll.datetime value: DateTime.current, format: 'hh:mm:ss', tick: true
|
22
22
|
|
23
|
-
scroll.spacer height: 20
|
24
|
-
scroll.h2 text: 'Map'
|
25
|
-
scroll.spacer height: 6
|
26
|
-
scroll.map width: 'matchParent', latitude: 13.4837, longitude: 144.7917, zoom: 11, height: 250, dataUrl: json_ui_garage_url(path: 'views/map_data')
|
23
|
+
# scroll.spacer height: 20
|
24
|
+
# scroll.h2 text: 'Map'
|
25
|
+
# scroll.spacer height: 6
|
26
|
+
# scroll.map width: 'matchParent', latitude: 13.4837, longitude: 144.7917, zoom: 11, height: 250, dataUrl: json_ui_garage_url(path: 'views/map_data')
|
27
27
|
|
28
28
|
scroll.spacer height: 20
|
29
29
|
scroll.h2 text: 'Calendar'
|
@@ -30,8 +30,8 @@ module Glib
|
|
30
30
|
end
|
31
31
|
|
32
32
|
if args.is_a?(Hash) && args['rel'] != 'nofollow'
|
33
|
-
if (
|
34
|
-
process_action(http,
|
33
|
+
if (on_click = (args.fetch('onClick', nil)))
|
34
|
+
process_action(http, on_click)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
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: 0.5.
|
4
|
+
version: 0.5.43
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -125,6 +125,7 @@ files:
|
|
125
125
|
- app/views/json_ui/garage/forms/basic.json.jbuilder
|
126
126
|
- app/views/json_ui/garage/forms/basic_post.json.jbuilder
|
127
127
|
- app/views/json_ui/garage/forms/checkboxes.json.jbuilder
|
128
|
+
- app/views/json_ui/garage/forms/conditional_value.json.jbuilder
|
128
129
|
- app/views/json_ui/garage/forms/dynamic_group.json.jbuilder
|
129
130
|
- app/views/json_ui/garage/forms/dynamic_select.json.jbuilder
|
130
131
|
- app/views/json_ui/garage/forms/dynamic_select_data.json.jbuilder
|
@@ -197,7 +198,9 @@ files:
|
|
197
198
|
- app/views/json_ui/garage/views/images.json.jbuilder
|
198
199
|
- app/views/json_ui/garage/views/index.json.jbuilder
|
199
200
|
- app/views/json_ui/garage/views/links.json.jbuilder
|
201
|
+
- app/views/json_ui/garage/views/map_cluster_data.json.jbuilder
|
200
202
|
- app/views/json_ui/garage/views/map_data.json.jbuilder
|
203
|
+
- app/views/json_ui/garage/views/maps.json.jbuilder
|
201
204
|
- app/views/json_ui/garage/views/markdowns.json.jbuilder
|
202
205
|
- app/views/json_ui/garage/views/misc.json.jbuilder
|
203
206
|
- app/views/json_ui/garage/views/texts.json.jbuilder
|