Merge pull request #779 from dod-ccpo/disable-next-button

Disable Next Button in Modal
This commit is contained in:
montana-mil 2019-04-22 10:42:06 -04:00 committed by GitHub
commit 5d4ba46c25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 30 additions and 22 deletions

View File

@ -1,4 +1,4 @@
import { emitFieldChange } from '../lib/emitters' import { emitEvent } from '../lib/emitters'
export default { export default {
name: 'checkboxinput', name: 'checkboxinput',
@ -9,7 +9,10 @@ export default {
methods: { methods: {
onInput: function(e) { onInput: function(e) {
emitFieldChange(this, { value: e.target.checked, name: this.name }) emitEvent('field-change', this, {
value: e.target.checked,
name: this.name,
})
}, },
}, },
} }

View File

@ -1,6 +1,6 @@
import Vue from 'vue' import Vue from 'vue'
import { getDaysInMonth } from 'date-fns' import { getDaysInMonth } from 'date-fns'
import { emitFieldChange } from '../lib/emitters' import { emitEvent } from '../lib/emitters'
var paddedNumber = function(number) { var paddedNumber = function(number) {
if ((number + '').length === 1) { if ((number + '').length === 1) {
@ -136,7 +136,7 @@ export default {
methods: { methods: {
_emitChange: function(name, value, valid) { _emitChange: function(name, value, valid) {
emitFieldChange(this, { value, name }) emitEvent('field-change', this, { value, name })
}, },
}, },

View File

@ -51,9 +51,12 @@ export default {
} }
}, },
handleValidChange: function(event) { handleValidChange: function(event) {
const { name, valid } = event const { name, valid, parent_uid } = event
this.fields[name] = valid // check that this field is in the modal and not on some other form
this._checkIsValid() if (parent_uid === this._uid) {
this.fields[name] = valid
this._checkIsValid()
}
}, },
_checkIsValid: function() { _checkIsValid: function() {
const valid = !Object.values(this.fields).some(field => field === false) const valid = !Object.values(this.fields).some(field => field === false)

View File

@ -1,6 +1,6 @@
import optionsinput from '../components/options_input' import optionsinput from '../components/options_input'
import textinput from '../components/text_input' import textinput from '../components/text_input'
import { emitFieldChange } from '../lib/emitters' import { emitEvent } from '../lib/emitters'
export default { export default {
name: 'multicheckboxinput', name: 'multicheckboxinput',
@ -41,7 +41,10 @@ export default {
methods: { methods: {
onInput: function(e) { onInput: function(e) {
emitFieldChange(this, { value: e.target.value, name: this.name }) emitEvent('field-change', this, {
value: e.target.value,
name: this.name,
})
this.showError = false this.showError = false
this.showValid = true this.showValid = true
}, },

View File

@ -1,4 +1,4 @@
import { emitFieldChange } from '../lib/emitters' import { emitEvent } from '../lib/emitters'
export default { export default {
name: 'optionsinput', name: 'optionsinput',
@ -23,7 +23,10 @@ export default {
methods: { methods: {
onInput: function(e) { onInput: function(e) {
emitFieldChange(this, { value: e.target.value, name: this.name }) emitEvent('field-change', this, {
value: e.target.value,
name: this.name,
})
this.showError = false this.showError = false
this.showValid = true this.showValid = true
}, },

View File

@ -1,7 +1,7 @@
import MaskedInput, { conformToMask } from 'vue-text-mask' import MaskedInput, { conformToMask } from 'vue-text-mask'
import inputValidations from '../lib/input_validations' import inputValidations from '../lib/input_validations'
import { formatDollars } from '../lib/dollars' import { formatDollars } from '../lib/dollars'
import { emitFieldChange } from '../lib/emitters' import { emitEvent } from '../lib/emitters'
export default { export default {
name: 'textinput', name: 'textinput',
@ -67,9 +67,9 @@ export default {
}, },
created: function() { created: function() {
this.$root.$emit('field-mount', { emitEvent('field-mount', this, {
name: this.name,
optional: this.optional, optional: this.optional,
name: this.name,
}) })
}, },
@ -125,7 +125,7 @@ export default {
this.showValid = this.value != '' && valid this.showValid = this.value != '' && valid
// Emit a change event // Emit a change event
emitFieldChange(this, { emitEvent('field-change', this, {
value: this._rawValue(value), value: this._rawValue(value),
valid, valid,
name: this.name, name: this.name,

View File

@ -1,5 +1,5 @@
export const emitFieldChange = (el, data) => { export const emitEvent = (event_type, el, data) => {
el.$root.$emit('field-change', { el.$root.$emit(event_type, {
...data, ...data,
parent_uid: el.$parent && el.$parent._uid, parent_uid: el.$parent && el.$parent._uid,
}) })

View File

@ -1,4 +1,4 @@
{% from "components/confirmation_button.html" import ConfirmationButton %} {% from "components/options_input.html" import OptionsInput %}
{% for subform in member_perms_form.members_permissions %} {% for subform in member_perms_form.members_permissions %}
{% set modal_id = "portfolio_id_{}_user_id_{}".format(portfolio.id, subform.user_id.data) %} {% set modal_id = "portfolio_id_{}_user_id_{}".format(portfolio.id, subform.user_id.data) %}

View File

@ -1,7 +1,5 @@
{% from "components/icon.html" import Icon %} {% from "components/icon.html" import Icon %}
{% from "components/options_input.html" import OptionsInput %}
{% from 'components/save_button.html' import SaveButton %} {% from 'components/save_button.html' import SaveButton %}
{% from "components/modal.html" import Modal %} {% from "components/modal.html" import Modal %}
{% from "components/alert.html" import Alert %} {% from "components/alert.html" import Alert %}

View File

@ -1,9 +1,7 @@
{% extends "portfolios/base.html" %} {% extends "portfolios/base.html" %}
{% from "components/pagination.html" import Pagination %} {% from "components/pagination.html" import Pagination %}
{% from "components/icon.html" import Icon %}
{% from "components/text_input.html" import TextInput %} {% from "components/text_input.html" import TextInput %}
{% from "components/multi_step_modal_form.html" import MultiStepModalForm %}
{% from 'components/save_button.html' import SaveButton %} {% from 'components/save_button.html' import SaveButton %}
{% set secondary_breadcrumb = "navigation.portfolio_navigation.portfolio_admin" | translate %} {% set secondary_breadcrumb = "navigation.portfolio_navigation.portfolio_admin" | translate %}