rails_admin_baidu_map 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8bbd4f96131499548c64a9d018b76b1574ab9889
4
- data.tar.gz: 55bd98c2120567a07af74d00bf2292b559fe4e2f
3
+ metadata.gz: 3e791f26f87484a9feb48c3eb17b61bd545d6155
4
+ data.tar.gz: 654a476905685679a3fbfb4cde95eb8d187722c1
5
5
  SHA512:
6
- metadata.gz: cc670e6fad8e04e08bb2504680041dd3a3b8c7c8c4903c7ff68f4fe27e544190b1a7e051341d8c2047a938997bf043d7f9ea831f7cd6a7e435d11ef647c6c3ae
7
- data.tar.gz: 691372cae26bbcace7e9006718fd698f323ec3c239685ffdbbd2266d2212aa94849accc26e7e9aa2a54f6ed1de275c359600dac1545df9b353f5bd4269dada39
6
+ metadata.gz: 6b51375e2029213db4c514f95b3ea0c73fd8ecd7638b99166eaf3fe92b1574e64b152ca7ae8c73ef105e689932bb02fa5260bfbaf2bc01d418210da278900347
7
+ data.tar.gz: e6991967a04e3b5fb00af6495ef23b33d4596dee2ac17b02d115c62e6b9f9db6f68d5090f8f18f6c98a35bab98238eb914e5ac68704075bcc99da138a1bb4635
@@ -45,6 +45,18 @@
45
45
 
46
46
  init: () ->
47
47
  @map = new BMap.Map("baidumap")
48
+ real_point = new BMap.Point("#{field.value.try :x}", "#{field.value.try :y}")
49
+ default_point = new BMap.Point("#{field.default_longitude}", "#{field.default_latitude}")
50
+ if isNaN(real_point.lat) or isNaN(real_point.lng)
51
+ point = default_point
52
+ else
53
+ point = real_point
54
+
55
+ @show_point(point)
56
+ @map.centerAndZoom(point, 14)
57
+ @map.enableScrollWheelZoom();
58
+ @local = new BMap.LocalSearch(@map,renderOptions:{map: @map, panel:"baidumap_result"})
59
+
48
60
  @POINT = null
49
61
 
50
62
  jQuery('#baidumap_comfirm').on 'click', (e)=>
@@ -54,25 +66,16 @@
54
66
  jQuery('#baidumap_modal').modal('hide')
55
67
  else
56
68
  alert '请在地图中标注坐标点!'
69
+
70
+ jQuery('#baidumap_modal').on 'shown.bs.modal', ()=>
71
+ @map.panTo point
72
+
57
73
 
58
74
  jQuery('#search').on 'click', (e)->
59
75
  e.preventDefault()
60
- local.search $('#search-input').val()
76
+ @local.search $('#search-input').val()
61
77
 
62
- jQuery('#baidumap_modal').on 'shown.bs.modal', =>
63
- real_point = new BMap.Point("#{field.value.try :x}", "#{field.value.try :y}")
64
- default_point = new BMap.Point("#{field.default_latitude}", "#{field.default_longitude}")
65
-
66
- if isNaN(real_point.lat) or isNaN(real_point.lng)
67
- point = default_point
68
- else
69
- point = real_point
70
- @show_point(point)
71
-
72
- @map.centerAndZoom(point, 14)
73
- @map.enableScrollWheelZoom();
74
- local = new BMap.LocalSearch(@map,renderOptions:{map: @map, panel:"baidumap_result"})
75
-
78
+
76
79
  @map.addEventListener 'click', (e)=>
77
80
  @show_point(e.point)
78
81
 
@@ -1,3 +1,3 @@
1
1
  module RailsAdminBaiduMap
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_admin_baidu_map
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - TangMonk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-12 00:00:00.000000000 Z
11
+ date: 2015-04-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Support PostGis And Mongoid
14
14
  email: