* Search bar only appears in header menu on mobile
* Added tooltip to logout button * Tags follow archived, inbox, main note fast filters
This commit is contained in:
parent
771b739c37
commit
a51d81b013
@ -111,7 +111,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="six wide center aligned column">
|
<div class="six wide center aligned column">
|
||||||
<img v-if="!loggedIn" src="/api/static/assets/favicon.ico" alt="logo" />
|
<img v-if="!loggedIn" src="/api/static/assets/favicon.ico" alt="logo" />
|
||||||
<search-input v-if="loggedIn"></search-input>
|
<search-input v-if="loggedIn && mobile"></search-input>
|
||||||
</div>
|
</div>
|
||||||
<div class="three wide right aligned column">
|
<div class="three wide right aligned column">
|
||||||
|
|
||||||
@ -196,7 +196,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="menu-section" v-if="loggedIn">
|
<div class="menu-section" v-if="loggedIn" data-tooltip="Click to log out" data-inverted="" data-position="right center">
|
||||||
<div v-if="loggedIn" v-on:click="destroyLoginToken" class="menu-item menu-button">
|
<div v-if="loggedIn" v-on:click="destroyLoginToken" class="menu-item menu-button">
|
||||||
<i class="user outline icon"></i>{{ucWords($store.getters.getUsername)}}
|
<i class="user outline icon"></i>{{ucWords($store.getters.getUsername)}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -3,16 +3,16 @@
|
|||||||
|
|
||||||
<div class="ui grid" :class="{ 'mush-it-up':showOneColumn() }" ref="content">
|
<div class="ui grid" :class="{ 'mush-it-up':showOneColumn() }" ref="content">
|
||||||
|
|
||||||
<div v-if="!$store.getters.getIsUserOnMobile" class="sixteen wide column">
|
<div class="sixteen wide column">
|
||||||
<!-- :class="{ 'sixteen wide column':showOneColumn(), 'sixteen wide column':!showOneColumn() }" -->
|
<!-- :class="{ 'sixteen wide column':showOneColumn(), 'sixteen wide column':!showOneColumn() }" -->
|
||||||
|
|
||||||
<div class="ui grid">
|
<div class="ui grid">
|
||||||
|
|
||||||
<div class="eight wide column">
|
<div class="six wide column" v-if="!$store.getters.getIsUserOnMobile">
|
||||||
<search-input></search-input>
|
<search-input></search-input>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="eight wide column">
|
<div class="ten wide column" :class="{ 'sixteen wide column':$store.getters.getIsUserOnMobile }">
|
||||||
|
|
||||||
<div class="ui basic button" v-on:click="updateFastFilters(3)" v-if="$store.getters.totals && $store.getters.totals['sharedToNotes'] > 0" style="position: relative;">
|
<div class="ui basic button" v-on:click="updateFastFilters(3)" v-if="$store.getters.totals && $store.getters.totals['sharedToNotes'] > 0" style="position: relative;">
|
||||||
<i class="green mail icon"></i>Inbox
|
<i class="green mail icon"></i>Inbox
|
||||||
@ -41,14 +41,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div v-if="$store.getters.getIsUserOnMobile && showClear" class="row">
|
|
||||||
<div class="sixteen wide column">
|
|
||||||
<span class="ui fluid green button" @click="reset">
|
|
||||||
<i class="arrow circle left icon"></i>Back to All Notes
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="commonTags.length > 0" class="sixteen wide column">
|
<div v-if="commonTags.length > 0" class="sixteen wide column">
|
||||||
<h4><i class="green tags icon"></i>Tags</h4>
|
<h4><i class="green tags icon"></i>Tags</h4>
|
||||||
<span v-for="tag in commonTags" @click="toggleTagFilter(tag.id)">
|
<span v-for="tag in commonTags" @click="toggleTagFilter(tag.id)">
|
||||||
@ -654,7 +646,14 @@
|
|||||||
},
|
},
|
||||||
fetchUserTags(){
|
fetchUserTags(){
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios.post('/api/tag/usertags')
|
|
||||||
|
let postData = {
|
||||||
|
searchQuery: this.searchTerm,
|
||||||
|
searchTags: this.searchTags,
|
||||||
|
fastFilters: this.fastFilters,
|
||||||
|
}
|
||||||
|
|
||||||
|
axios.post('/api/tag/usertags', postData)
|
||||||
.then( ({data}) => {
|
.then( ({data}) => {
|
||||||
this.commonTags = data
|
this.commonTags = data
|
||||||
resolve(data)
|
resolve(data)
|
||||||
|
@ -2,16 +2,40 @@ let db = require('@config/database')
|
|||||||
|
|
||||||
let Tag = module.exports = {}
|
let Tag = module.exports = {}
|
||||||
|
|
||||||
Tag.userTags = (userId) => {
|
Tag.userTags = (userId, searchQuery, searchTags, fastFilters) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
db.promise()
|
|
||||||
.query(`
|
let query = `
|
||||||
SELECT tag.id, text, COUNT(note_tag.note_id) as usages FROM tag
|
SELECT
|
||||||
|
tag.id,
|
||||||
|
text,
|
||||||
|
COUNT(note_tag.note_id) as usages
|
||||||
|
FROM tag
|
||||||
JOIN note_tag ON tag.id = note_tag.tag_id
|
JOIN note_tag ON tag.id = note_tag.tag_id
|
||||||
|
JOIN note On note.id = note_tag.note_id
|
||||||
WHERE note_tag.user_id = ?
|
WHERE note_tag.user_id = ?
|
||||||
GROUP BY tag.id
|
`
|
||||||
ORDER BY id DESC
|
|
||||||
`, [userId])
|
//Show shared notes
|
||||||
|
if(fastFilters.onlyShowSharedNotes == 1){
|
||||||
|
query += ' AND note.share_user_id IS NOT NULL' //Show Archived
|
||||||
|
} else {
|
||||||
|
query += ' AND note.share_user_id IS NULL'
|
||||||
|
}
|
||||||
|
|
||||||
|
//Show archived notes, only if fast filter is set, default to not archived
|
||||||
|
if(fastFilters.onlyArchived == 1){
|
||||||
|
query += ' AND note.archived = 1' //Show Archived
|
||||||
|
} else {
|
||||||
|
query += ' AND note.archived = 0' //Exclude archived
|
||||||
|
}
|
||||||
|
|
||||||
|
query += ` GROUP BY tag.id
|
||||||
|
ORDER BY id DESC`
|
||||||
|
|
||||||
|
|
||||||
|
db.promise()
|
||||||
|
.query(query, [userId])
|
||||||
.then( (rows, fields) => {
|
.then( (rows, fields) => {
|
||||||
resolve(rows[0])
|
resolve(rows[0])
|
||||||
})
|
})
|
||||||
|
@ -44,7 +44,7 @@ router.post('/get', function (req, res) {
|
|||||||
|
|
||||||
//Get all the tags for this user in order of usage
|
//Get all the tags for this user in order of usage
|
||||||
router.post('/usertags', function (req, res) {
|
router.post('/usertags', function (req, res) {
|
||||||
Tags.userTags(userId)
|
Tags.userTags(userId, req.body.searchQuery, req.body.searchTags, req.body.fastFilters)
|
||||||
.then( data => res.send(data) )
|
.then( data => res.send(data) )
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user