Skip to content

Commit a883ad4

Browse files
committed
v1.0.6
- Move codebase to ES5 - Fix #6
1 parent 8700390 commit a883ad4

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

.versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ mongo-id@1.0.5
4141
npm-mongo@1.5.45
4242
observe-sequence@1.0.12
4343
ordered-dict@1.0.8
44-
ostrio:autoform-files@1.0.5
44+
ostrio:autoform-files@1.0.6
4545
ostrio:cookies@2.0.5
4646
ostrio:files@1.7.1
4747
promise@0.8.3

lib/client/fileUpload.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Template.afFileUpload.onCreated(function () {
2+
var self = this;
23
if (!this.data) {
34
this.data = {
45
atts: {}
@@ -10,44 +11,47 @@ Template.afFileUpload.onCreated(function () {
1011
throw new Meteor.Error(404, '[meteor-autoform-files] No such collection "' + this.data.atts.collection + '"');
1112
}
1213

13-
this.collectionName = () => this.data.atts.collection;
14+
this.collectionName = function () {
15+
return self.data.atts.collection;
16+
};
17+
1418
this.currentUpload = new ReactiveVar(false);
1519
this.inputName = this.data.name;
1620
this.fileId = new ReactiveVar(this.data.value || false);
1721
return;
1822
});
1923

2024
Template.afFileUpload.helpers({
21-
currentUpload() {
25+
currentUpload: function () {
2226
return Template.instance().currentUpload.get();
2327
},
24-
fileId() {
28+
fileId: function () {
2529
return Template.instance().fileId.get();
2630
},
27-
uploadedFile() {
31+
uploadedFile: function () {
2832
return global[Template.instance().collectionName()].findOne({
2933
_id: Template.instance().fileId.get()
3034
});
3135
}
3236
});
3337

3438
Template.afFileUpload.events({
35-
'click [data-reset-file]'(e, template) {
39+
'click [data-reset-file]': function (e, template) {
3640
e.preventDefault();
3741
template.fileId.set(false);
3842
return false;
3943
},
40-
'click [data-remove-file]'(e, template) {
44+
'click [data-remove-file]': function (e, template) {
4145
e.preventDefault();
4246
template.fileId.set(false);
4347
try {
4448
this.remove();
4549
} catch (error) {}
4650
return false;
4751
},
48-
'change [data-files-collection-upload]'(e, template) {
52+
'change [data-files-collection-upload]': function (e, template) {
4953
if (e.currentTarget.files && e.currentTarget.files[0]) {
50-
const upload = global[template.collectionName()].insert({
54+
var upload = global[template.collectionName()].insert({
5155
file: e.currentTarget.files[0],
5256
streams: 'dynamic',
5357
chunkSize: 'dynamic'
@@ -66,7 +70,7 @@ Template.afFileUpload.events({
6670
return;
6771
});
6872

69-
upload.on('end', (error, fileObj) => {
73+
upload.on('end', function (error, fileObj) {
7074
if (!error) {
7175
if (template) {
7276
template.fileId.set(fileObj._id);

package.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Package.describe({
22
name: "ostrio:autoform-files",
33
summary: "File upload for AutoForm using ostrio:files",
44
description: "File upload for AutoForm using ostrio:files",
5-
version: "1.0.5",
5+
version: "1.0.6",
66
git: "https://github.com/VeliovGroup/meteor-autoform-file.git"
77
});
88

0 commit comments

Comments
 (0)