Remove unnecessary savebutton vue component and create SaveButton Macro
This commit is contained in:
@@ -112,15 +112,11 @@ export default {
|
||||
validateAndOpenModal: function() {
|
||||
let isValid = this.$children.reduce((previous, newVal) => {
|
||||
// display textInput error if it is not valid
|
||||
if (newVal.$options.name == 'savebutton') {
|
||||
return true
|
||||
} else {
|
||||
if (!newVal.showValid) {
|
||||
newVal.showError = true
|
||||
}
|
||||
|
||||
return newVal.showValid && previous
|
||||
if (!newVal.showValid) {
|
||||
newVal.showError = true
|
||||
}
|
||||
|
||||
return newVal.showValid && previous
|
||||
}, true)
|
||||
this.validate()
|
||||
isValid = this.errors.length == 0 && isValid
|
||||
|
@@ -1,18 +0,0 @@
|
||||
export default {
|
||||
name: 'savebutton',
|
||||
|
||||
props: {
|
||||
text: String,
|
||||
disabled: Boolean,
|
||||
classes: String,
|
||||
},
|
||||
|
||||
data: function() {
|
||||
return {
|
||||
displayClasses: `usa-button usa-button-primary ${this.classes}`,
|
||||
}
|
||||
},
|
||||
|
||||
template:
|
||||
'<button type="submit" :class="displayClasses" tabindex="0" :disabled="disabled">{{ text }}</button>',
|
||||
}
|
@@ -33,7 +33,6 @@ import { isNotInVerticalViewport } from './lib/viewport'
|
||||
import DateSelector from './components/date_selector'
|
||||
import SidenavToggler from './components/sidenav_toggler'
|
||||
import KoReview from './components/forms/ko_review'
|
||||
import savebutton from './components/save_button'
|
||||
import BaseForm from './components/forms/base_form'
|
||||
|
||||
Vue.config.productionTip = false
|
||||
@@ -70,7 +69,6 @@ const app = new Vue({
|
||||
EditOfficerForm,
|
||||
SidenavToggler,
|
||||
KoReview,
|
||||
savebutton,
|
||||
BaseForm,
|
||||
},
|
||||
|
||||
|
@@ -1,5 +1,3 @@
|
||||
import savebutton from '../components/save_button'
|
||||
|
||||
export default {
|
||||
mounted: function() {
|
||||
this.$root.$on('field-change', this.handleFieldChange)
|
||||
@@ -29,8 +27,4 @@ export default {
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
|
||||
components: {
|
||||
savebutton,
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user