From 9b7fc679e8f98a18c700ebef5fa1535f0e430c01 Mon Sep 17 00:00:00 2001 From: Max G Date: Mon, 10 Feb 2020 22:21:06 +0000 Subject: [PATCH] * Tags can now be toggled by clicking * Side slide component now respects note colors --- client/src/components/NoteInputPanel.vue | 6 +-- client/src/components/NoteTagEdit.vue | 41 ++++++++++++++++--- .../src/components/SideSlideMenuComponent.vue | 24 +++++++++-- 3 files changed, 58 insertions(+), 13 deletions(-) diff --git a/client/src/components/NoteInputPanel.vue b/client/src/components/NoteInputPanel.vue index ddba792..1b62523 100644 --- a/client/src/components/NoteInputPanel.vue +++ b/client/src/components/NoteInputPanel.vue @@ -118,13 +118,13 @@ /> - +
- +
- +
diff --git a/client/src/components/NoteTagEdit.vue b/client/src/components/NoteTagEdit.vue index 17bc33e..5dc63c0 100644 --- a/client/src/components/NoteTagEdit.vue +++ b/client/src/components/NoteTagEdit.vue @@ -13,7 +13,7 @@

All Tags

-
+
{{ ucWords(tag.text) }}
@@ -42,7 +42,7 @@ v-on:focus="onFocus" />
-
+
{{ucWords(item.text)}} Press Enter to add
@@ -98,6 +98,7 @@ return true } } + return false }, getTagTextById(id){ let tag = this.getTagById(id) @@ -171,9 +172,38 @@ } }, 300) }, - onClickTag(index){ + onSuggestionClick(index){ this.newTagInput = this.suggestions[index].text this.addTag() + }, + toggleTag(tagText, id){ + + //remove tag + if(this.isTagOnNote(id)){ + + //Find database ID for tag + let entryId = null + this.noteTagIds.forEach(tag => { + if(tag.tagId == id){ + entryId = tag.entryId + return + } + }) + + //Submit database entry to be removed + if(entryId){ + this.removeTag(entryId) + } + return + } + + //Add Tag + this.newTagInput = tagText + this.addTag() + return + + + }, addTag(){ @@ -228,6 +258,8 @@ }, removeTag(tagId){ + console.log(tagId) + let postData = { 'tagId':tagId, 'noteId':this.noteId @@ -255,9 +287,6 @@ /* note tag edit area */ .full-tag-area { - - color: var(--text_color); - background-color: var(--background_color); /*padding: 15px;*/ /*border: 1px solid;*/ border-color: var(--border_color); diff --git a/client/src/components/SideSlideMenuComponent.vue b/client/src/components/SideSlideMenuComponent.vue index ed0e8f0..0d6a5fe 100644 --- a/client/src/components/SideSlideMenuComponent.vue +++ b/client/src/components/SideSlideMenuComponent.vue @@ -8,13 +8,16 @@ z-index: 400; overflow: hidden; height: 100%; + + color: var(--text_color); + background-color: var(--background_color); } .slide-content { box-sizing: border-box; /*padding: 1em 1.5em;*/ height: calc(100% - 43px); border-right: 1px solid var(--menu-border); - background-color: var(--background_color); + /*background-color: var(--background_color);*/ overflow-x: scroll; } .slide-shadow { @@ -71,7 +74,7 @@
-
+
@@ -94,13 +97,15 @@