leaflet_helper 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -9
- data/example/Gemfile.lock +1 -1
- data/leaflet_helper.gemspec +9 -11
- data/lib/leaflet_helper/l.rb +5 -0
- data/lib/leaflet_helper.rb +1 -1
- data/lib/templates/cluster_icon_create_function.js.erb +5 -0
- data/lib/templates/marker_support.js.erb +3 -1
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c26717c7956c6e6c22666260c4d4bd09f70e599
|
4
|
+
data.tar.gz: 6803a55fa2c1a83f06d9992781cf8c95ee7051f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25229dd0d7ada096415e16b0617ad1d4a6ba14253fa6b01c4612ee9dc8e6ee47fdc0b2a7206ac806f6b3df2978bcdc262a54d693cf271c8f47835361e299a783
|
7
|
+
data.tar.gz: 4058134528c90a684a907216d63e24d99a57a2bab3772a69ac5e2108853dd019b62c235124d539bf00edea696e16276ff98ff81213f68d6e474d660f18875b9d
|
data/README.md
CHANGED
@@ -1,21 +1,33 @@
|
|
1
1
|
# LeafletHelper
|
2
2
|
|
3
3
|
For those of us who don't want to get our hands dirty writing JavaScript (shutter) this library is
|
4
|
-
for you. Actually, its for me, but you can use it if you like.
|
5
|
-
|
4
|
+
for you. Actually, its for me, but you can use it if you like. It is a Ruby-wrapper around some
|
5
|
+
basic leaflet.js functions. It uses either Open Street Map or your account on mapbox.com. It handles
|
6
|
+
markers on maps and the clustering of those markers. It supports multiple maps per web page.
|
7
|
+
|
8
|
+
This gem has a simple Sinatra-based web application that demonstrates its use.
|
9
|
+
|
10
|
+
Launch the example web-app using a bash-based terminal like this:
|
6
11
|
|
7
12
|
```bash
|
8
|
-
|
13
|
+
lh=`gem which leaflet_helper`
|
14
|
+
pushd `dirname $lh`/../example
|
15
|
+
bundle install
|
16
|
+
./start
|
17
|
+
# open your web browser to http://localhost:4567
|
18
|
+
# control-C to stop the example
|
19
|
+
# popd to return to your current directory
|
9
20
|
```
|
10
21
|
|
11
|
-
Then `cd` to the root directory of the gem. There you will find a subdirectory named `example` in
|
12
|
-
which there is a simple Sinatra-based web application that demonstrates how to use this gem.
|
13
|
-
|
14
22
|
## Recent Changes
|
15
23
|
|
16
|
-
|
24
|
+
This is it for a while. Its doing all I wanted it to do. There is at least 1 outstanding
|
25
|
+
issue which prevents good multi-map support. When I fix it, I will bump the version to 0.7.7
|
26
|
+
to reflect the version of the leaflet.js library that this thing uses.
|
17
27
|
|
18
|
-
|
28
|
+
### v0.0.9 - released
|
29
|
+
|
30
|
+
* added support for cluster_marker to defaults hash on init.
|
19
31
|
|
20
32
|
### v0.0.8 - released
|
21
33
|
|
@@ -88,10 +100,13 @@ The 'options' is a hash. It defaults to:
|
|
88
100
|
|
89
101
|
```
|
90
102
|
|
103
|
+
There is also a `cluster_marker` default used to create markers for clusters. The
|
104
|
+
default function is maintained in the file [cluster_icon_create_function.js.erb](https://github.com/MadBomber/leaflet_helper/blob/master/lib/templates/cluster_icon_create_function.js.erb).
|
105
|
+
|
91
106
|
|
92
107
|
### LeafletHelper::L.place_map_here(id='map', options={})
|
93
108
|
|
94
|
-
The
|
109
|
+
The `place_map_here` method is used to insert the HTML `<div>` tag into the
|
95
110
|
body of a webpage. This is the HTML container which will host the map image
|
96
111
|
managed by the LeafletJS library. If is possible to have several map images
|
97
112
|
displayed on the same webpage; HOWEVER, each map image MUST have a different
|
data/example/Gemfile.lock
CHANGED
data/leaflet_helper.gemspec
CHANGED
@@ -4,23 +4,21 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "leaflet_helper"
|
7
|
-
spec.version = '0.0.
|
7
|
+
spec.version = '0.0.9'
|
8
8
|
spec.authors = ["Dewayne VanHoozer"]
|
9
9
|
spec.email = ["dvanhoozer@gmail.com"]
|
10
10
|
|
11
|
-
spec.summary = %q{A Ruby-wrapper around leaflet.js}
|
12
|
-
spec.description =
|
11
|
+
spec.summary = %q{A Ruby-wrapper around some basic leaflet.js functions}
|
12
|
+
spec.description = <<~EOS
|
13
|
+
For those of us who don't want to get our hands dirty writing JavaScript (shutter) this library is
|
14
|
+
for you. Actually, its for me, but you can use it if you like. It is a Ruby-wrapper around some
|
15
|
+
basic leaflet.js functions. It uses either Open Street Map or your account on mapbox.com. It handles
|
16
|
+
markers on maps and the clustering of those markers. It supports multiple maps per web page.
|
17
|
+
EOS
|
18
|
+
|
13
19
|
spec.homepage = "http://github.com/MadBomber/leaflet_helper"
|
14
20
|
spec.license = "You want it? Its yours!"
|
15
21
|
|
16
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
-
# if spec.respond_to?(:metadata)
|
19
|
-
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
20
|
-
# else
|
21
|
-
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
22
|
-
# end
|
23
|
-
|
24
22
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
23
|
spec.require_paths = ["lib"]
|
26
24
|
|
data/lib/leaflet_helper/l.rb
CHANGED
@@ -31,6 +31,11 @@ module LeafletHelper
|
|
31
31
|
# intended for the the head section of a web page
|
32
32
|
def init(options={})
|
33
33
|
@@defaults.merge! options
|
34
|
+
|
35
|
+
if cluster? && @@defaults[:cluster_marker].nil?
|
36
|
+
@@defaults[:cluster_marker] = U.pull_in('cluster_icon_create_function.js.erb',{})
|
37
|
+
end
|
38
|
+
|
34
39
|
return U.pull_in 'head.html.erb', @@defaults
|
35
40
|
end # def init
|
36
41
|
|
data/lib/leaflet_helper.rb
CHANGED
@@ -24,8 +24,8 @@ AREA51.longitude = -115.811111
|
|
24
24
|
|
25
25
|
require 'leaflet_helper/string_template' # Lets do simple string templates
|
26
26
|
require 'leaflet_helper/manage_markers' # Lets keep track of some markers
|
27
|
-
require 'leaflet_helper/l' # wrapper class for LeafletJS
|
28
27
|
require 'leaflet_helper/u' # a utility class
|
28
|
+
require 'leaflet_helper/l' # wrapper class for LeafletJS
|
29
29
|
|
30
30
|
|
31
31
|
module LeafletHelper
|
@@ -48,7 +48,9 @@ function stateChangedFor<%= @id %>() {
|
|
48
48
|
if (ajaxRequestFor<%= @id %>.readyState == 4) {
|
49
49
|
|
50
50
|
<% if cluster? %>
|
51
|
-
var markersFor<%= @id %> = L.markerClusterGroup(
|
51
|
+
var markersFor<%= @id %> = L.markerClusterGroup(
|
52
|
+
<%= @cluster_marker %>
|
53
|
+
);
|
52
54
|
<% end %>
|
53
55
|
|
54
56
|
// use the info here that was returned
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leaflet_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dewayne VanHoozer
|
@@ -52,7 +52,11 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.0'
|
55
|
-
description:
|
55
|
+
description: |
|
56
|
+
For those of us who don't want to get our hands dirty writing JavaScript (shutter) this library is
|
57
|
+
for you. Actually, its for me, but you can use it if you like. It is a Ruby-wrapper around some
|
58
|
+
basic leaflet.js functions. It uses either Open Street Map or your account on mapbox.com. It handles
|
59
|
+
markers on maps and the clustering of those markers. It supports multiple maps per web page.
|
56
60
|
email:
|
57
61
|
- dvanhoozer@gmail.com
|
58
62
|
executables: []
|
@@ -83,6 +87,7 @@ files:
|
|
83
87
|
- lib/leaflet_helper/u.rb
|
84
88
|
- lib/templates/add_mapbox_layer.js.erb
|
85
89
|
- lib/templates/add_openstreetmap_layer.js.erb
|
90
|
+
- lib/templates/cluster_icon_create_function.js.erb
|
86
91
|
- lib/templates/head.html.erb
|
87
92
|
- lib/templates/map_div.html.erb
|
88
93
|
- lib/templates/marker_support.js.erb
|
@@ -111,5 +116,5 @@ rubyforge_project:
|
|
111
116
|
rubygems_version: 2.6.4
|
112
117
|
signing_key:
|
113
118
|
specification_version: 4
|
114
|
-
summary: A Ruby-wrapper around leaflet.js
|
119
|
+
summary: A Ruby-wrapper around some basic leaflet.js functions
|
115
120
|
test_files: []
|