Switch to using jbuilder for JSON templates
This commit is contained in:
parent
6852bc9c92
commit
b5d4c262dd
8 changed files with 10 additions and 14 deletions
3
Gemfile
3
Gemfile
|
@ -28,8 +28,7 @@ gem "coffee-rails", "~> 4.2"
|
|||
gem "jquery-rails"
|
||||
|
||||
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
||||
# gem 'jbuilder', '~> 2.0'
|
||||
gem "jsonify-rails"
|
||||
gem "jbuilder", "~> 2.7"
|
||||
|
||||
# Reduces boot times through caching; required in config/boot.rb
|
||||
gem "bootsnap", ">= 1.1.0", :require => false
|
||||
|
|
|
@ -221,17 +221,14 @@ GEM
|
|||
image_size (2.0.2)
|
||||
in_threads (1.5.3)
|
||||
jaro_winkler (1.5.4)
|
||||
jbuilder (2.9.1)
|
||||
activesupport (>= 4.2.0)
|
||||
jmespath (1.4.0)
|
||||
jquery-rails (4.3.5)
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
json (2.2.0)
|
||||
jsonify (0.3.1)
|
||||
multi_json (~> 1.0)
|
||||
jsonify-rails (0.3.2)
|
||||
actionpack
|
||||
jsonify (< 0.4.0)
|
||||
jwt (2.2.1)
|
||||
kgio (2.11.2)
|
||||
kramdown (2.1.0)
|
||||
|
@ -478,9 +475,9 @@ DEPENDENCIES
|
|||
http_accept_language (~> 2.0.0)
|
||||
i18n-js (>= 3.0.0)
|
||||
image_optim_rails
|
||||
jbuilder (~> 2.7)
|
||||
jquery-rails
|
||||
json
|
||||
jsonify-rails
|
||||
kgio
|
||||
kramdown
|
||||
libxml-ruby (>= 2.0.5)
|
||||
|
|
|
@ -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
|
|
@ -1,5 +1,5 @@
|
|||
json.type "FeatureCollection"
|
||||
|
||||
json.features(@notes) do |note|
|
||||
json.ingest! render(note)
|
||||
json.partial! note
|
||||
end
|
1
app/views/api/notes/show.json.jbuilder
Normal file
1
app/views/api/notes/show.json.jbuilder
Normal file
|
@ -0,0 +1 @@
|
|||
json.partial! @note
|
|
@ -1 +0,0 @@
|
|||
json.ingest! render(@note)
|
Loading…
Add table
Add a link
Reference in a new issue