adding json
This commit is contained in:
parent
361dcbb1df
commit
28cb26faa1
2 changed files with 21 additions and 1 deletions
|
@ -7,7 +7,10 @@ module Api
|
|||
|
||||
def index
|
||||
@traces = current_user.traces.reload
|
||||
render :content_type => "application/xml"
|
||||
respond_to do |format|
|
||||
format.xml { render :content_type => "application/xml" }
|
||||
format.json { render :content_type => "application/json" }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
17
app/views/api/users/traces/index.json.jbuilder
Normal file
17
app/views/api/users/traces/index.json.jbuilder
Normal file
|
@ -0,0 +1,17 @@
|
|||
json.gpx_files @traces do |trace|
|
||||
json.id trace.id
|
||||
json.name trace.name
|
||||
json.uid trace.user_id
|
||||
json.user trace.user.display_name
|
||||
json.visibility trace.visibility
|
||||
json.pending !trace.inserted
|
||||
json.timestamp trace.timestamp.xmlschema
|
||||
|
||||
if trace.inserted
|
||||
json.lat trace.latitude
|
||||
json.lon trace.longitude
|
||||
end
|
||||
|
||||
json.description trace.description
|
||||
json.tags trace.tags.map(&:tag)
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue