Send valid form data
This commit is contained in:
parent
70cc82a1e7
commit
d9e66e04c2
@ -1,5 +1,7 @@
|
|||||||
import textinput from '../text_input'
|
import textinput from '../text_input'
|
||||||
|
|
||||||
|
const createEnvironment = (name) => ({ name })
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'new-project',
|
name: 'new-project',
|
||||||
|
|
||||||
@ -18,7 +20,7 @@ export default {
|
|||||||
const {
|
const {
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
environments = ['']
|
environments = [ createEnvironment() ]
|
||||||
} = this.initialData
|
} = this.initialData
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -34,7 +36,7 @@ export default {
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
addEnvironment: function (event) {
|
addEnvironment: function (event) {
|
||||||
this.environments.push('')
|
this.environments.push(createEnvironment(""))
|
||||||
},
|
},
|
||||||
|
|
||||||
removeEnvironment: function (index) {
|
removeEnvironment: function (index) {
|
||||||
|
@ -34,13 +34,14 @@
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li v-for="(_, i) in environments" class="block-list__item">
|
<li v-for="(environment, i) in environments" class="block-list__item">
|
||||||
{{ TextInput(form.environment_name) }}
|
{{ form.environment_names.label }}
|
||||||
|
<textarea :name="'environment_names-' + i" :id="'environment_names-' + i" v-model="environment.name"></textarea>
|
||||||
<span class="icon-link icon-link--danger icon-link--vertical" v-on:click="removeEnvironment(i)">{{ Icon('x') }} Remove</span>
|
<span class="icon-link icon-link--danger icon-link--vertical" v-on:click="removeEnvironment(i)">{{ Icon('x') }} Remove</span>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
{{ form.environment_names.errors }}
|
||||||
<div class="block-list__footer">
|
<div class="block-list__footer">
|
||||||
<a v-on:click="addEnvironment" class="icon-link">Add another environment</a>
|
<a v-on:click="addEnvironment" class="icon-link">Add another environment</a>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user