pointable 0.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 +7 -0
- data/.gitignore +11 -0
- data/Gemfile +4 -0
- data/README.md +43 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/pointable.rb +8 -0
- data/lib/pointable/engine.rb +4 -0
- data/lib/pointable/helpers.rb +18 -0
- data/lib/pointable/railtie.rb +10 -0
- data/lib/pointable/version.rb +3 -0
- data/pointable.gemspec +31 -0
- data/vendor/assets/javascripts/pointable.js +49 -0
- metadata +85 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2c3f5816592951ea547629a1ab75d9a8d0e996f5
|
4
|
+
data.tar.gz: 7a768aa15c4672de0a7030300dee02ab215d7d75
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f1898c606b1e1375bd4e9796ca9baf2599b3ea71a7461acd1ec5a559379f0a41dd55c5b842802eb5b260078b632cd1016c61f74ac1e54d163d4bdcdfeb793442
|
7
|
+
data.tar.gz: 1ab2a45a92e52fbb2c79678344bd0950a885db69d9b32a440bd779f12c3307d051945071c792ca700a2c714a2f06a8df64fc295a001eb3391bbcc98b5816492c
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Pointable
|
2
|
+
|
3
|
+
Simple google maps helpers to draw map with points.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'pointable'
|
11
|
+
```
|
12
|
+
|
13
|
+
Include javascript google maps api by adding line to layout
|
14
|
+
```erb
|
15
|
+
<%= javascript_include_tag 'https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true' %>
|
16
|
+
```
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
Add one of map helpers and pass id to customize styles of maps.
|
20
|
+
|
21
|
+
By Place:
|
22
|
+
```erb
|
23
|
+
<%= place_map place: 'New York', id: 'first-example-id' %>
|
24
|
+
```
|
25
|
+
|
26
|
+
By Coordinates:
|
27
|
+
```erb
|
28
|
+
<%= coordinates_map latitude: -25.363882, longitude: 131.044922, id: 'second-example-id' %>
|
29
|
+
```
|
30
|
+
Customize styles:
|
31
|
+
```css
|
32
|
+
#first-example-id {
|
33
|
+
width: 1000px;
|
34
|
+
height: 300px;
|
35
|
+
}
|
36
|
+
```
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
1. Fork it ( https://github.com/[my-github-username]/pointable/fork )
|
40
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
41
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
42
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
43
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "pointable"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/pointable.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'pointable/version'
|
2
|
+
|
3
|
+
module Pointable
|
4
|
+
module Helpers
|
5
|
+
|
6
|
+
def place_map options
|
7
|
+
default = { place: '', id: '' }
|
8
|
+
options = default.merge options
|
9
|
+
"<div class='pointable' data-place='#{options[:place]}' id='#{options[:id]}'> </div>".html_safe
|
10
|
+
end
|
11
|
+
|
12
|
+
def coordinates_map options
|
13
|
+
default = { latitude: -25.363882, longitude: 131.044922, id: '' }
|
14
|
+
options = default.merge options
|
15
|
+
"<div class='pointable' data-lat='#{options[:latitude]}' data-lng='#{options[:longitude]}' id='#{options[:id]}'> </div>".html_safe
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/pointable.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'pointable/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "pointable"
|
8
|
+
spec.version = Pointable::VERSION
|
9
|
+
spec.authors = ["Bogdan"]
|
10
|
+
spec.email = ["iamkidjoe@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Google map generator}
|
13
|
+
spec.description = %q{Simple google maps helpers to draw map with points}
|
14
|
+
spec.homepage = "https://github.com/iamkidjoe/pointable"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
17
|
+
# delete this section to allow pushing this gem to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
20
|
+
else
|
21
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
22
|
+
end
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
var pointable = function() {
|
2
|
+
var maps = document.getElementsByClassName('pointable');
|
3
|
+
|
4
|
+
for (var i = 0; i < maps.length; i++) {
|
5
|
+
map = initialize(maps[i]);
|
6
|
+
|
7
|
+
if (maps[i].hasAttribute("data-place")) {
|
8
|
+
byString(map, maps[i].getAttribute("data-place"));
|
9
|
+
} else if (maps[i].hasAttribute("data-lat") && maps[i].hasAttribute("data-lng")) {
|
10
|
+
byCoordinates(map, maps[i].getAttribute("data-lat"), maps[i].getAttribute("data-lng"))
|
11
|
+
}
|
12
|
+
}
|
13
|
+
};
|
14
|
+
|
15
|
+
var initialize = function (element) {
|
16
|
+
map = new google.maps.Map(element, {
|
17
|
+
zoom: 8
|
18
|
+
});
|
19
|
+
return map;
|
20
|
+
};
|
21
|
+
|
22
|
+
var byCoordinates = function(map, lat,lng)
|
23
|
+
{
|
24
|
+
var myLatlng = new google.maps.LatLng(lat,lng);
|
25
|
+
map.setCenter(myLatlng);
|
26
|
+
var marker = new google.maps.Marker({
|
27
|
+
position: myLatlng,
|
28
|
+
map: map
|
29
|
+
});
|
30
|
+
};
|
31
|
+
|
32
|
+
|
33
|
+
var byString = function(map, place) {
|
34
|
+
geocoder = new google.maps.Geocoder();
|
35
|
+
|
36
|
+
geocoder.geocode( { 'address': place}, function(results, status) {
|
37
|
+
if (status == google.maps.GeocoderStatus.OK) {
|
38
|
+
map.setCenter(results[0].geometry.location);
|
39
|
+
var marker = new google.maps.Marker({
|
40
|
+
map: map,
|
41
|
+
position: results[0].geometry.location
|
42
|
+
});
|
43
|
+
} else {
|
44
|
+
element.remove();
|
45
|
+
}
|
46
|
+
});
|
47
|
+
};
|
48
|
+
|
49
|
+
window.onload = function() { pointable() };
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pointable
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bogdan
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: Simple google maps helpers to draw map with points
|
42
|
+
email:
|
43
|
+
- iamkidjoe@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- README.md
|
51
|
+
- Rakefile
|
52
|
+
- bin/console
|
53
|
+
- bin/setup
|
54
|
+
- lib/pointable.rb
|
55
|
+
- lib/pointable/engine.rb
|
56
|
+
- lib/pointable/helpers.rb
|
57
|
+
- lib/pointable/railtie.rb
|
58
|
+
- lib/pointable/version.rb
|
59
|
+
- pointable.gemspec
|
60
|
+
- vendor/assets/javascripts/pointable.js
|
61
|
+
homepage: https://github.com/iamkidjoe/pointable
|
62
|
+
licenses: []
|
63
|
+
metadata:
|
64
|
+
allowed_push_host: https://rubygems.org
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 2.4.7
|
82
|
+
signing_key:
|
83
|
+
specification_version: 4
|
84
|
+
summary: Google map generator
|
85
|
+
test_files: []
|