-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add download changes link #4350
Conversation
(WIP: still need to check IE11 and fix download on conflict screen)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UI will need some thought to make sure that people don't try to download as a part of an attempting to save.
modules/ui/commit_changes.js
Outdated
@@ -85,6 +93,36 @@ export function uiCommitChanges(context) { | |||
.on('click', zoomToEntity); | |||
|
|||
|
|||
// Download changeset link | |||
var changeset = new osmChangeset({ id: 'CHANGEME' }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally for downloading you don't want to supply anything for changeset ID.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you check this for me? I'm really not sure what other tools need.
It currently ends up generating something kind of like this, but we can remove the changeset="CHANGEME"
stuff if needed:
<osmChange version="0.6" generator="iD">
<create/>
<modify>
<node id="105439801" lon="-74.53666020842094" lat="40.663296528227306" version="2" changeset="CHANGEME"/>
<node id="105439798" lon="-74.53607265426908" lat="40.66309431604051" version="2" changeset="CHANGEME"/>
</modify>
<delete if-unused="true">
<node id="5106517631" lon="-74.5367492" lat="40.6633484" version="1" changeset="CHANGEME"/>
</delete>
</osmChange>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the changeset="CHANGEME" and it looks okay. I'm not 100% sure what programs support reading osmChange for uploads.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good, thanks!
data/core.yaml
Outdated
@@ -260,6 +260,7 @@ en: | |||
save: Upload | |||
cancel: Cancel | |||
changes: "{count} Changes" | |||
download_changes: Download OsmChange file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The standard spelling for OSC files is "osmChange"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'll change it. I was going off of the osm wiki - should we change it there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wiki page titles have to begin with a capital character.
modules/ui/commit_changes.js
Outdated
.append('a') | ||
.attr('class', 'download-changes') | ||
.attr('href', uri) // no IE11 ? | ||
.attr('download', 'changes.osc') // no IE11 ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The standard way is with Content-Disposition: attachment; filename="changes.osc"
header for downloading content to a file, and I think that works for IE, but I'm not sure what you do when generating a file on the browser to save.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this is different in client side javascript, see stack overflow. That's why we are using the download
attribute here, which is now finally supported in all modern browsers.
I'm going to test today what happens in IE11, but I think we should be able to fallback to the previous behavior, which is opening a new tab with the data://
uri contents in it (this trick no longer works after Chrome 59, so that's why I had to figure something out quickly - the existing download link on the conflict resolution screen no longer works).
(This seems to be an easier path to IE11/Edge support)
(WIP: still need to check IE11 and fix download on conflict screen)
closes #4346