@@ -51,6 +51,7 @@ Template.afFileUpload.onCreated(function () {
5151
5252 this . uploadTemplate = this . data . atts . uploadTemplate || null ;
5353 this . previewTemplate = this . data . atts . previewTemplate || null ;
54+ this . accept = this . data . atts . accept || null ;
5455 this . insertConfig = Object . assign ( { } , this . data . atts . insertConfig || { } ) ;
5556 delete this . data . atts . insertConfig ;
5657 this . insertConfig = Object . assign ( this . insertConfig , _ . pick ( this . data . atts , Object . keys ( defaultInsertOpts ) ) ) ;
@@ -80,6 +81,20 @@ Template.afFileUpload.helpers({
8081 uploadTemplate ( ) {
8182 return Template . instance ( ) . uploadTemplate ;
8283 } ,
84+ uploadTemplateData ( ) {
85+ const instance = Template . instance ( ) ;
86+ const currentUpload = instance . currentUpload . get ( ) ;
87+ const { accept } = instance ;
88+
89+ // here we can check for upload template configs, that have been added after 2.1.4 and return either
90+ // an object with "config" merged with "currentUpload" to stay backwards compatible as popssible
91+ if ( accept ) {
92+ const config = { config : { accept } } ;
93+ return Object . assign ( { } , config , currentUpload ) ;
94+ } else {
95+ return currentUpload ;
96+ }
97+ } ,
8398 currentUpload ( ) {
8499 return Template . instance ( ) . currentUpload . get ( ) ;
85100 } ,
@@ -93,6 +108,9 @@ Template.afFileUpload.helpers({
93108 return null ;
94109 }
95110 return template . collection . findOne ( { _id} ) ;
111+ } ,
112+ accept ( ) {
113+ return Template . instance ( ) . accept ;
96114 }
97115} ) ;
98116
0 commit comments