Switch to using jbuilder for JSON templates

This commit is contained in:
Tom Hughes 2019-11-14 19:29:14 +00:00
parent 6852bc9c92
commit b5d4c262dd
8 changed files with 10 additions and 14 deletions

View file

@ -2,7 +2,7 @@ json.type "Feature"
json.geometry do
json.type "Point"
json.coordinates [ note.lon.to_f, note.lat.to_f ]
json.coordinates [note.lon.to_f, note.lat.to_f]
end
json.properties do
@ -16,12 +16,12 @@ json.properties do
json.close_url close_note_url(note, :format => params[:format])
end
json.date_created note.created_at
json.date_created note.created_at.to_s
json.status note.status
json.closed_at note.closed_at if note.closed?
json.closed_at note.closed_at.to_s if note.closed?
json.comments(note.comments) do |comment|
json.date comment.created_at
json.date comment.created_at.to_s
if comment.author
json.uid comment.author.id

View file

@ -1,5 +1,5 @@
json.type "FeatureCollection"
json.features(@notes) do |note|
json.ingest! render(note)
json.partial! note
end

View file

@ -0,0 +1 @@
json.partial! @note

View file

@ -1 +0,0 @@
json.ingest! render(@note)