Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and enhance the notes GPX files #1005

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/views/notes/_note.gpx.builder
@@ -1,9 +1,14 @@
xml.wpt("lon" => note.lon, "lat" => note.lat) do
xml.time note.created_at.to_s(:iso8601)
xml.name "#{t'browse.note.title', :id => note.id}"

xml.desc do
xml.cdata! render(:partial => "description", :object => note, :formats => [ :html ])
end

xml.extension do
xml.link("href" => browse_note_url(note, :host => SERVER_URL))

xml.extensions do
xml.id note.id
xml.url note_url(note, :format => params[:format])

Expand Down
2 changes: 2 additions & 0 deletions app/views/notes/index.gpx.builder
@@ -1,6 +1,8 @@
xml.instruct!

xml.gpx("version" => "1.1",
"creator" => "OpenStreetMap.org",
"xmlns" => "http://www.topografix.com/GPX/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 => "note", :collection => @notes) || "")
Expand Down
2 changes: 2 additions & 0 deletions app/views/notes/show.gpx.builder
@@ -1,6 +1,8 @@
xml.instruct!

xml.gpx("version" => "1.1",
"creator" => "OpenStreetMap.org",
"xmlns" => "http://www.topografix.com/GPX/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 => "note", :object => @note)
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/notes_controller_test.rb
Expand Up @@ -510,7 +510,7 @@ def test_show_success
assert_equal "application/gpx+xml", @response.content_type
assert_select "gpx", :count => 1 do
assert_select "wpt[lat='#{notes(:open_note).lat}'][lon='#{notes(:open_note).lon}']", :count => 1 do
assert_select "extension", :count => 1 do
assert_select "extensions", :count => 1 do
assert_select "id", notes(:open_note).id
assert_select "url", note_url(notes(:open_note), :format => "gpx")
assert_select "comment_url", comment_note_url(notes(:open_note), :format => "gpx")
Expand Down