gmpoint 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +13 -1
- data/VERSION +1 -1
- data/app/assets/javascripts/locations.js.coffee +2 -4
- data/app/helpers/gmpoint/gmpoint_helper.rb +4 -2
- data/gmpoint.gemspec +2 -2
- metadata +3 -3
data/README.markdown
CHANGED
@@ -15,7 +15,19 @@ This is gem for help to point on google map. You can marker your address and sea
|
|
15
15
|
|
16
16
|
## Usage
|
17
17
|
|
18
|
-
###
|
18
|
+
### Registry google map key and add google map key in your head tag in application.html.erb
|
19
|
+
|
20
|
+
<%= google_map_api_js("your google api key") %>
|
21
|
+
|
22
|
+
### Require locations.coffee.js into your application.js
|
23
|
+
|
24
|
+
.....
|
25
|
+
//= require locations
|
26
|
+
.....
|
27
|
+
|
28
|
+
|
29
|
+
### Add code below into any where if you want to display the map :
|
30
|
+
|
19
31
|
<%= show_map_helper your_model %>
|
20
32
|
|
21
33
|
Example:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
@@ -12,7 +12,8 @@ window.initJsMap = ->
|
|
12
12
|
|
13
13
|
|
14
14
|
window.gmpoint_map = new google.maps.Map(document.getElementById("map_canvas"), opts)
|
15
|
-
window.gmpoint_marker = new google.maps.Marker({position: opts.center, draggable:
|
15
|
+
window.gmpoint_marker = new google.maps.Marker({position: opts.center, draggable: true})
|
16
|
+
window.gmpoint_info_window = new google.maps.InfoWindow({})
|
16
17
|
window.gmpoint_map.setCenter(window.gmpoint_marker.getPosition(), 16)
|
17
18
|
window.gmpoint_info_window.close()
|
18
19
|
window.gmpoint_marker.setMap(window.gmpoint_map)
|
@@ -37,9 +38,6 @@ window.geopoint_search_map = (dom) ->
|
|
37
38
|
window.geopoint_handle = (attr)->
|
38
39
|
$("#gmpoint_location_latitude").val(attr.lat())
|
39
40
|
$("#gmpoint_location_longitude").val(attr.lng())
|
40
|
-
window.gmpoint_info_window = new google.maps.InfoWindow({
|
41
|
-
size: new google.maps.Size(20, 20)
|
42
|
-
})
|
43
41
|
window.gmpoint_marker.setPosition(attr)
|
44
42
|
geocoder = new google.maps.Geocoder()
|
45
43
|
if $("#gmpoint_map_allow").attr('value') == "point"
|
@@ -8,6 +8,8 @@ module Gmpoint::GmpointHelper
|
|
8
8
|
|
9
9
|
object = model_name.to_s.singularize.classify.constantize.find(params[:id])
|
10
10
|
@address = object.location_address
|
11
|
+
@latitude = object.location_latitude
|
12
|
+
@longitude = object.location_longitude
|
11
13
|
opts = {allow: 'show', searchbox: 'show', width: 800, height: 400, latitude: 1.3667, longitude: 103.75, zoom: 13, style: "border: 1px solid #green;", searchbox_width: 400}.merge(opts)
|
12
14
|
[
|
13
15
|
content_tag(:div, :id => "geopoint_search_box_container", style: "width: #{opts[:searchbox_width]}px; margin: 0 auto; margin-bottom: 10px; display: #{opts[:searchbox]}") do
|
@@ -16,8 +18,8 @@ module Gmpoint::GmpointHelper
|
|
16
18
|
content_tag(:div, '', id: "map_canvas", style: "width: #{opts[:width]}px; height: #{opts[:height]}px; #{opts[:style]}"),
|
17
19
|
content_tag(:div, '', class: "data-location", data: {model: model_name, latitude: opts[:latitude] , longitude: opts[:longitude] , zoom: opts[:zoom]}),
|
18
20
|
tag(:input, type: :hidden, value: "#{opts[:allow]}", name: "allow", id: "gmpoint_map_allow"),
|
19
|
-
tag(:input, type: :hidden, value:
|
20
|
-
tag(:input, type: :hidden, value:
|
21
|
+
tag(:input, type: :hidden, value: "#{@latitude}", name: "#{model_name}[location_latitude]", id: "gmpoint_location_latitude"),
|
22
|
+
tag(:input, type: :hidden, value: "#{@longitude}", name: "#{model_name}[location_longitude]", id: "gmpoint_location_longitude"),
|
21
23
|
tag(:input, type: :hidden, value: "#{@address}", name: "#{model_name}[location_address]", id: "gmpoint_location_address"),
|
22
24
|
javascript_tag("window.initJsMap();")
|
23
25
|
].join.html_safe
|
data/gmpoint.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "gmpoint"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Peter Dang"]
|
12
|
-
s.date = "2013-
|
12
|
+
s.date = "2013-02-06"
|
13
13
|
s.description = "Help to point on Goolge Map Description"
|
14
14
|
s.email = "peter@rubify.com"
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gmpoint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: geocoder
|
@@ -150,7 +150,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
150
150
|
version: '0'
|
151
151
|
segments:
|
152
152
|
- 0
|
153
|
-
hash: -
|
153
|
+
hash: -1134795745359954278
|
154
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
155
|
none: false
|
156
156
|
requirements:
|