Better control of Interest Keywords

This commit is contained in:
chris2fr 2020-10-26 05:31:51 +01:00
parent 50f8aab655
commit 246cd65bd5
2 changed files with 32 additions and 8 deletions

View File

@ -36,7 +36,7 @@ var sectionInterestsComponent = {
addKeyword: function(index) addKeyword: function(index)
{ {
var item = models.newDefaultInterestKeyword(); var item = models.newDefaultInterestKeyword();
//console.log("addHighlight(" + index + ")", this.$root.sections.interests[index]); //console.log("addKeyword(" + index + ")", this.$root.sections.interests[index]);
this.$root.sections.interests[index].keywords.push(item); this.$root.sections.interests[index].keywords.push(item);
}, },
@ -61,6 +61,31 @@ var sectionInterestsComponent = {
moveDownClicked: function(index) moveDownClicked: function(index)
{ {
this.$root.moveArrayPosition(this.$root.sections.interests, index, index + 1); this.$root.moveArrayPosition(this.$root.sections.interests, 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.interests[kIndex].keywords.splice(index, 1);
} }
},
moveUpClickedKeyword: function(kIndex,index)
{
if (index > 0)
this.$root.moveArrayPosition(this.$root.sections.interests[kIndex].keywords, index, index - 1);
},
moveDownClickedKeyword: function(kIndex,index)
{
if (index < this.$root.sections.interests[kIndex].keywords.length)
this.$root.moveArrayPosition(this.$root.sections.interests[kIndex].keywords, index, index + 1);
}
} }
}; };

View File

@ -537,10 +537,9 @@
<button type="button" class="w3-btn w3-white w3-border w3-border-blue w3-round w3-padding-small" v-on:click="addCourse(e_index)">+ Add Course</button> <button type="button" class="w3-btn w3-white w3-border w3-border-blue w3-round w3-padding-small" v-on:click="addCourse(e_index)">+ Add Course</button>
<form class="margin-top-32" v-for="(course, c_index) in edu.courses"> <form class="margin-top-32" v-for="(course, c_index) in edu.courses">
<simple-list-item v-bind:modelitem="$root.sections.education[e_index].courses" v-bind:id="c_index" v-on:delete-clicked="deleteClickedCourse(e_index,c_index)" v-on:move-up-clicked="moveUpClickedCourse(e_index,c_index)" v-on:move-down-clicked="moveDownClickedCourse(e_index,c_index)"></simple-list-item> <simple-list-item v-bind:modelitem="$root.sections.education[e_index].courses" v-bind:id="c_index" v-on:delete-clicked="deleteClickedCourse(e_index,c_index)" v-on:move-up-clicked="moveUpClickedCourse(e_index,c_index)" v-on:move-down-clicked="moveDownClickedCourse(e_index,c_index)"></simple-list-item>
</form> </form>
</div> </div>
</form> </form>
</div> </div>
@ -777,11 +776,11 @@
<small id="keywordsHelp" class="form-help text-muted">Keywords relating to the interest.</small> <small id="keywordsHelp" class="form-help text-muted">Keywords relating to the interest.</small>
<button type="button" class="w3-btn w3-white w3-border w3-border-blue w3-round w3-padding-small" v-on:click="addKeyword(i_index)">+ Add Keyword</button> <button type="button" class="w3-btn w3-white w3-border w3-border-blue w3-round w3-padding-small" v-on:click="addKeyword(i_index)">+ Add Keyword</button>
<ol>
<li v-for="(keyword, k_index) in interest.keywords"> <form class="margin-top-32" v-for="(keyword, k_index) in interest.keywords">
<input id="keywords[0]" class="w3-input w3-border" type="text" v-model="$root.sections.interests[i_index].keywords[k_index]"> <simple-list-item v-bind:modelitem="$root.sections.interests[i_index].keywords" v-bind:id="k_index" v-on:delete-clicked="deleteClickedKeyword(i_index,k_index)" v-on:move-up-clicked="moveUpClickedKeyword(i_index,k_index)" v-on:move-down-clicked="moveDownClickedKeyword(i_index,k_index)"></simple-list-item>
</li> </form>
</ol>
</div> </div>
</form> </form>
</div> </div>