Skip to content

Commit c733ab7

Browse files
committed
v2.0.1
- Compatibility with `meteor@1.5.1` - Update `aldeed:autoform` to `v6.2.0` - Update `ostrio:file` to `v1.8.1`
1 parent d41c34d commit c733ab7

File tree

4 files changed

+87
-67
lines changed

4 files changed

+87
-67
lines changed

.versions

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,62 @@
1-
aldeed:autoform@5.8.1
2-
aldeed:simple-schema@1.1.0
3-
allow-deny@1.0.5
4-
babel-compiler@6.9.0
5-
babel-runtime@0.1.10
6-
base64@1.0.9
7-
binary-heap@1.0.9
8-
blaze@2.1.8
9-
blaze-tools@1.0.9
10-
boilerplate-generator@1.0.9
11-
caching-compiler@1.1.6
1+
aldeed:autoform@6.2.0
2+
allow-deny@1.0.6
3+
babel-compiler@6.19.4
4+
babel-runtime@1.0.1
5+
base64@1.0.10
6+
binary-heap@1.0.10
7+
blaze@2.3.2
8+
blaze-tools@1.0.10
9+
boilerplate-generator@1.1.1
10+
caching-compiler@1.1.9
1211
caching-html-compiler@1.0.6
13-
callback-hook@1.0.9
14-
check@1.2.3
15-
coffeescript@1.2.3
16-
ddp@1.2.5
17-
ddp-client@1.2.5
18-
ddp-common@1.2.5
19-
ddp-server@1.2.6
12+
callback-hook@1.0.10
13+
check@1.2.5
14+
coffeescript@1.11.1_3
15+
ddp@1.3.0
16+
ddp-client@2.0.0
17+
ddp-common@1.2.9
18+
ddp-server@2.0.0
2019
deps@1.0.12
21-
diff-sequence@1.0.6
22-
ecmascript@0.5.7
23-
ecmascript-runtime@0.3.12
24-
ejson@1.0.12
25-
geojson-utils@1.0.9
26-
html-tools@1.0.10
27-
htmljs@1.0.10
28-
http@1.2.8
29-
id-map@1.0.8
30-
jquery@1.11.9
31-
livedata@1.0.15
32-
logging@1.1.14
33-
meteor@1.2.16
34-
minifier-js@1.1.13
35-
minimongo@1.0.17
36-
modules@0.7.5
37-
modules-runtime@0.7.5
20+
diff-sequence@1.0.7
21+
ecmascript@0.8.1
22+
ecmascript-runtime@0.4.1
23+
ecmascript-runtime-client@0.4.3
24+
ecmascript-runtime-server@0.4.1
25+
ejson@1.0.13
26+
geojson-utils@1.0.10
27+
html-tools@1.0.11
28+
htmljs@1.0.11
29+
http@1.2.12
30+
id-map@1.0.9
31+
jquery@1.11.10
32+
livedata@1.0.18
33+
logging@1.1.17
34+
meteor@1.7.0
35+
minimongo@1.2.1
36+
modules@0.9.2
37+
modules-runtime@0.8.0
3838
momentjs:moment@2.10.6
39-
mongo@1.1.10
40-
mongo-id@1.0.5
41-
npm-mongo@1.5.45
42-
observe-sequence@1.0.12
43-
ordered-dict@1.0.8
44-
ostrio:autoform-files@1.0.12
45-
ostrio:cookies@2.1.3
46-
ostrio:files@1.7.11
47-
promise@0.8.3
39+
mongo@1.1.19
40+
mongo-id@1.0.6
41+
npm-mongo@2.2.30
42+
observe-sequence@1.0.16
43+
ordered-dict@1.0.9
44+
ostrio:autoform-files@2.0.1
45+
ostrio:cookies@2.2.2
46+
ostrio:files@1.8.1
47+
promise@0.8.9
4848
random@1.0.10
49-
reactive-dict@1.1.3
50-
reactive-var@1.0.10
51-
retry@1.0.7
52-
routepolicy@1.0.11
53-
spacebars@1.0.12
54-
spacebars-compiler@1.0.12
49+
reactive-dict@1.1.9
50+
reactive-var@1.0.11
51+
retry@1.0.9
52+
routepolicy@1.0.12
53+
spacebars@1.0.15
54+
spacebars-compiler@1.1.2
5555
templating@1.2.13
56-
templating-tools@1.0.4
57-
tracker@1.1.0
58-
ui@1.0.11
59-
underscore@1.0.9
60-
url@1.0.10
61-
webapp@1.3.10
56+
templating-tools@1.1.1
57+
tracker@1.1.3
58+
ui@1.0.13
59+
underscore@1.0.10
60+
url@1.1.0
61+
webapp@1.3.17
6262
webapp-hashing@1.0.9

