Skip to content

Commit

Permalink
Merge pull request #14 from vaadin/cancel_all
Browse files Browse the repository at this point in the history
Adding Cancel All feature
  • Loading branch information
platosha committed Feb 9, 2016
2 parents 8a4f7d3 + e79f6a4 commit da2205c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions vaadin-upload.html
Expand Up @@ -142,6 +142,7 @@
<content></content>
<div id="buttons">
<paper-button id="addFiles" on-tap="_onAddFilesClick">Add File(s)</paper-button>
<paper-button id="cancelAll" on-tap="_onCancelAllClick" hidden$="[[!cancelAll]]">Cancel all</paper-button>
</div>
<input type="file" id="fileInput" on-change="_onFileInputChange" hidden accept="{{accept}}">
</template>
Expand Down Expand Up @@ -191,6 +192,13 @@
value: false,
reflectToAttribute: true
},
/**
* Specifies if the cancel-all button is visible.
*/
cancelAll: {
type: Boolean,
value: false
},
/**
* File list
*/
Expand Down Expand Up @@ -492,6 +500,12 @@
this._abortFileUpload(event.detail.file);
},

_onCancelAllClick: function(event) {
for (var i = this.files.length; i > 0; --i) {
this._abortFileUpload(this.files[i - 1]);
}
}

});
/**
* Fired when a file cannot be added to the queue due to a constrain:
Expand Down

0 comments on commit da2205c

Please sign in to comment.