Add JS component for form to edit officer info
The component will control when the form is displayed using the `editing` attribute.
This commit is contained in:
40
js/components/forms/edit_officer_form.js
Normal file
40
js/components/forms/edit_officer_form.js
Normal file
@@ -0,0 +1,40 @@
|
||||
import FormMixin from '../../mixins/form'
|
||||
import checkboxinput from '../checkbox_input'
|
||||
import textinput from '../text_input'
|
||||
|
||||
export default {
|
||||
name: 'edit-officer-form',
|
||||
|
||||
mixins: [FormMixin],
|
||||
|
||||
components: {
|
||||
checkboxinput,
|
||||
textinput,
|
||||
},
|
||||
|
||||
props: {
|
||||
hasErrors: {
|
||||
type: Boolean,
|
||||
default: () => false,
|
||||
},
|
||||
},
|
||||
|
||||
data: function() {
|
||||
return {
|
||||
editing: this.hasErrors,
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
edit: function(event) {
|
||||
event.preventDefault()
|
||||
this.editing = true
|
||||
},
|
||||
|
||||
cancel: function(event) {
|
||||
this.editing = false
|
||||
},
|
||||
},
|
||||
|
||||
template: '<div></div>',
|
||||
}
|
Reference in New Issue
Block a user