glib-web 0.1.1 → 0.1.2
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/glib/home_controller.rb +9 -9
- data/app/helpers/glib/json_ui/menu_builder.rb +1 -0
- data/app/helpers/glib/json_ui/page_helper.rb +9 -0
- data/app/helpers/glib/json_ui/view_builder.rb +10 -0
- data/app/views/json_ui/garage/pages/tab_bar.json.jbuilder +38 -26
- data/app/views/json_ui/garage/views/basic.json.jbuilder +2 -2
- data/app/views/json_ui/garage/views/map_data.json.jbuilder +16 -15
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df566013ce3acc240e942fce9afae6dbb6b5c035
|
4
|
+
data.tar.gz: 9ce0f54f02cf936abf1d49bfeff57800033fbaa6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51be02308f500ae5a18143cb5259e3ec0aeb453ff45f3445d7b0e78bba4aeced0a90f15acdba7fa2033656a41adf98126c8b785c14c3d06efd7133ebf9ce7b72
|
7
|
+
data.tar.gz: 65fcd88b64d919f03994a0f81c70a269581d75fe68e2900f64656b8cdd3187dbaffe5a7b5b689ffa569d1f4b9e63f898041f4b782e01b1f5415eb2fd5bddf98a
|
@@ -10,15 +10,15 @@ module Glib
|
|
10
10
|
render path
|
11
11
|
end
|
12
12
|
|
13
|
-
def json_ui_garage_url(options = {})
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
13
|
+
# def json_ui_garage_url(options = {})
|
14
|
+
# Glib::Web::Engine.routes.url_helpers.json_ui_garage_url(options.merge(
|
15
|
+
# protocol: (Rails.application.config.force_ssl ? 'https' : 'http'),
|
16
|
+
# host: request.host,
|
17
|
+
# port: request.port,
|
18
|
+
# _render: params[:_render], format: params[:format])
|
19
|
+
# )
|
20
|
+
# end
|
21
21
|
|
22
|
-
helper_method :json_ui_garage_url
|
22
|
+
# helper_method :json_ui_garage_url
|
23
23
|
end
|
24
24
|
end
|
@@ -1,6 +1,15 @@
|
|
1
1
|
module Glib
|
2
2
|
module JsonUi
|
3
3
|
module PageHelper
|
4
|
+
def json_ui_garage_url(options = {})
|
5
|
+
return Glib::Web::Engine.routes.url_helpers.json_ui_garage_url(options.merge(
|
6
|
+
protocol: (Rails.application.config.force_ssl ? 'https' : 'http'),
|
7
|
+
host: request.host,
|
8
|
+
port: request.port,
|
9
|
+
_render: params[:_render], format: params[:format])
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
4
13
|
def json_ui_page json
|
5
14
|
yield Page.new(json, self)
|
6
15
|
end
|
@@ -4,35 +4,47 @@ json_ui_page json do |page|
|
|
4
4
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
5
|
|
6
6
|
page.header childViews: ->(header) do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
json.tabButtons do
|
13
|
-
json.child! do
|
14
|
-
json.text 'FIRST'
|
15
|
-
json.onClick do
|
16
|
-
json.action 'windows/open-v1'
|
17
|
-
json.url json_ui_garage_url(path: 'pages/tab_bar', tab: 0)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
json.child! do
|
21
|
-
json.text 'SECOND'
|
22
|
-
json.onClick do
|
23
|
-
json.action 'windows/open-v1'
|
24
|
-
json.url json_ui_garage_url(path: 'pages/tab_bar', tab: 1)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
json.child! do
|
28
|
-
json.text 'THIRD'
|
29
|
-
json.onClick do
|
30
|
-
json.action 'windows/open-v1'
|
31
|
-
json.url json_ui_garage_url(path: 'pages/tab_bar', tab: 2)
|
32
|
-
end
|
7
|
+
header.tabBar width: 'matchParent', backgroundColor: '#ffca05', color: '#7f561b', tabButtons: ->(menu) do
|
8
|
+
|
9
|
+
['FIRST', 'SECOND', 'THIRD'].each_with_index do |text, index|
|
10
|
+
menu.button text: text, disabled: params[:tab].to_i == index, onClick: ->(action) do
|
11
|
+
action.windows_open url: json_ui_garage_url(path: 'pages/tab_bar', tab: index)
|
33
12
|
end
|
34
13
|
end
|
35
14
|
end
|
15
|
+
|
16
|
+
# json.child! do
|
17
|
+
# json.view 'tabBar-v1'
|
18
|
+
# json.width 'matchParent'
|
19
|
+
# json.backgroundColor '#ffca05'
|
20
|
+
# json.color '#7f561b'
|
21
|
+
# json.tabButtons do
|
22
|
+
# json.child! do
|
23
|
+
# json.text 'FIRST'
|
24
|
+
# json.selected params[:tab] == 0
|
25
|
+
# json.onClick do
|
26
|
+
# json.action 'windows/open-v1'
|
27
|
+
# json.url json_ui_garage_url(path: 'pages/tab_bar', tab: 0)
|
28
|
+
# end
|
29
|
+
# end
|
30
|
+
# json.child! do
|
31
|
+
# json.text 'SECOND'
|
32
|
+
# json.selected params[:tab] == 1
|
33
|
+
# json.onClick do
|
34
|
+
# json.action 'windows/open-v1'
|
35
|
+
# json.url json_ui_garage_url(path: 'pages/tab_bar', tab: 1)
|
36
|
+
# end
|
37
|
+
# end
|
38
|
+
# json.child! do
|
39
|
+
# json.text 'THIRD'
|
40
|
+
# json.selected params[:tab] == 2
|
41
|
+
# json.onClick do
|
42
|
+
# json.action 'windows/open-v1'
|
43
|
+
# json.url json_ui_garage_url(path: 'pages/tab_bar', tab: 2)
|
44
|
+
# end
|
45
|
+
# end
|
46
|
+
# end
|
47
|
+
# end
|
36
48
|
end
|
37
49
|
|
38
50
|
page.scroll padding: {top: 12, left: 20, right: 20, bottom: 12}, childViews: ->(scroll) do
|
@@ -3,9 +3,9 @@ json.title 'Views'
|
|
3
3
|
json_ui_page json do |page|
|
4
4
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
5
|
|
6
|
-
page.scroll childViews: ->(scroll) do
|
7
|
-
scroll.label text: "\n"
|
6
|
+
page.scroll padding: {top: 20, left: 20, right: 20, bottom: 20}, childViews: ->(scroll) do
|
8
7
|
scroll.h1 text: 'Map'
|
8
|
+
scroll.br height: 6
|
9
9
|
scroll.map latitude: 13.4837, longitude: 144.7917, zoom: 11, width: 'matchParent', height: 250, dataUrl: json_ui_garage_url(path: 'views/map_data')
|
10
10
|
end
|
11
11
|
end
|
@@ -1,42 +1,43 @@
|
|
1
1
|
|
2
2
|
json.pins do
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
longitude = params[:long] || 0
|
7
|
-
subsubtitle = "Current location: #{latitude}, #{longitude}"
|
4
|
+
latitude = params[:lat]&.to_f
|
5
|
+
longitude = params[:long]&.to_f
|
8
6
|
|
9
7
|
json.child! do
|
10
|
-
|
11
|
-
json.
|
12
|
-
json.longitude 144.817322 + rand(0..0.1)
|
8
|
+
json.latitude 13.516680
|
9
|
+
json.longitude 144.817322
|
13
10
|
json.infoWindow do
|
14
11
|
json.title 'Place 1'
|
15
12
|
json.subtitle 'Big shopping mall'
|
16
|
-
json.subsubtitle subsubtitle
|
17
13
|
end
|
18
14
|
end
|
19
15
|
|
20
16
|
json.child! do
|
21
|
-
|
22
|
-
json.
|
23
|
-
json.longitude 144.771303 + rand(0..0.1)
|
17
|
+
json.latitude 13.473001
|
18
|
+
json.longitude 144.771303
|
24
19
|
json.infoWindow do
|
25
20
|
json.title 'Place 2'
|
26
21
|
json.subtitle 'High class restaurant'
|
27
|
-
json.subsubtitle subsubtitle
|
28
22
|
end
|
29
23
|
end
|
30
24
|
|
31
25
|
json.child! do
|
32
|
-
# json.id 'place3'
|
33
26
|
json.latitude 13.375903 + rand(0..0.1)
|
34
27
|
json.longitude 144.749791 + rand(0..0.1)
|
35
28
|
json.infoWindow do
|
36
29
|
json.title 'Place 3'
|
37
|
-
json.subtitle '
|
38
|
-
json.subsubtitle subsubtitle
|
30
|
+
json.subtitle 'Random location'
|
39
31
|
end
|
40
32
|
end
|
41
33
|
|
34
|
+
json.child! do
|
35
|
+
json.latitude latitude
|
36
|
+
json.longitude longitude
|
37
|
+
json.infoWindow do
|
38
|
+
json.title 'You'
|
39
|
+
json.subtitle 'Current location'
|
40
|
+
json.subsubtitle "#{latitude}, #{longitude}"
|
41
|
+
end
|
42
|
+
end
|
42
43
|
end
|