glib-web 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5079872c2112ab26d047f127bc6a1439108ff6e4
4
- data.tar.gz: 3b85cc0e2092562954945464557b04f6cbf73daf
3
+ metadata.gz: df566013ce3acc240e942fce9afae6dbb6b5c035
4
+ data.tar.gz: 9ce0f54f02cf936abf1d49bfeff57800033fbaa6
5
5
  SHA512:
6
- metadata.gz: 202573f997d53fd508721b354bd9fe465f7afa63b7eedfe200a18c5d4523f54ca59139c946ae744abbacb41c673fecc80485c0c1c1295759bec71d5f11118328
7
- data.tar.gz: e7ab09ff8e10b8cf59607b2bed4c1321b8b3dcd962e6c32792320f2470a7daa81f6bbb3c24ded486e90ff1bc114bc7ad47d77516859c4dc592cbf40d5f1e238e
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
- 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
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
@@ -12,6 +12,7 @@ module Glib
12
12
  string :text
13
13
  icon :icon
14
14
  action :onClick
15
+ bool :disabled
15
16
  end
16
17
  end
17
18
  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
@@ -65,6 +65,16 @@ module Glib
65
65
  int :zoom
66
66
  string :dataUrl
67
67
  end
68
+
69
+ class TabBar < View
70
+ string :color
71
+
72
+ def tabButtons(block)
73
+ json.tabButtons do
74
+ block.call page.menu_builder
75
+ end
76
+ end
77
+ end
68
78
 
69
79
  end
70
80
  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
- json.child! do
8
- json.view 'tabBar-v1'
9
- json.width 'matchParent'
10
- json.backgroundColor '#ffca05'
11
- json.color '#7f561b'
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
- # TODO: Make sure the vuejs frontend passes the map's center point (lat/long) to the server
5
- latitude = params[:lat] || 0
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
- # json.id 'place1'
11
- json.latitude 13.516680 + rand(0..0.1)
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
- # json.id 'place2'
22
- json.latitude 13.473001 + rand(0..0.1)
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 'High class restaurant'
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
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.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''