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 some specific documentation for uploading files #340

Merged
merged 1 commit into from
Aug 7, 2018

Conversation

jrjohnson
Copy link
Contributor

Uploading files with an event is a specific code path and the task can
be tough to figure out without an example.

I couldn't think of a better way to document this, but it seemed necessary to me. I've been using a construct like:

inputElement.triggerHandler({
 type: 'change',
 target: {
  files: {
   0: file,
   length: 1,
   item() { return file; }
  }
 }
});

So when converting from jQuery helpers to this addon it was difficult to see how to make file uploads work. Turns out some really nice work is done in fire-event.js - just needed to be documented.

@jrjohnson
Copy link
Contributor Author

I'm assuming these test failures have nothing to do with this doc change.

@Turbo87
Copy link
Member

Turbo87 commented Mar 12, 2018

The API docs are automatically generated, so you would have to change this in the JS docs, not in the API docs directly.

@jrjohnson
Copy link
Contributor Author

Whoops. Thanks @Turbo87. I fixed that, it doesn't like like docs get built in Travis so I assume I was supposed to commit the change to API.md as well?

I had to add *'s to the docs. Otherwise the whitespace was stripped from the example.

* 'input.fileUpload',
* 'change',
* [new Blob(['Ember Rules!'])]
* );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a minor indentation issue, this bracket should be moved one char left

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ro0gr. Fixed.

@jrjohnson jrjohnson force-pushed the document-file-upload branch 3 times, most recently from 3dc66fe to f77ad33 Compare March 15, 2018 00:08
Uploading files with an event is a specific code path and the task can
be tough to figure out without an example.
@jrjohnson
Copy link
Contributor Author

@Turbo87 / @ro0gr just wanted to check in. Is this something worth merging? I'm ok with closing it un-merged if it isn't.

@rwjblue
Copy link
Member

rwjblue commented Aug 7, 2018

Yes! Absolutely!

@rwjblue rwjblue merged commit 9fa50c9 into emberjs:master Aug 7, 2018
@rwjblue
Copy link
Member

rwjblue commented Aug 7, 2018

Thank you!

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

Successfully merging this pull request may close these issues.

4 participants