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

Add download changes link #4350

Merged
merged 6 commits into from
Sep 17, 2017
Merged

Add download changes link #4350

merged 6 commits into from
Sep 17, 2017

Conversation

bhousel
Copy link
Member

@bhousel bhousel commented Sep 14, 2017

(WIP: still need to check IE11 and fix download on conflict screen)
closes #4346

Copy link
Contributor

@pnorman pnorman left a 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.

@@ -85,6 +93,36 @@ export function uiCommitChanges(context) {
.on('click', zoomToEntity);


// Download changeset link
var changeset = new osmChangeset({ id: 'CHANGEME' }),
Copy link
Contributor

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.

Copy link
Member Author

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>

Copy link
Contributor

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.

Copy link
Member Author

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
Copy link
Contributor

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"

Copy link
Member Author

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?

Copy link
Contributor

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.

.append('a')
.attr('class', 'download-changes')
.attr('href', uri) // no IE11 ?
.attr('download', 'changes.osc') // no IE11 ?
Copy link
Contributor

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.

Copy link
Member Author

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).

@bhousel
Copy link
Member Author

bhousel commented Sep 15, 2017

UI will need some thought to make sure that people don't try to download as a part of an attempting to save.

It looks like this currently - I think it's pushed far enough below the other stuff that it won't mislead anybody.

screenshot 2017-09-15 11 29 03

@bhousel
Copy link
Member Author

bhousel commented Sep 17, 2017

Sweet! I finally got change file downloading working and tested in Chrome, Safari, Firefox, Edge, and IE11.
Hat tip to @keemor's comment here for the solution 🎩

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add changeset download link to save screen
2 participants