Added Skill Keyword Manipulation

This commit is contained in:
chris2fr 2020-10-26 10:30:46 +01:00
parent 10ac7cf5b8
commit c6ea974f4e
2 changed files with 26 additions and 5 deletions

View File

@ -64,6 +64,29 @@ var sectionSkillsComponent = {
moveDownClicked: function(index)
{
this.$root.moveArrayPosition(this.$root.sections.skills, index, index + 1);
},
deleteClickedKeyword: function(kIndex, index)
{
var response = confirm("Are you sure you want to delete this keyword?");
if (response == true)
{
this.$root.sections.skills[kIndex].keywords.splice(index, 1);
}
},
moveUpClickedKeyword: function(kIndex,index)
{
if (index > 0)
this.$root.moveArrayPosition(this.$root.sections.skills[kIndex].keywords, index, index - 1);
},
moveDownClickedKeyword: function(kIndex,index)
{
if (index < this.$root.sections.skills[kIndex].keywords.length)
this.$root.moveArrayPosition(this.$root.sections.skills[kIndex].keywords, index, index + 1);
}
}
};

View File

@ -694,11 +694,9 @@
<small id="keywordsHelp" class="form-help text-muted">Keywords (e.g. HTML, CSS, JavaScript).</small>
<button type="button" class="w3-btn w3-white w3-border w3-border-blue w3-round w3-padding-small" v-on:click="addKeyword(s_index)">+ Add Keyword</button>
<ol>
<li v-for="(keyword, k_index) in skill.keywords">
<input id="keywords[0]" class="w3-input w3-border" type="text" v-model="$root.sections.skills[s_index].keywords[k_index]">
</li>
</ol>
<form class="margin-top-32" v-for="(keyword, k_index) in skill.keywords">
<simple-list-item v-bind:modelitem="$root.sections.skills[s_index].keywords" v-bind:id="k_index" v-on:delete-clicked="deleteClickedKeyword(s_index,k_index)" v-on:move-up-clicked="moveUpClickedKeyword(s_index,k_index)" v-on:move-down-clicked="moveDownClickedKeyword(s_index,k_index)"></simple-list-item>
</form>
</div>
</form>
</div>