From 246cd65bd54ee4c3abefdc6838f1ac87408a42bd Mon Sep 17 00:00:00 2001 From: chris2fr Date: Mon, 26 Oct 2020 05:31:51 +0100 Subject: [PATCH] Better control of Interest Keywords --- components/section_interests.js | 27 ++++++++++++++++++++++++++- index.html | 13 ++++++------- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/components/section_interests.js b/components/section_interests.js index 52a63c2..061c852 100644 --- a/components/section_interests.js +++ b/components/section_interests.js @@ -36,7 +36,7 @@ var sectionInterestsComponent = { addKeyword: function(index) { 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); }, @@ -61,6 +61,31 @@ var sectionInterestsComponent = { moveDownClicked: function(index) { 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); + } + } }; \ No newline at end of file diff --git a/index.html b/index.html index c6dfa5d..b253ce0 100644 --- a/index.html +++ b/index.html @@ -537,10 +537,9 @@ -
-
+ @@ -777,11 +776,11 @@ Keywords relating to the interest. -
    -
  1. - -
  2. -
+ +
+ +
+