From 69ee43acd0aab3912bdce8a9bccb168a83331fcd Mon Sep 17 00:00:00 2001 From: chris2fr Date: Mon, 26 Oct 2020 11:18:45 +0100 Subject: [PATCH] Added uniform management of sub-items --- app/app.js | 21 ++++++++++++++++ components/section_education.js | 23 ----------------- components/section_interests.js | 24 ------------------ components/section_projects.js | 21 ---------------- components/section_skills.js | 23 ----------------- components/section_work.js | 25 ++----------------- index.html | 44 +++++++++++++++++---------------- 7 files changed, 46 insertions(+), 135 deletions(-) diff --git a/app/app.js b/app/app.js index 9e3bbca..73ad5ce 100644 --- a/app/app.js +++ b/app/app.js @@ -481,6 +481,27 @@ var app = new Vue({ arr.splice(new_index, 0, arr.splice(old_index, 1)[0]); return arr; // for testing + }, + + deleteClickedSubitem: function(mainitem, index) + { + var response = confirm("Are you sure you want to delete this subitem?"); + + if (response == true) + { + mainitem.splice(index, 1); + } + }, + + moveUpClickedSubitem: function(mainitem,index) + { + this.$root.moveArrayPosition(mainitem, index, index - 1); + }, + + + moveDownClickedSubitem: function(mainitem,index) + { + this.$root.moveArrayPosition(mainitem, index, index + 1); } }, diff --git a/components/section_education.js b/components/section_education.js index 0fd0bc1..fe09977 100644 --- a/components/section_education.js +++ b/components/section_education.js @@ -58,29 +58,6 @@ var sectionEducationComponent = { moveDownClicked: function(index) { this.$root.moveArrayPosition(this.$root.sections.education, index, index + 1); - }, - - deleteClickedCourse: function(eIndex, index) - { - var response = confirm("Are you sure you want to delete this Course?"); - - if (response == true) - { - this.$root.sections.education[eIndex].courses.splice(index, 1); - } - }, - - moveUpClickedCourse: function(eIndex,index) - { - if (index > 0) - this.$root.moveArrayPosition(this.$root.sections.education[eIndex].courses, index, index - 1); - }, - - - moveDownClickedCourse: function(eIndex,index) - { - if (index < this.$root.sections.education[eIndex].courses.length) - this.$root.moveArrayPosition(this.$root.sections.education[eIndex].courses, index, index + 1); } } diff --git a/components/section_interests.js b/components/section_interests.js index 061c852..e724e70 100644 --- a/components/section_interests.js +++ b/components/section_interests.js @@ -61,31 +61,7 @@ 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/components/section_projects.js b/components/section_projects.js index 9c85424..59e0ebf 100644 --- a/components/section_projects.js +++ b/components/section_projects.js @@ -92,27 +92,6 @@ var sectionProjectsComponent = { moveDownClicked: function(index) { this.$root.moveArrayPosition(this.$root.sections.work, index, index + 1); - }, - - deleteClickedSubitem: function(mainitem, index) - { - var response = confirm("Are you sure you want to delete this keyword?"); - - if (response == true) - { - mainitem.splice(index, 1); - } - }, - - moveUpClickedSubitem: function(mainitem,index) - { - this.$root.moveArrayPosition(mainitem, index, index - 1); - }, - - - moveDownClickedSubitem: function(mainitem,index) - { - this.$root.moveArrayPosition(mainitem, index, index + 1); } } }; \ No newline at end of file diff --git a/components/section_skills.js b/components/section_skills.js index 356473a..e2a7dc9 100644 --- a/components/section_skills.js +++ b/components/section_skills.js @@ -64,29 +64,6 @@ 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); } } }; \ No newline at end of file diff --git a/components/section_work.js b/components/section_work.js index 26b676f..5cd2fde 100644 --- a/components/section_work.js +++ b/components/section_work.js @@ -62,29 +62,8 @@ var sectionWorkComponent = { moveDownClicked: function(index) { this.$root.moveArrayPosition(this.$root.sections.work, index, index + 1); - }, - - deleteClickedHighlight: function(wIndex, index) - { - var response = confirm("Are you sure you want to delete this highlight?"); - - if (response == true) - { - this.$root.sections.work[wIndex].highlights.splice(index, 1); - } - }, - - moveUpClickedHighlight: function(wIndex,index) - { - if (index > 0) - this.$root.moveArrayPosition(this.$root.sections.work[wIndex].highlights, index, index - 1); - }, - - - moveDownClickedHighlight: function(wIndex,index) - { - if (index < this.$root.sections.work[wIndex].highlights.length) - this.$root.moveArrayPosition(this.$root.sections.work[wIndex].highlights, index, index + 1); } + } + }; \ No newline at end of file diff --git a/index.html b/index.html index e657feb..e31d0c9 100644 --- a/index.html +++ b/index.html @@ -374,11 +374,10 @@ - - -
- + +
+