Big Refactor of all SQL calls to comply with database changes

Added tag suggestions when entering tag field
Cleaned up animations to make them REAL smooth
This commit is contained in:
Max G
2019-07-30 20:27:26 +00:00
parent 0d86aa4ff9
commit b2dc6e5218
8 changed files with 111 additions and 77 deletions

View File

@@ -232,7 +232,7 @@
setTimeout(() => {
resolve(true)
return
}, 500)
}, 300)
}
const postData = {
@@ -256,7 +256,7 @@
vm.lastNoteHash = vm.hashString(vm.noteText)
resolve(true)
})
}, 500)
}, 300)
})
},
@@ -335,7 +335,7 @@
}
.size-down {
animation: size-down 0.5s linear both;
animation: size-down 0.5s ease;
}
@keyframes size-down {
@@ -345,7 +345,7 @@
}
100% {
opacity: 0;
top: 405vh;
top: 30vh;
}
}

View File

@@ -4,10 +4,13 @@
{{ucWords(tag.text)}} <i class="delete icon" v-on:click="removeTag(tag.id)"></i>
</div>
<div class="ui form">
<input v-model="newTagInput" placeholder="Add Tag"
<input
placeholder="Add Tag"
v-model="newTagInput"
v-on:keydown="tagInput"
v-on:keyup="onKeyup"
v-on:blur="onBlur"
v-on:focus="onFocus"
/>
<div class="suggestion-box" v-if="suggestions.length > 0">
<div class="suggestion-item" v-for="(item, index) in suggestions" :class="{ 'active':(index == selection) }" v-on:click="onClickTag(index)">
@@ -70,7 +73,6 @@
if(this.selection >= this.suggestions.length){
this.selection = -1 //No selection made
}
console.log('Current Selection Index: ', this.selection)
return
}
//Down - 40 - Go Down Suggestion
@@ -79,7 +81,6 @@
if(this.selection < -1){
this.selection = this.suggestions.length -1 //No selection made
}
console.log('Current Selection Index: ', this.selection)
return;
}
@@ -137,7 +138,22 @@
vm.getTags()
})
},
onFocus(){
console.log('Focused on tag edit')
//Show suggested tags
let vm = this
let postData = {
'noteId':this.noteId
}
axios.post('/api/tag/latest', postData)
.then(response => {
vm.suggestions = response.data
vm.selection = -1 //Nothing selected
})
},
onKeyup(){
//Clear tags if backspaced
if(this.newTagInput == ''){
this.clearSuggestions()
}

View File

@@ -28,22 +28,22 @@
<delete-button :note-id="note.id" />
</div>
</div>
</div>
<!-- Display highlights from solr results -->
<div v-if="note.note_highlights.length > 0" class="term-usage">
<p><i class="paragraph icon"></i> Note Text</p>
<div class="usage-row" v-for="highlight in note.note_highlights" v-html="highlight"></div>
</div>
<div v-if="note.attachment_highlights.length > 0" class="term-usage">
<p><i class="linkify icon"></i> Note URL Text</p>
<div class="usage-row" v-for="highlight in note.attachment_highlights" v-html="highlight"></div>
</div>
<div v-if="note.tag_highlights.length > 0" class="term-usage">
<i class="tags icon"></i> Tag
<div class="ui icon large label" v-for="highlight in note.tag_highlights" v-html="highlight"></div>
</div>
<!-- Display highlights from solr results -->
<div v-if="note.note_highlights.length > 0" class="term-usage">
<p>Note Text</p>
<div class="usage-row" v-for="highlight in note.note_highlights" v-html="highlight"></div>
</div>
<div v-if="note.attachment_highlights.length > 0" class="term-usage">
<p><i class="linkify icon"></i> Note URL Text</p>
<div class="usage-row" v-for="highlight in note.attachment_highlights" v-html="highlight"></div>
</div>
<div v-if="note.tag_highlights.length > 0" class="term-usage">
<i class="tags icon"></i> Tag
<div class="ui icon large label" v-for="highlight in note.tag_highlights" v-html="highlight"></div>
</div>
</div>
</div>
</template>
@@ -77,8 +77,9 @@
<style type="text/css">
.term-usage {
border: 1px solid #DDD;
border-top: 1px solid #DDD;
padding: 10px;
width: 100%;
}
.term-usage em {
color: green;

View File

@@ -77,7 +77,7 @@
v-for="note in notes"
:onClick="openNote"
:data="note"
:key="note.id + note.color + searchTerm + note.note_highlights.length + note.attachment_highlights.length + ' -' + note.tag_highlights.length + '-' +note.title.length + '-' +note.subtext.length"
:key="note.id + note.color + note.note_highlights.length + note.attachment_highlights.length + ' -' + note.tag_highlights.length + '-' +note.title.length + '-' +note.subtext.length"
/>
</div>