Basic frontend uploader component
This commit is contained in:
@@ -9,6 +9,7 @@ import levelofwarrant from '../levelofwarrant'
|
||||
import multicheckboxinput from '../multi_checkbox_input'
|
||||
import optionsinput from '../options_input'
|
||||
import textinput from '../text_input'
|
||||
import uploadinput from '../upload_input'
|
||||
import toggler from '../toggler'
|
||||
|
||||
export default {
|
||||
@@ -23,6 +24,7 @@ export default {
|
||||
optionsinput,
|
||||
textinput,
|
||||
toggler,
|
||||
uploadinput,
|
||||
},
|
||||
mixins: [FormMixin],
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ export default {
|
||||
const pdf = this.initialData
|
||||
|
||||
return {
|
||||
showUpload: !pdf || this.uploadErrors.length > 0,
|
||||
attachment: pdf || null,
|
||||
}
|
||||
},
|
||||
|
||||
@@ -37,5 +37,24 @@ export default {
|
||||
showUploadInput: function() {
|
||||
this.showUpload = true
|
||||
},
|
||||
addAttachment: function(e) {
|
||||
this.attachment = e.target.value
|
||||
},
|
||||
removeAttachment: function(e) {
|
||||
e.preventDefault()
|
||||
this.attachment = null
|
||||
this.$refs.attachmentInput.value = null
|
||||
},
|
||||
},
|
||||
|
||||
computed: {
|
||||
baseName: function() {
|
||||
if (this.attachment) {
|
||||
return this.attachment.split(/[\\/]/).pop()
|
||||
}
|
||||
},
|
||||
hasAttachment: function() {
|
||||
return !!this.attachment
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user