File tree Expand file tree Collapse file tree 5 files changed +32
-12
lines changed Expand file tree Collapse file tree 5 files changed +32
-12
lines changed Original file line number Diff line number Diff line change @@ -41,9 +41,9 @@ mongo-id@1.0.5
4141npm-mongo@1.5.45
4242observe-sequence@1.0.12
4343ordered-dict@1.0.8
44- ostrio:autoform-files@1.0.2
44+ ostrio:autoform-files@1.0.4
4545ostrio:cookies@2.0.5
46- ostrio:files@1.6.9
46+ ostrio:files@1.7.0
4747promise@0.8.3
4848random@1.0.10
4949reactive-dict@1.1.3
Original file line number Diff line number Diff line change @@ -2,6 +2,12 @@ AutoForm.addInputType("fileUpload", {
22 template : "afFileUpload"
33} ) ;
44
5+ AutoForm . _globalHooks . onSuccess . push ( function ( type ) {
6+ if ( type === 'insert' ) {
7+ this . template . $ ( '[data-reset-file]' ) . click ( ) ;
8+ }
9+ } ) ;
10+
511SimpleSchema . messages ( {
612 uploadError : '[value]'
713} ) ;
Original file line number Diff line number Diff line change 88 {{> uploadFileDemo}}
99 {{/if}}
1010 </ div >
11- < a data-remove-file > Remove</ a >
11+ < a data-reset-file href ="# " style ="display:none "> Reset</ a >
12+ < a data-remove-file href ="# "> Remove</ a >
1213 {{else}}
1314 {{#with currentUpload}}
1415 Uploading < b > {{file.name}}</ b > :
15- < span class ="progress "> {{progress}}%</ span >
16+ < progress value ="{{progress.get}} " max ="100 "> </ progress >
17+
18+ < span class ="progress "> {{progress.get}}%</ span >
1619 {{else}}
1720 < input data-files-collection-upload class ="form-control af-file-upload-capture " type ="file " />
1821 {{/with}}
Original file line number Diff line number Diff line change 11Template . afFileUpload . onCreated ( function ( ) {
2- this . collection = Meteor . connection . _mongo_livedata_collections [ this . data . atts . collection ]
2+ if ( ! this . data ) {
3+ this . data = {
4+ atts : { }
5+ } ;
6+ }
7+
8+ this . collection = Meteor . connection . _mongo_livedata_collections [ this . data . atts . collection ] ;
39 if ( ! this . collection ) {
410 throw new Meteor . Error ( 404 , '[meteor-autoform-files] No such collection "' + this . data . atts . collection + '"' ) ;
511 }
612
7- this . collectionName = ( ) => this . data . atts . collection
8-
13+ this . collectionName = ( ) => this . data . atts . collection ;
914 this . currentUpload = new ReactiveVar ( false ) ;
1015 this . inputName = this . data . name ;
11- this . fileId = new ReactiveVar ( this . data . value ) ;
16+ this . fileId = new ReactiveVar ( this . data . value || false ) ;
1217 return ;
1318} ) ;
1419
@@ -27,12 +32,18 @@ Template.afFileUpload.helpers({
2732} ) ;
2833
2934Template . afFileUpload . events ( {
35+ 'click [data-reset-file]' ( e , template ) {
36+ e . preventDefault ( ) ;
37+ template . fileId . set ( false ) ;
38+ return false ;
39+ } ,
3040 'click [data-remove-file]' ( e , template ) {
41+ e . preventDefault ( ) ;
3142 template . fileId . set ( false ) ;
3243 try {
3344 this . remove ( ) ;
34- } catch ( e ) { }
35- return ;
45+ } catch ( error ) { }
46+ return false ;
3647 } ,
3748 'change [data-files-collection-upload]' ( e , template ) {
3849 if ( e . currentTarget . files && e . currentTarget . files [ 0 ] ) {
Original file line number Diff line number Diff 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.2 " ,
5+ version : "1.0.4 " ,
66 git : "https://github.com/VeliovGroup/meteor-autoform-file.git"
77} ) ;
88
@@ -15,7 +15,7 @@ Package.onUse(function(api) {
1515 'reactive-var' ,
1616 'templating' ,
1717 'aldeed:autoform@5.8.0' ,
18- 'ostrio:files@1.6.9 '
18+ 'ostrio:files@1.7.0 '
1919 ] ) ;
2020
2121 api . addFiles ( [
You can’t perform that action at this time.
0 commit comments