jekyll-maps 2.0.0 → 2.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 +4 -4
- data/.rubocop.yml +11 -0
- data/.travis.yml +2 -0
- data/Gemfile +1 -1
- data/History.md +5 -0
- data/README.md +35 -3
- data/Rakefile +3 -3
- data/jekyll-maps.gemspec +1 -0
- data/lib/jekyll-maps/google_map_api.js +11 -8
- data/lib/jekyll-maps/google_map_tag.rb +1 -0
- data/lib/jekyll-maps/location_finder.rb +8 -1
- data/lib/jekyll-maps/options_parser.rb +1 -0
- data/lib/jekyll-maps/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2839acbbfb16951bd477def2dba07291bb91138
|
4
|
+
data.tar.gz: c2e49939d84003b196940a466fa10761ff735678
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56ea3c0abad7154d3879424cc55984f32083c02abb2575b9fd59b481cf78b712a0062ad345255b0086b51ca1d4caf29810416909afd9e6a9df0075dafb0f804f
|
7
|
+
data.tar.gz: c411f5e64cd2cd995aec23fd1f0f2939a738f07d1bdcc2ae9b58e3281c2ebc1f040868d1fcb626e5738d6daaa141cf174e9eb563736f5f1537925f704e7d9210
|
data/.rubocop.yml
CHANGED
@@ -12,6 +12,9 @@ Lint/UselessAccessModifier:
|
|
12
12
|
Enabled: false
|
13
13
|
Metrics/AbcSize:
|
14
14
|
Max: 20
|
15
|
+
Metrics/BlockLength:
|
16
|
+
Exclude:
|
17
|
+
- spec/**/*.rb
|
15
18
|
Metrics/ClassLength:
|
16
19
|
Max: 300
|
17
20
|
Exclude:
|
@@ -19,6 +22,10 @@ Metrics/ClassLength:
|
|
19
22
|
Metrics/CyclomaticComplexity:
|
20
23
|
Max: 8
|
21
24
|
Metrics/LineLength:
|
25
|
+
Exclude:
|
26
|
+
- Rakefile
|
27
|
+
- Gemfile
|
28
|
+
- jekyll-maps.gemspec
|
22
29
|
Max: 90
|
23
30
|
Severity: warning
|
24
31
|
Metrics/MethodLength:
|
@@ -114,3 +121,7 @@ Style/StringLiteralsInInterpolation:
|
|
114
121
|
EnforcedStyle: double_quotes
|
115
122
|
Style/UnneededCapitalW:
|
116
123
|
Enabled: false
|
124
|
+
Style/IndentHeredoc:
|
125
|
+
Enabled: false
|
126
|
+
Style/SymbolArray:
|
127
|
+
Enabled: false
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/History.md
CHANGED
data/README.md
CHANGED
@@ -28,6 +28,18 @@ GoogleMaps Marker Clusterer can be used if you have many points within close pro
|
|
28
28
|
|
29
29
|
## Usage
|
30
30
|
|
31
|
+
### Configure Google API Key
|
32
|
+
|
33
|
+
To be able to use Google Maps you need to obtain [API Key](https://developers.google.com/maps/documentation/javascript/get-api-key).
|
34
|
+
|
35
|
+
Once you have your API Key you need to add it to Jekyll's `_config.yml`:
|
36
|
+
|
37
|
+
```yml
|
38
|
+
maps:
|
39
|
+
google:
|
40
|
+
api_key: <YOUR_KEY>
|
41
|
+
```
|
42
|
+
|
31
43
|
### Data Source
|
32
44
|
|
33
45
|
First, add location information to your posts YAML front-matter:
|
@@ -54,16 +66,36 @@ Alternatively, you can add location info to your custom collection's documents o
|
|
54
66
|
longitude: -3.8196204
|
55
67
|
```
|
56
68
|
|
57
|
-
|
69
|
+
By default this plugin will display location from the page it's placed on:
|
58
70
|
|
59
71
|
```
|
60
72
|
{% google_map %}
|
61
73
|
```
|
62
74
|
|
75
|
+
But you can use src attribute to load locations from other places, like posts, collections or data files!
|
76
|
+
|
77
|
+
For example, this map will show locations from all posts from 2016:
|
78
|
+
|
79
|
+
```
|
80
|
+
{% google_map src="_posts/2016" %}
|
81
|
+
```
|
82
|
+
|
83
|
+
This map will show locations from a collection called 'my_collection':
|
84
|
+
|
85
|
+
```
|
86
|
+
{% google_map src="_collections/my_collection" %}
|
87
|
+
```
|
88
|
+
|
89
|
+
This map will show locations from all data files located in 'my_points' sub-folder:
|
90
|
+
|
91
|
+
```
|
92
|
+
{% google_map src="_data/my_points" %}
|
93
|
+
```
|
94
|
+
|
63
95
|
You can configure map's dimensions and assign custom CSS class to the element:
|
64
96
|
|
65
97
|
```
|
66
|
-
{% google_map width
|
98
|
+
{% google_map width="100%" height="400" class="my-map" %}
|
67
99
|
```
|
68
100
|
|
69
101
|
### Filters
|
@@ -72,7 +104,7 @@ You can also filter which locations to display on the map!<br/>
|
|
72
104
|
For instance, following tag will only display locations from documents which have `lang: en` in their front-matter data.
|
73
105
|
|
74
106
|
```
|
75
|
-
{% google_map lang
|
107
|
+
{% google_map src="_posts" lang="en" %}
|
76
108
|
```
|
77
109
|
|
78
110
|
### Marker Cluster
|
data/Rakefile
CHANGED
data/jekyll-maps.gemspec
CHANGED
@@ -66,6 +66,9 @@ var jekyllMaps = (function () {
|
|
66
66
|
|
67
67
|
function createMarker (location) {
|
68
68
|
var position = new google.maps.LatLng(location.latitude, location.longitude)
|
69
|
+
bounds.extend(position)
|
70
|
+
if (!mapOptions.showMarker) return false
|
71
|
+
|
69
72
|
var marker = new google.maps.Marker({
|
70
73
|
position: position,
|
71
74
|
title: location.title,
|
@@ -73,21 +76,21 @@ var jekyllMaps = (function () {
|
|
73
76
|
url: location.url,
|
74
77
|
map: map
|
75
78
|
})
|
76
|
-
|
77
|
-
bounds.extend(position)
|
78
79
|
if (mapOptions.showMarkerPopup) marker.addListener('click', markerPopup)
|
79
80
|
|
80
81
|
return marker
|
81
82
|
}
|
82
83
|
|
83
84
|
function markerPopup () {
|
84
|
-
var
|
85
|
-
var
|
86
|
-
if (this.
|
87
|
-
|
85
|
+
var contentHtml = '<div class="map-info-window"><h5>' + this.title + '</h5>'
|
86
|
+
var imageHtml = '<img src="' + this.image + '" alt="' + this.title + '"/>'
|
87
|
+
if (this.url.length > 0) {
|
88
|
+
var linkText = this.image.length > 0 ? imageHtml : 'View'
|
89
|
+
contentHtml += '<a href="' + this.url + '">' + linkText + '</a></div>'
|
90
|
+
} else if (this.image.length > 0) {
|
91
|
+
contentHtml += imageHtml
|
88
92
|
}
|
89
|
-
|
90
|
-
infoWindow.setContent(contentString)
|
93
|
+
infoWindow.setContent(contentHtml)
|
91
94
|
infoWindow.open(map, this)
|
92
95
|
}
|
93
96
|
}
|
@@ -72,11 +72,18 @@ module Jekyll
|
|
72
72
|
:latitude => document["location"]["latitude"],
|
73
73
|
:longitude => document["location"]["longitude"],
|
74
74
|
:title => document["title"],
|
75
|
-
:url => document
|
75
|
+
:url => fetch_url(document),
|
76
76
|
:image => document["image"] || ""
|
77
77
|
}
|
78
78
|
end
|
79
79
|
end
|
80
|
+
|
81
|
+
private
|
82
|
+
def fetch_url(document)
|
83
|
+
return document["url"] if document.is_a?(Hash) && document.key?("url")
|
84
|
+
return document.url if document.respond_to? :url
|
85
|
+
return ""
|
86
|
+
end
|
80
87
|
end
|
81
88
|
end
|
82
89
|
end
|
data/lib/jekyll-maps/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-maps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anatoliy Yastreb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|