layers_of_london-booth-map_tool 0.1.1 → 0.1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/layers_of_london/booth/map_tool/squares_controller.rb +2 -5
- data/app/models/layers_of_london/booth/map_tool/square.rb +16 -16
- data/app/policies/layers_of_london/booth/map_tool/polygon_policy.rb +4 -1
- data/lib/layers_of_london/booth/map_tool/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4495369b72bcfe877a3d6ef77ffb8812216250d308c8a243450fd64559060b55
|
4
|
+
data.tar.gz: 11d34c7bc762629c885a6ac34502cfecee850bcde736b872f26b4da148c35596
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd1ff2b16202496c6d1a6ba70f69ffac89c2b06bad2a2503b084815818e5a634285c42ac5546fecc7499ef23e236af923b8de0026c3a61d5fb36ebe6885b9b57
|
7
|
+
data.tar.gz: c98879375683029aed48d52a986232e1a2d2649b99724986c6282dbd4fa4c79280eedbce213e79b2057e0571e940d4701d3f2be93ae17f94d760c9852dda5bbd
|
@@ -5,7 +5,7 @@ module LayersOfLondon::Booth::MapTool
|
|
5
5
|
skip_after_action :verify_authorized rescue nil
|
6
6
|
|
7
7
|
def index
|
8
|
-
squares = LayersOfLondon::Booth::MapTool::Square.
|
8
|
+
squares = LayersOfLondon::Booth::MapTool::Square.all
|
9
9
|
render json: {
|
10
10
|
type: "FeatureCollection",
|
11
11
|
features: squares.collect(&:to_geojson)
|
@@ -43,10 +43,7 @@ module LayersOfLondon::Booth::MapTool
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def polygons
|
46
|
-
features = LayersOfLondon::Booth::MapTool::Polygon.
|
47
|
-
user_can_edit = LayersOfLondon::Booth::MapTool::PolygonPolicy.new(current_user, polygon).update?
|
48
|
-
polygon.to_json(user_can_edit: user_can_edit)
|
49
|
-
end
|
46
|
+
features = LayersOfLondon::Booth::MapTool::PolygonPolicy::Scope.new(current_user, LayersOfLondon::Booth::MapTool::Polygon).resolve
|
50
47
|
|
51
48
|
feature_collection = {
|
52
49
|
type: "FeatureCollection",
|
@@ -89,24 +89,24 @@ module LayersOfLondon::Booth::MapTool
|
|
89
89
|
{
|
90
90
|
type: "Feature",
|
91
91
|
geometry: {
|
92
|
-
type: "
|
92
|
+
type: "Polygon",
|
93
93
|
coordinates: [
|
94
|
-
[
|
94
|
+
# [
|
95
95
|
[
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
]
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
]
|
96
|
+
north_west.to_a.reverse,
|
97
|
+
south_west.to_a.reverse,
|
98
|
+
south_east.to_a.reverse,
|
99
|
+
north_east.to_a.reverse,
|
100
|
+
north_west.to_a.reverse
|
101
|
+
]#,
|
102
|
+
# [
|
103
|
+
# LayersOfLondon::Booth::MapTool.configuration.north_west.to_a.reverse,
|
104
|
+
# LayersOfLondon::Booth::MapTool.configuration.north_east.to_a.reverse,
|
105
|
+
# LayersOfLondon::Booth::MapTool.configuration.south_east.to_a.reverse,
|
106
|
+
# LayersOfLondon::Booth::MapTool.configuration.south_west.to_a.reverse,
|
107
|
+
# LayersOfLondon::Booth::MapTool.configuration.north_west.to_a.reverse,
|
108
|
+
# ]
|
109
|
+
# ]
|
110
110
|
|
111
111
|
]
|
112
112
|
},
|
@@ -18,7 +18,10 @@ module LayersOfLondon::Booth::MapTool
|
|
18
18
|
|
19
19
|
class Scope < Scope
|
20
20
|
def resolve
|
21
|
-
scope.all
|
21
|
+
features = scope.limit(10).includes(:user, square: [:user]).all.collect do |poly|
|
22
|
+
# user_can_edit = LayersOfLondon::Booth::MapTool::PolygonPolicy.new(user, poly).update?
|
23
|
+
poly.to_json(user_can_edit: user.present?)
|
24
|
+
end
|
22
25
|
end
|
23
26
|
end
|
24
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: layers_of_london-booth-map_tool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.1
|
4
|
+
version: 0.1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Hendrick
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10
|
11
|
+
date: 2019-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|