Created
January 15, 2015 20:48
-
-
Save ndee/6d42c3cce01bcd131a9f to your computer and use it in GitHub Desktop.
cfs:autoform: File input doesn't show up
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var FileStore = new FS.Store.S3("filesStore", { | |
// Credentials | |
}); | |
Files = new FS.Collection("files", { | |
stores: [FileStore] | |
}); | |
Files.allow({ | |
download: function () { | |
return true; | |
}, | |
fetch: null | |
}); | |
if(Meteor.isServer) { | |
Meteor.publish('files', function() { | |
return Files.find({}); | |
}); | |
} | |
// TODO: This could be a performance bottleneck | |
if(Meteor.isClient) { | |
Meteor.subscribe('files'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ItemSchema = new SimpleSchema({ | |
name: { | |
type: String, | |
label: "Name" | |
}, | |
comment: { | |
type: String, | |
label: "Comment", | |
optional: true | |
}, | |
fileId: { | |
type: String, | |
label: 'File', | |
optional: true, | |
autoform: { | |
afFieldInput: { | |
type: "cfs-file", | |
collection: "files" | |
} | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template name="exampleTypeForm"> | |
{{#autoForm id="itemForm" collection=Items type="insert"}} | |
{{> afQuickField name="name" }} | |
{{> afQuickField name="comment" }} | |
{{> afQuickField name="fileId"}} | |
<div> | |
<button type="submit" class="btn btn-primary">Submit</button> | |
</div> | |
{{/autoForm}} | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment