diff --git a/README.md b/README.md index b695483..942dbfd 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,19 @@ # Autoform File - + + + + + ```shell +# meteor@>=1.9 meteor add ostrio:autoform-files + +# meteor@<1.9 +meteor add ostrio:autoform-files@2.2.1 ``` ## Description diff --git a/lib/client/fileUpload.js b/lib/client/fileUpload.js index 0833c79..05e4047 100644 --- a/lib/client/fileUpload.js +++ b/lib/client/fileUpload.js @@ -1,4 +1,3 @@ -import { _ } from 'meteor/underscore'; import { Meteor } from 'meteor/meteor'; import { AutoForm } from 'meteor/aldeed:autoform'; import { Template } from 'meteor/templating'; @@ -52,15 +51,19 @@ Template.afFileUpload.onCreated(function () { this.uploadTemplate = this.data.atts.uploadTemplate || null; this.previewTemplate = this.data.atts.previewTemplate || null; this.accept = this.data.atts.accept || null; - this.insertConfig = Object.assign({}, this.data.atts.insertConfig || {}); + this.insertConfig = Object.assign({}, defaultInsertOpts, this.data.atts.insertConfig || {}); delete this.data.atts.insertConfig; - this.insertConfig = Object.assign(this.insertConfig, _.pick(this.data.atts, Object.keys(defaultInsertOpts))); - if (!isNaN(this.insertConfig.streams) || this.insertConfig.streams !== 'dynamic') { + if (!isNaN(this.insertConfig.streams)) { this.insertConfig.streams = parseInt(this.insertConfig.streams); + } else if (this.insertConfig.streams !== 'dynamic') { + this.insertConfig.streams = 'dynamic'; } - if (!isNaN(this.insertConfig.chunkSize) || this.insertConfig.chunkSize !== 'dynamic') { + + if (!isNaN(this.insertConfig.chunkSize)) { this.insertConfig.chunkSize = parseInt(this.insertConfig.chunkSize); + } else if (this.insertConfig.chunkSize !== 'dynamic') { + this.insertConfig.chunkSize = 'dynamic'; } this.collectionName = function () { diff --git a/package.js b/package.js index 9e89561..6d10779 100644 --- a/package.js +++ b/package.js @@ -2,22 +2,21 @@ Package.describe({ name: 'ostrio:autoform-files', summary: 'File upload for AutoForm using ostrio:files', description: 'File upload for AutoForm using ostrio:files', - version: '2.2.1', + version: '2.3.0', git: 'https://github.com/VeliovGroup/meteor-autoform-file.git' }); Package.onUse((api) => { - api.versionsFrom('METEOR@1.6.1'); + api.versionsFrom('METEOR@1.9'); api.use([ 'check', 'ecmascript', - 'underscore', 'mongo', 'reactive-var', 'templating@1.3.2', 'aldeed:autoform@6.3.0', - 'ostrio:files@1.13.0' + 'ostrio:files@1.14.0' ], 'client'); api.addFiles([