Skip to content

Commit 407f972

Browse files
committed
also fix the index API responses to reflect the transition from geom to geojson
for the geojson information #50
1 parent 97ef30f commit 407f972

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

app/views/issues/index.api.rsb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ api.array :issues, api_meta(:total_count => @issue_count, :offset => @offset, :l
2020
api.is_private issue.is_private
2121
api.estimated_hours issue.estimated_hours
2222

23-
unless issue.geom.nil?
24-
api.geom RGeo::GeoJSON.encode RGeo::GeoJSON::EntityFactory.instance.feature(
25-
RGeo::WKRep::WKBParser.new().parse(issue.geom), issue.id)
23+
if issue.geom
24+
api.geojson issue.geojson(simple: true)
2625
else
27-
api.geom ""
26+
api.geojson ""
2827
end
2928

3029
render_api_custom_values issue.visible_custom_field_values, api

app/views/projects/index.api.rsb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ api.array :projects, api_meta(:total_count => @project_count, :offset => @offset
99
api.status project.status
1010
api.is_public project.is_public?
1111

12-
unless project.geom.nil?
13-
api.geom RGeo::GeoJSON.encode RGeo::GeoJSON::EntityFactory.instance.feature(
14-
RGeo::WKRep::WKBParser.new().parse(project.geom), project.id)
12+
if project.geom
13+
api.geojson project.geojson(simple: true)
1514
else
16-
api.geom ""
15+
api.geojson ""
1716
end
1817

1918
render_api_custom_values project.visible_custom_field_values, api

app/views/users/index.api.rsb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ api.array :users, api_meta(:total_count => @user_count, :offset => @offset, :lim
99
api.created_on user.created_on
1010
api.last_login_on user.last_login_on
1111

12-
unless user.geom.nil?
13-
api.geom RGeo::GeoJSON.encode RGeo::GeoJSON::EntityFactory.instance.feature(
14-
RGeo::WKRep::WKBParser.new().parse(user.geom), user.id)
12+
if user.geom
13+
api.geojson user.geojson(simple: true)
1514
else
16-
api.geom ""
15+
api.geojson ""
1716
end
1817

1918
render_api_custom_values user.visible_custom_field_values, api

0 commit comments

Comments
 (0)