OK for Delete and Reorder Profiles

This commit is contained in:
chris2fr 2020-10-16 16:17:46 +02:00
parent 748ce03536
commit a5d234f4ed
2 changed files with 25 additions and 1 deletions

View File

@ -55,6 +55,29 @@ var sectionBasicsComponent = {
{ {
var item = models.newDefaultBasic(); var item = models.newDefaultBasic();
this.$root.sections.basics.profiles.push(item); this.$root.sections.basics.profiles.push(item);
},
deleteClicked: function(index)
{
var response = confirm("Are you sure you want to delete this interest?");
if (response == true)
{
this.$root.sections.basics.profiles.splice(index, 1);
}
},
moveUpClicked: function(index)
{
this.$root.moveArrayPosition(this.$root.sections.basics.profiles, index, index - 1);
},
moveDownClicked: function(index)
{
this.$root.moveArrayPosition(this.$root.sections.basics.profiles, index, index + 1);
} }
} }
}; };

View File

@ -237,7 +237,8 @@
Any social networks that you participate in. Any social networks that you participate in.
<button type="button" class="w3-btn w3-white w3-border w3-border-blue w3-round w3-padding-small" v-on:click="addProfile">+ Add Profile</button> <button type="button" class="w3-btn w3-white w3-border w3-border-blue w3-round w3-padding-small" v-on:click="addProfile">+ Add Profile</button>
<form class="w3-container w3-card-4 w3-margin-top" v-for="profile in $root.sections.basics.profiles"> <form class="w3-container w3-card-4 w3-margin-top" v-for="(profile, pr_index) in $root.sections.basics.profiles">
<card-header v-bind:label="profile.network" v-bind:id="pr_index" v-on:delete-clicked="deleteClicked" v-on:move-up-clicked="moveUpClicked" v-on:move-down-clicked="moveDownClicked"></card-header>
<p> <p>
<label for="profiles.network" class="w3-text-blue"><b>Network</b></label> <label for="profiles.network" class="w3-text-blue"><b>Network</b></label>
<input id="profiles.network" class="w3-input w3-border" type="text" v-model="profile.network"> <input id="profiles.network" class="w3-input w3-border" type="text" v-model="profile.network">