Remove unnecessary savebutton vue component and create SaveButton Macro

This commit is contained in:
leigh-mil
2019-04-02 16:01:08 -04:00
parent 02cc18a93f
commit 1aaf4421ab
13 changed files with 25 additions and 49 deletions

View File

@@ -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

View File

@@ -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>',
}

View File

@@ -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,
},

View File

@@ -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,
},
}