lib/client/autoform.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1+
import { AutoForm } from 'meteor/aldeed:autoform';
2+
3+
if (!global.Buffer) {
4+
global.Buffer = function () {};
5+
global.Buffer.isBuffer = () => false;
6+
}
7+
18
AutoForm.addInputType('fileUpload', {
2-
template: 'afFileUpload'
9+
template: 'afFileUpload',
10+
valueOut() {
11+
return this.val();
12+
}
313
});
414

515
AutoForm._globalHooks.onSuccess.push(function (type) {

lib/client/fileUpload.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
import { $ } from 'meteor/jquery';
2+
import { Meteor } from 'meteor/meteor';
3+
import { AutoForm } from 'meteor/aldeed:autoform';
4+
import { Template } from 'meteor/templating';
5+
import { ReactiveVar } from 'meteor/reactive-var';
6+
17
Template.afFileUpload.onCreated(function () {
28
if (!this.data) {
39
this.data = {
@@ -20,23 +26,24 @@ Template.afFileUpload.onCreated(function () {
2026
this.currentUpload = new ReactiveVar(false);
2127
this.inputName = this.data.name;
2228
this.fileId = new ReactiveVar(this.data.value || false);
29+
this.formId = this.data.atts.id;
2330
return;
2431
});
2532

2633
Template.afFileUpload.helpers({
27-
previewTemplate: function () {
34+
previewTemplate() {
2835
return Template.instance().previewTemplate;
2936
},
30-
uploadTemplate: function () {
37+
uploadTemplate() {
3138
return Template.instance().uploadTemplate;
3239
},
33-
currentUpload: function () {
40+
currentUpload() {
3441
return Template.instance().currentUpload.get();
3542
},
36-
fileId: function () {
43+
fileId() {
3744
return Template.instance().fileId.get() || this.value;
3845
},
39-
uploadedFile: function () {
46+
uploadedFile() {
4047
return global[Template.instance().collectionName()].findOne({
4148
_id: Template.instance().fileId.get() || this.value
4249
});
@@ -67,15 +74,17 @@ Template.afFileUpload.events({
6774
chunkSize: 'dynamic'
6875
}, false);
6976

77+
const ctx = AutoForm.getValidationContext(template.formId);
78+
7079
upload.on('start', function () {
71-
AutoForm.getValidationContext().reset();
80+
ctx.reset();
7281
template.currentUpload.set(this);
7382
return;
7483
});
7584

7685
upload.on('error', function (error) {
77-
AutoForm.getValidationContext().reset();
78-
AutoForm.getValidationContext().addInvalidKeys([{name: Template.instance().inputName, type: 'uploadError', value: error.reason}]);
86+
ctx.reset();
87+
ctx.addValidationErrors([{name: template.inputName, type: 'uploadError', value: error.reason}]);
7988
$(e.currentTarget).val('');
8089
return;
8190
});

package.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ Package.onUse(function(api) {
1111

1212
api.use([
1313
'check',
14+
'ecmascript',
1415
'underscore',
1516
'reactive-var',
1617
'templating',
17-
'aldeed:autoform@6.0.0',
18-
'ostrio:files@1.7.11'
18+
'aldeed:autoform@6.2.0',
19+
'ostrio:files@1.8.1'
1920
]);
2021

2122
api.addFiles([

0 commit comments

Comments
 (0)