Skip to content

Commit ebf1600

Browse files
committed
Include support for FA - Resolve rowanwins#6
1 parent 531895e commit ebf1600

File tree

6 files changed

+36
-8
lines changed

6 files changed

+36
-8
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Many of these props are inherited from [dropzone configuration so see their doco
5656
| maxFileSizeInMB | Number |The maximum file size for a single upload in MB.|
5757
| maxNumberOfFiles | Number | The maximum number of files to allow the user to upload.|
5858
| autoProcessQueue | Boolean | Whether the files are automatically uploaded or not.|
59+
| useFontAwesome | Boolean | Whether to use Font Awesome instead of Material Icon.|
5960
| useCustomDropzoneOptions | Boolean | If you want to define your own Dropzone config set this to true and define a dropzoneOptions.|
6061
| dropzoneOptions | Object | A custom set of rules to define your dropzone object, use anything available in the [dropzone config](http://www.dropzonejs.com/#configuration-options).|
6162

dev/bundle.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/bundle.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue2-dropzone.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vue2-dropzone",
33
"description": "A wrapper around Dropzone.js for Vue 2",
44
"author": "rowanwins <[email protected]>",
5-
"version": "2.1.0",
5+
"version": "2.1.1",
66
"main": "./dist/vue2-dropzone.js",
77
"scripts": {
88
"dev": "webpack-dev-server --inline --hot --config ./build/dev.js --port 8080",

src/index.vue

+29-2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
type: Boolean,
5050
default: true
5151
},
52+
useFontAwesome: {
53+
type: Boolean,
54+
default: false
55+
},
5256
useCustomDropzoneOptions: {
5357
type: Boolean,
5458
default: false
@@ -65,6 +69,29 @@
6569
this.dropzone.processQueue()
6670
}
6771
},
72+
computed: {
73+
cloudIcon: function () {
74+
if (this.useFontAwesome) {
75+
return '<i class="fa fa-cloud-upload"></i>'
76+
} else {
77+
return '<i class="material-icons">cloud_upload</i>'
78+
}
79+
},
80+
doneIcon: function () {
81+
if (this.useFontAwesome) {
82+
return '<i class="fa fa-check"></i>'
83+
} else {
84+
return ' <i class="material-icons">done</i>'
85+
}
86+
},
87+
errorIcon: function () {
88+
if (this.useFontAwesome) {
89+
return '<i class="fa fa-close"></i>'
90+
} else {
91+
return ' <i class="material-icons">error</i>'
92+
}
93+
}
94+
},
6895
mounted () {
6996
var element = document.getElementById(this.id)
7097
if (!this.useCustomDropzoneOptions) {
@@ -78,8 +105,8 @@
78105
addRemoveLinks: this.showRemoveLink,
79106
acceptedFiles: this.acceptedFileTypes,
80107
autoProcessQueue: this.autoProcessQueue,
81-
dictDefaultMessage: '<i class="material-icons">cloud_upload</i><br>Drop files here to upload',
82-
previewTemplate: '<div class="dz-preview dz-file-preview"> <div class="dz-image" style="width:' + this.thumbnailWidth + 'px;height:' + this.thumbnailHeight + 'px"><img data-dz-thumbnail /></div> <div class="dz-details"> <div class="dz-size"><span data-dz-size></span></div> <div class="dz-filename"><span data-dz-name></span></div> </div> <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div> <div class="dz-error-message"><span data-dz-errormessage></span></div> <div class="dz-success-mark"> <i class="material-icons">done</i> </div> <div class="dz-error-mark"><i class="material-icons">error</i></div></div>'
108+
dictDefaultMessage: this.cloudIcon +'<br>Drop files here to upload',
109+
previewTemplate: '<div class="dz-preview dz-file-preview"> <div class="dz-image" style="width:' + this.thumbnailWidth + 'px;height:' + this.thumbnailHeight + 'px"><img data-dz-thumbnail /></div> <div class="dz-details"> <div class="dz-size"><span data-dz-size></span></div> <div class="dz-filename"><span data-dz-name></span></div> </div> <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div> <div class="dz-error-message"><span data-dz-errormessage></span></div> <div class="dz-success-mark">' + this.doneIcon + ' </div> <div class="dz-error-mark' + this.errorIcon + '</div></div>'
83110
})
84111
} else {
85112
this.dropzone = new Dropzone(element, this.dropzoneOptions)

0 commit comments

Comments
 (0)