geo_scaffold 0.1.0 → 0.1.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/Gemfile.lock +55 -0
- data/geo_scaffold-0.1.0.gem +0 -0
- data/lib/generators/geo_scaffold/controller_generator.rb +1 -0
- data/lib/generators/geo_scaffold/templates/views/_form.html.erb +17 -18
- data/lib/generators/geo_scaffold/templates/views/index.html.erb +1 -25
- data/lib/generators/geo_scaffold/templates/views/index.json.jbuilder +12 -0
- data/lib/generators/geo_scaffold/templates/views/show.html.erb +8 -0
- data/lib/geo_scaffold/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0eb99378115c1847ce75109f0a62c9baa36876e04521cf71630e9bfcb4f8f9f
|
4
|
+
data.tar.gz: cee980365d40d888ba680f4d89be8536f9a4b3856895857b3006144968ffca85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e7517a4483772ec1af4d0ac655ee388c1fa1ebae05462405ab552546b935af532c4e4cfa994637583c383cd1af9265c37c5847c4d09c5d989ea1394f7066a4d
|
7
|
+
data.tar.gz: 953ea7bc449933c9c760ddb6130d6f5aec923cc123284065c0e4f18bbd10e205529b8d02185e1f089599e720909198110ade6720f97e9a4d2cf32057a3212743
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
geo_scaffold (0.1.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.2)
|
10
|
+
diff-lcs (1.5.0)
|
11
|
+
parallel (1.21.0)
|
12
|
+
parser (3.0.3.2)
|
13
|
+
ast (~> 2.4.1)
|
14
|
+
rainbow (3.0.0)
|
15
|
+
rake (13.0.6)
|
16
|
+
regexp_parser (2.2.0)
|
17
|
+
rexml (3.2.5)
|
18
|
+
rspec (3.10.0)
|
19
|
+
rspec-core (~> 3.10.0)
|
20
|
+
rspec-expectations (~> 3.10.0)
|
21
|
+
rspec-mocks (~> 3.10.0)
|
22
|
+
rspec-core (3.10.1)
|
23
|
+
rspec-support (~> 3.10.0)
|
24
|
+
rspec-expectations (3.10.1)
|
25
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
26
|
+
rspec-support (~> 3.10.0)
|
27
|
+
rspec-mocks (3.10.2)
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
+
rspec-support (~> 3.10.0)
|
30
|
+
rspec-support (3.10.3)
|
31
|
+
rubocop (1.24.1)
|
32
|
+
parallel (~> 1.10)
|
33
|
+
parser (>= 3.0.0.0)
|
34
|
+
rainbow (>= 2.2.2, < 4.0)
|
35
|
+
regexp_parser (>= 1.8, < 3.0)
|
36
|
+
rexml
|
37
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
38
|
+
ruby-progressbar (~> 1.7)
|
39
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
40
|
+
rubocop-ast (1.15.1)
|
41
|
+
parser (>= 3.0.1.1)
|
42
|
+
ruby-progressbar (1.11.0)
|
43
|
+
unicode-display_width (2.1.0)
|
44
|
+
|
45
|
+
PLATFORMS
|
46
|
+
ruby
|
47
|
+
|
48
|
+
DEPENDENCIES
|
49
|
+
geo_scaffold!
|
50
|
+
rake (~> 13.0)
|
51
|
+
rspec (~> 3.0)
|
52
|
+
rubocop (~> 1.21)
|
53
|
+
|
54
|
+
BUNDLED WITH
|
55
|
+
2.0.1
|
Binary file
|
@@ -26,11 +26,9 @@
|
|
26
26
|
<% elsif attribute.attachments? -%>
|
27
27
|
<%%= form.label :<%= attribute.column_name %>, style: "display: block" %>
|
28
28
|
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, multiple: true %>
|
29
|
-
<% elsif attribute.column_name == 'lat' || attribute.column_name == 'lng' %>
|
30
|
-
<%%= form.hidden_field :<%= attribute.column_name %> %>
|
31
29
|
<% else -%>
|
32
30
|
<%%= form.label :<%= attribute.column_name %>, style: "display: block" %>
|
33
|
-
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %> %>
|
31
|
+
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, readonly: <%= attribute.column_name == 'lat' || attribute.column_name == 'lng' %> %>
|
34
32
|
<% end -%>
|
35
33
|
</div>
|
36
34
|
|
@@ -42,29 +40,30 @@
|
|
42
40
|
|
43
41
|
<script>
|
44
42
|
document.addEventListener('turbo:load', () => {
|
45
|
-
|
46
|
-
<%% if <%= singular_table_name %>.new_record? %>
|
47
|
-
const center = [139.7673068, 35.6809591]
|
48
|
-
<%% else %>
|
49
|
-
const center = [<%%= <%= singular_table_name %>.lng %>, <%%= <%= singular_table_name %>.lat %>]
|
50
|
-
<%% end %>
|
43
|
+
const center = <%%= <%= singular_table_name %>.new_record? ? [139.7673068, 35.6809591] : [<%= singular_table_name %>.lng, <%= singular_table_name %>.lat] %>
|
51
44
|
const map = new geolonia.Map({
|
52
45
|
container: 'map',
|
53
46
|
center: center,
|
54
|
-
zoom: 16
|
55
|
-
})
|
56
|
-
const marker = new geolonia.Marker({
|
57
|
-
draggable: true
|
47
|
+
zoom: <%%= <%= singular_table_name %>.new_record? ? 14 : 16 %>
|
58
48
|
})
|
59
|
-
|
60
|
-
|
49
|
+
const marker = new geolonia.Marker()
|
50
|
+
|
51
|
+
<%% if !<%= singular_table_name %>.new_record? %>
|
52
|
+
marker.setLngLat(center).addTo(map)
|
53
|
+
<%% end %>
|
54
|
+
|
55
|
+
function onClick(e) {
|
56
|
+
const lngLat = e.lngLat
|
57
|
+
|
58
|
+
if (marker) {
|
59
|
+
marker.remove()
|
60
|
+
}
|
61
61
|
|
62
|
-
|
63
|
-
const lngLat = marker.getLngLat()
|
62
|
+
marker.setLngLat([lngLat.lng, lngLat.lat]).addTo(map)
|
64
63
|
document.querySelector("#<%= singular_table_name %>_lng").value = lngLat.lng
|
65
64
|
document.querySelector("#<%= singular_table_name %>_lat").value = lngLat.lat
|
66
65
|
}
|
67
66
|
|
68
|
-
|
67
|
+
map.on('click', onClick)
|
69
68
|
})
|
70
69
|
</script>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
<h1><%= human_name.pluralize %></h1>
|
4
4
|
|
5
|
-
<div class="geolonia" data-geojson="
|
5
|
+
<div class="geolonia" data-geojson="/<%= plural_table_name %>.json" style="height:300px;"></div>
|
6
6
|
|
7
7
|
<div id="<%= plural_table_name %>">
|
8
8
|
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
|
@@ -15,28 +15,4 @@
|
|
15
15
|
|
16
16
|
<%%= link_to "New <%= human_name.downcase %>", <%= new_helper(type: :path) %>, data: {turbo: false} %>
|
17
17
|
|
18
|
-
<script id="example-geojson" type="application/json">
|
19
|
-
{
|
20
|
-
"type": "FeatureCollection",
|
21
|
-
"features": [
|
22
|
-
<%% @<%= plural_table_name %>.each_with_index do |<%= singular_table_name %>, i| %>
|
23
|
-
{
|
24
|
-
"type": "Feature",
|
25
|
-
"properties": {
|
26
|
-
"title": "<%%= <%= singular_table_name %>.name %>",
|
27
|
-
"description": "<a href='/<%= plural_table_name %>/<%%= <%= singular_table_name %>.id %>'><%%= <%= singular_table_name %>.name %></a>"
|
28
|
-
},
|
29
|
-
"geometry": {
|
30
|
-
"type": "Point",
|
31
|
-
"coordinates": [
|
32
|
-
<%%= <%= singular_table_name %>.lng %>,
|
33
|
-
<%%= <%= singular_table_name %>.lat %>
|
34
|
-
]
|
35
|
-
}
|
36
|
-
}<%%= i != @<%= plural_table_name %>.length - 1 ? ',' : '' %>
|
37
|
-
<%% end %>
|
38
|
-
]
|
39
|
-
}
|
40
|
-
</script>
|
41
|
-
|
42
18
|
<script type="text/javascript" src="https://cdn.geolonia.com/v1/embed?geolonia-api-key=YOUR-API-KEY"></script>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
json.type "FeatureCollection"
|
2
|
+
json.features @<%= plural_table_name %> do |spot|
|
3
|
+
json.type "Feature"
|
4
|
+
json.properties do
|
5
|
+
json.title <%= singular_table_name %>.name
|
6
|
+
json.description "<a href=#{<%= singular_table_name %>_url(<%= singular_table_name %>)}>#{<%= singular_table_name %>.name}</a>"
|
7
|
+
end
|
8
|
+
json.geometry do
|
9
|
+
json.type "Point"
|
10
|
+
json.coordinates [<%= singular_table_name %>.lng, <%= singular_table_name %>.lat]
|
11
|
+
end
|
12
|
+
end
|
@@ -1,5 +1,11 @@
|
|
1
1
|
<p style="color: green"><%%= notice %></p>
|
2
2
|
|
3
|
+
<div class="geolonia"
|
4
|
+
data-lat=<%%= @<%= singular_table_name %>.lat %>
|
5
|
+
data-lng=<%%= @<%= singular_table_name %>.lng %>
|
6
|
+
data-zoom=16
|
7
|
+
style="height:300px;"></div>
|
8
|
+
|
3
9
|
<%%= render @<%= singular_table_name %> %>
|
4
10
|
|
5
11
|
<div>
|
@@ -8,3 +14,5 @@
|
|
8
14
|
|
9
15
|
<%%= button_to "Destroy this <%= human_name.downcase %>", <%= model_resource_name(prefix: "@") %>, method: :delete %>
|
10
16
|
</div>
|
17
|
+
|
18
|
+
<script type="text/javascript" src="https://cdn.geolonia.com/v1/embed?geolonia-api-key=YOUR-API-KEY"></script>
|
data/lib/geo_scaffold/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geo_scaffold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Junya Ishihara
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Geo Scaffold
|
14
14
|
email:
|
@@ -22,17 +22,20 @@ files:
|
|
22
22
|
- CHANGELOG.md
|
23
23
|
- CODE_OF_CONDUCT.md
|
24
24
|
- Gemfile
|
25
|
+
- Gemfile.lock
|
25
26
|
- LICENSE.txt
|
26
27
|
- README.md
|
27
28
|
- Rakefile
|
28
29
|
- bin/console
|
29
30
|
- bin/setup
|
31
|
+
- geo_scaffold-0.1.0.gem
|
30
32
|
- lib/generators/geo_scaffold/controller_generator.rb
|
31
33
|
- lib/generators/geo_scaffold/generator_helpers.rb
|
32
34
|
- lib/generators/geo_scaffold/templates/controller.rb
|
33
35
|
- lib/generators/geo_scaffold/templates/views/_form.html.erb
|
34
36
|
- lib/generators/geo_scaffold/templates/views/edit.html.erb
|
35
37
|
- lib/generators/geo_scaffold/templates/views/index.html.erb
|
38
|
+
- lib/generators/geo_scaffold/templates/views/index.json.jbuilder
|
36
39
|
- lib/generators/geo_scaffold/templates/views/new.html.erb
|
37
40
|
- lib/generators/geo_scaffold/templates/views/partial.html.erb
|
38
41
|
- lib/generators/geo_scaffold/templates/views/show.html.erb
|