Commit graph

16 commits

Author SHA1 Message Date
Artur Paikin
9eb2763be3 Refactor FileInput to JSX and minor tweaks 2017-12-19 15:03:53 -05:00
Artur Paikin
b062ba4236 Update html to use hyperx; use Component where lifecycle needed, refs;
also fix bugs here and there
2017-12-12 23:32:09 -05:00
Artur Paikin
ed9aa1a537 🚨this.core to this.uppy everywhere
danger again
2017-12-08 17:34:33 -05:00
Artur Paikin
1bd1e410d9 move plugins/Plugin.js to core/Plugin.js
to better separate concerns and later split into packages
2017-11-27 22:03:38 -05:00
Artur Paikin
cb6c1aeff0 add this.opts.id || [name] to this.id for all UI plugins 2017-11-10 20:15:59 -05:00
Artur Paikin
c9077582b8 merge Some refactoring: emitter, informer 2017-07-24 18:25:57 +02:00
Artur Paikin
cf6e75522b cleanup, getMetaFromForm: true by default 2017-06-30 12:05:57 -04:00
Artur Paikin
047e51b77b add get-form-data, move things around 2017-06-29 19:06:04 -04:00
Artur Paikin
6f80ea709c Extract metadata from form, closes #153
This PR adds support for extracting metadata from `<form>` elements.
This was asked #153 and came up elsewhere too, I believe. You can use
it like this:

```html
<form class="MyForm" action="/">
  <input type="file" />
  <input type="hidden" name="bla" value="12333">
  <input type="text" name="yo" value="1">
  <button type="submit">Upload</button>
</form>
```

```js
uppy.use(DragDrop, {
    target: '.MyForm',
    locale: {
      strings: {chooseFile: 'Выберите файл'}
    },
    setMetaFromTargetForm: true
  })
```

Then UI acquire type plugins, like Dashboard, FileInput and DragDrop,
before mounting themselves or doing anything else, extract FormData
from the `target` `<form>` element (it must be a form currently), and
merge the object with the global `state.meta`. This is done via
`setMeta` method on core. Then, when a file is added, `state.meta` is
merged to that file’s meta right away. The ability to add more fields
via UI plugin MetaData is also still there, though probably needs an
update.

In addition a new `meta` option is added in core:

```js
const uppy = Uppy({
  debug: true,
  autoProceed: true,
  meta: {
    username: 'Artur'
  }
})
```

This way some data can be set right away, it becomes the initial
`state.meta` object.
2017-06-28 20:21:23 -04:00
Gavin Boulton
4bc68694c4 Allow configurable FileInput input name
Allow a configurable input name in the FileInput plugin with a default of `files[]`. This functionality matches the Multipart plugin.

Add basic unit tests for `inputName` FileInput constructor option.
2017-06-02 10:54:22 +01:00
Renée Kooi
147a5ecce2
Add uninstall method to FileInput, Informer, MagicLog, MetaData. 2017-05-02 10:39:40 +02:00
Artur Paikin
f9094129a1 Merge branch 'master' into yoyoify 2016-12-20 19:59:52 -05:00
Artur Paikin
4061d717d0 fix i18n 2016-12-20 19:37:28 -05:00
Artur Paikin
db647f7c14 convert everything to const/require and module.exports 🙀 2016-12-19 23:23:33 -05:00
Artur Paikin
8fdca40cb8 try out i18n for each plugin instead of in core 2016-12-13 00:21:37 -05:00
Artur Paikin
94be4af83e Formtag --> FileInput: now pretty by default with an option to display “raw” input[type=file] 2016-10-26 01:02:20 -04:00