Merge pull request #1180 from dod-ccpo/vue-emitters-fix_part-2
Vue emitters fix part 2 -- New app form and app settings
This commit is contained in:
commit
522f91795c
@ -2,7 +2,7 @@ import ally from 'ally.js'
|
|||||||
import stickybits from 'stickybits'
|
import stickybits from 'stickybits'
|
||||||
|
|
||||||
import DateSelector from '../date_selector'
|
import DateSelector from '../date_selector'
|
||||||
import FormMixin from '../../mixins/form'
|
import FormMixin from '../../mixins/form_mixin'
|
||||||
import Modal from '../../mixins/modal'
|
import Modal from '../../mixins/modal'
|
||||||
import MultiStepModalForm from './multi_step_modal_form'
|
import MultiStepModalForm from './multi_step_modal_form'
|
||||||
import checkboxinput from '../checkbox_input'
|
import checkboxinput from '../checkbox_input'
|
||||||
@ -10,7 +10,6 @@ import multicheckboxinput from '../multi_checkbox_input'
|
|||||||
import optionsinput from '../options_input'
|
import optionsinput from '../options_input'
|
||||||
import SemiCollapsibleText from '../semi_collapsible_text'
|
import SemiCollapsibleText from '../semi_collapsible_text'
|
||||||
import textinput from '../text_input'
|
import textinput from '../text_input'
|
||||||
import ToForm from './to_form.js'
|
|
||||||
import toggler from '../toggler'
|
import toggler from '../toggler'
|
||||||
import uploadinput from '../upload_input'
|
import uploadinput from '../upload_input'
|
||||||
|
|
||||||
@ -25,7 +24,6 @@ export default {
|
|||||||
optionsinput,
|
optionsinput,
|
||||||
SemiCollapsibleText,
|
SemiCollapsibleText,
|
||||||
textinput,
|
textinput,
|
||||||
ToForm,
|
|
||||||
toggler,
|
toggler,
|
||||||
uploadinput,
|
uploadinput,
|
||||||
},
|
},
|
||||||
|
@ -51,7 +51,6 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
mounted: function() {
|
mounted: function() {
|
||||||
this.$root.$on('onEnvironmentAdded', this.addEnvironment)
|
|
||||||
this.validate()
|
this.validate()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
import FormMixin from '../../../mixins/form'
|
|
||||||
import textinput from '../../text_input'
|
|
||||||
import * as R from 'ramda'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'application-name-and-description',
|
|
||||||
|
|
||||||
mixins: [FormMixin],
|
|
||||||
|
|
||||||
components: {
|
|
||||||
textinput,
|
|
||||||
},
|
|
||||||
created: function() {
|
|
||||||
this.$root.$on('field-change', this.handleFieldChange)
|
|
||||||
if (this.initialData) this.changed = true
|
|
||||||
},
|
|
||||||
|
|
||||||
data: function() {
|
|
||||||
return {
|
|
||||||
errors: [],
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
@ -1,15 +1,6 @@
|
|||||||
import optionsinput from '../components/options_input'
|
|
||||||
import textinput from '../components/text_input'
|
|
||||||
import { emitEvent } from '../lib/emitters'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'multicheckboxinput',
|
name: 'multicheckboxinput',
|
||||||
|
|
||||||
components: {
|
|
||||||
optionsinput,
|
|
||||||
textinput,
|
|
||||||
},
|
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
name: String,
|
name: String,
|
||||||
initialErrors: {
|
initialErrors: {
|
||||||
@ -41,10 +32,7 @@ export default {
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onInput: function(e) {
|
onInput: function(e) {
|
||||||
emitEvent('field-change', this, {
|
this.$parent.$emit('field-change')
|
||||||
value: e.target.value,
|
|
||||||
name: this.name,
|
|
||||||
})
|
|
||||||
this.showError = false
|
this.showError = false
|
||||||
this.showValid = true
|
this.showValid = true
|
||||||
},
|
},
|
||||||
@ -52,4 +40,10 @@ export default {
|
|||||||
this.otherChecked = !this.otherChecked
|
this.otherChecked = !this.otherChecked
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
valid: function() {
|
||||||
|
return this.showValid
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
import FormMixin from '../mixins/form'
|
|
||||||
import optionsinput from './options_input'
|
import optionsinput from './options_input'
|
||||||
import textinput from './text_input'
|
import textinput from './text_input'
|
||||||
|
import BaseForm from './forms/base_form'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'toggler',
|
name: 'toggler',
|
||||||
|
|
||||||
mixins: [FormMixin],
|
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
initialSelectedSection: {
|
initialSelectedSection: {
|
||||||
type: String,
|
type: String,
|
||||||
@ -18,6 +16,7 @@ export default {
|
|||||||
optionsinput,
|
optionsinput,
|
||||||
textinput,
|
textinput,
|
||||||
optionsinput,
|
optionsinput,
|
||||||
|
BaseForm,
|
||||||
toggler: this,
|
toggler: this,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ import textinput from './components/text_input'
|
|||||||
import checkboxinput from './components/checkbox_input'
|
import checkboxinput from './components/checkbox_input'
|
||||||
import poc from './components/forms/poc'
|
import poc from './components/forms/poc'
|
||||||
import toggler from './components/toggler'
|
import toggler from './components/toggler'
|
||||||
import ApplicationNameAndDescription from './components/forms/new_application/name_and_description'
|
|
||||||
import ApplicationEnvironments from './components/forms/new_application/environments'
|
import ApplicationEnvironments from './components/forms/new_application/environments'
|
||||||
import MultiStepModalForm from './components/forms/multi_step_modal_form'
|
import MultiStepModalForm from './components/forms/multi_step_modal_form'
|
||||||
import uploadinput from './components/upload_input'
|
import uploadinput from './components/upload_input'
|
||||||
@ -49,7 +48,6 @@ const app = new Vue({
|
|||||||
textinput,
|
textinput,
|
||||||
checkboxinput,
|
checkboxinput,
|
||||||
poc,
|
poc,
|
||||||
ApplicationNameAndDescription,
|
|
||||||
ApplicationEnvironments,
|
ApplicationEnvironments,
|
||||||
BudgetChart,
|
BudgetChart,
|
||||||
SpendTable,
|
SpendTable,
|
||||||
|
@ -34,6 +34,18 @@ export default {
|
|||||||
this.validateForm()
|
this.validateForm()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleChildFieldChange: function(event) {
|
||||||
|
// need to temporarily use this function because we will no longer be passing
|
||||||
|
// parent_uid or watch from the child components
|
||||||
|
const { name, valid } = event
|
||||||
|
if (typeof this.fields[name] !== 'undefined') {
|
||||||
|
this.fields[name] = valid
|
||||||
|
this.changed = true
|
||||||
|
}
|
||||||
|
|
||||||
|
this.validateForm()
|
||||||
|
},
|
||||||
|
|
||||||
handleFieldMount: function(event) {
|
handleFieldMount: function(event) {
|
||||||
const { name, optional, valid } = event
|
const { name, optional, valid } = event
|
||||||
this.fields[name] = optional || valid
|
this.fields[name] = optional || valid
|
||||||
|
@ -78,15 +78,17 @@
|
|||||||
{% call ToggleSection(section_name="edit") %}
|
{% call ToggleSection(section_name="edit") %}
|
||||||
<ul>
|
<ul>
|
||||||
<li class="accordion-table__item-toggle-content__expanded">
|
<li class="accordion-table__item-toggle-content__expanded">
|
||||||
<form action="{{ url_for('applications.update_environment', environment_id=env['id']) }}" method="post" v-on:submit="handleSubmit">
|
<base-form inline-template>
|
||||||
{{ edit_form.csrf_token }}
|
<form action="{{ url_for('applications.update_environment', environment_id=env['id']) }}" method="post" v-on:submit="handleSubmit">
|
||||||
{{ TextInput(edit_form.name, validation='requiredField', optional=False) }}
|
{{ edit_form.csrf_token }}
|
||||||
{{
|
{{ TextInput(edit_form.name, validation='requiredField', optional=False) }}
|
||||||
SaveButton(
|
{{
|
||||||
text=("common.save" | translate)
|
SaveButton(
|
||||||
)
|
text=("common.save" | translate)
|
||||||
}}
|
)
|
||||||
</form>
|
}}
|
||||||
|
</form>
|
||||||
|
</base-form>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
@ -16,12 +16,12 @@
|
|||||||
{% include "portfolios/header.html" %}
|
{% include "portfolios/header.html" %}
|
||||||
{{ StickyCTA(text=('portfolios.applications.new.step_1_header' | translate | safe), context="Step 1 of 3") }}
|
{{ StickyCTA(text=('portfolios.applications.new.step_1_header' | translate | safe), context="Step 1 of 3") }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block application_content %}
|
{% block application_content %}
|
||||||
|
|
||||||
{% include "fragments/flash.html" %}
|
{% include "fragments/flash.html" %}
|
||||||
|
|
||||||
<application-name-and-description inline-template v-bind:initial-data='{{ form.data|tojson }}'>
|
<base-form inline-template :enable-save="true">
|
||||||
<form method="POST" action="{{ action }}" v-on:submit="handleSubmit">
|
<form method="POST" action="{{ action }}" v-on:submit="handleSubmit">
|
||||||
{{ form.csrf_token }}
|
{{ form.csrf_token }}
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@ -43,12 +43,11 @@
|
|||||||
{% block next_button %}
|
{% block next_button %}
|
||||||
{{ SaveButton(text=('portfolios.applications.new.step_1_button_text' | translate)) }}
|
{{ SaveButton(text=('portfolios.applications.new.step_1_button_text' | translate)) }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
<button disabled class="usa-button usa-button-secondary">Previous</button>
|
|
||||||
<a href="{{ url_for('applications.portfolio_applications', portfolio_id=portfolio.id) }}">
|
<a href="{{ url_for('applications.portfolio_applications', portfolio_id=portfolio.id) }}">
|
||||||
Cancel
|
Cancel
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</form>
|
</form>
|
||||||
</application-name-and-description>
|
</base-form>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user