format.js
format.xml {render :template => 'map_bugs/get_bugs.xml'}
format.json { render :json => @bugs.to_json(:methods => [:lat, :lon], :only => [:id, :status, :date_created], :include => { :map_bug_comment => { :only => [:commenter_name, :date_created, :comment]}}) }
-# format.gpx {render :template => 'map_bugs/get_bugs.gpx'}
+ format.gpx {render :template => 'map_bugs/get_bugs.gpx'}
end
end
format.rss
format.xml
format.json { render :json => @bug.to_json(:methods => [:lat, :lon], :only => [:id, :status, :date_created], :include => { :map_bug_comment => { :only => [:commenter_name, :date_created, :comment]}}) }
+ format.gpx
end
end
format.js
format.xml {render :template => 'map_bugs/get_bugs.xml'}
format.json { render :json => @bugs.to_json(:methods => [:lat, :lon], :only => [:id, :status, :date_created], :include => { :map_bug_comment => { :only => [:commenter_name, :date_created, :comment]}}) }
-# format.gpx {render :template => 'map_bugs/get_bugs.gpx'}
+ format.gpx {render :template => 'map_bugs/get_bugs.gpx'}
end
end
--- /dev/null
+xml.wpt("lon" => bug.lon, "lat" => bug.lat) do
+ xml.desc do
+ xml.cdata! bug.flatten_comment("<hr />")
+ end
+
+ xml.extension do
+ if bug.status = "open"
+ xml.closed "0"
+ else
+ xml.closed "1"
+ end
+
+ xml.id bug.id
+ end
+end
xml.instruct!
-
xml.gpx("version" => "1.1",
"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
- "xsi:schemaLocation" => "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd") do
-
- for bug in @bugs
- xml.wpt("lon" => bug.lon, "lat" => bug.lat) do
- xml.desc do
- xml.cdata! bug.flatten_comment("<hr />")
- end
- xml.extension do
- if bug.status = "open"
- xml.closed "0"
- else
- xml.closed "1"
- end
- xml.id bug.id
- end
- end
- end
+ "xsi:schemaLocation" => "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd") do
+ xml << render(:partial => "bug", :collection => @bugs)
end
--- /dev/null
+xml.instruct!
+
+xml.gpx("version" => "1.1",
+ "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
+ "xsi:schemaLocation" => "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd") do
+ xml << render(:partial => "bug", :object => @bug)
+end
-# Be sure to restart your server when you modify this file.
-
# Add new mime types for use in respond_to blocks:
-# Mime::Type.register "text/richtext", :rtf
-# Mime::Type.register_alias "text/html", :iphone
+
+Mime::Type.register "application/gpx+xml", :gpx