Skip to content

Commit

Permalink
add remove all upload button
Browse files Browse the repository at this point in the history
  • Loading branch information
codeskyblue committed May 11, 2017
1 parent 68654f8 commit 66c45e1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
3 changes: 2 additions & 1 deletion res/index.tmpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ <h4 class="modal-title">
<form action="#" class="dropzone" id="my-dropzone"></form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" @click="removeAllUploads">RemoveAll</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
Expand Down Expand Up @@ -235,4 +236,4 @@ <h4 class="modal-title">
[[ end ]]
</body>

</html>
</html>
36 changes: 20 additions & 16 deletions res/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ var vm = new Vue({
path: "",
size: "...",
type: "dir",
}]
}],
myDropzone: null,
},
computed: {
computedFiles: function() {
Expand Down Expand Up @@ -104,6 +105,21 @@ var vm = new Vue({
}
}.bind(this)
})
this.myDropzone = new Dropzone("#my-dropzone", {
paramName: "file",
maxFilesize: 1024,
addRemoveLinks: true,
init: function() {
this.on("uploadprogress", function(file, progress) {
// console.log("File progress", progress);
});
this.on("complete", function(file) {
console.log("reload file list")
loadFileList()
})
}
});

},
methods: {
formatTime: function(timestamp) {
Expand All @@ -116,6 +132,9 @@ var vm = new Vue({
toggleHidden: function() {
this.showHidden = !this.showHidden;
},
removeAllUploads: function() {
this.myDropzone.removeAllFiles();
},
genInstallURL: function(name) {
if (getExtention(name) == "ipa") {
urlPath = location.protocol + "//" + pathJoin([location.host, "/-/ipa/link", location.pathname, name]);
Expand Down Expand Up @@ -310,21 +329,6 @@ Vue.filter('formatBytes', function(value) {
else return (bytes / 1073741824).toFixed(1) + " GB";
})

Dropzone.options.myDropzone = {
paramName: "file",
maxFilesize: 1024,
addRemoveLinks: true,
init: function() {
this.on("uploadprogress", function(file, progress) {
console.log("File progress", progress);
});
this.on("complete", function(file) {
console.log("reload file list")
loadFileList()
})
}
}

$(function() {
$.scrollUp({
scrollText: '', // text are defined in css
Expand Down

0 comments on commit 66c45e1

Please sign in to comment.