Skip to content
This repository was archived by the owner on Sep 13, 2023. It is now read-only.

Commit e4cc26d

Browse files
authored
feat(notes): crud tags + search (#30)
Closes #22
1 parent 70c61d7 commit e4cc26d

File tree

7 files changed

+27
-0
lines changed

7 files changed

+27
-0
lines changed

src/renderer/components/modals/create-note-modal/CreateNoteModal.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ <h2 class="text-red" v-if="displayDupError">Oh sorry, you can't have duplicated
2525
</b-input>
2626
</b-field>
2727

28+
<b-field v-if="!gistsSelected" horizontal label="Tags">
29+
<b-taginput
30+
v-model="note.tags"
31+
maxtags="5">
32+
</b-taginput>
33+
</b-field>
34+
2835
<b-field v-if="gistsSelected" horizontal label="Visibility">
2936
<b-select placeholder="Select a visibility" v-model="note.public">
3037
<option :value="false">Secret</option>

src/renderer/components/modals/create-note-modal/CreateNoteModal.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
public: false,
2222
updatedAt: null,
2323
createdAt: null,
24+
tags: []
2425
},
2526
files: [
2627
{

src/renderer/components/modals/update-note-modal/UpdateNoteModal.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ <h2 class="text-red" v-if="displayDupError">Oh sorry, you can't have duplicated
2525
</b-input>
2626
</b-field>
2727

28+
<b-field v-if="!gistsSelected" horizontal label="Tags">
29+
<b-taginput
30+
v-model="note.tags"
31+
maxtags="5">
32+
</b-taginput>
33+
</b-field>
34+
2835
<div class="note-file" v-for="file in files">
2936
<b-field horizontal label="Name" grouped>
3037
<b-input

src/renderer/components/modals/update-note-modal/UpdateNoteModal.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
files: {},
2525
updatedAt: null,
2626
createdAt: null,
27+
tags: []
2728
},
2829
files: [],
2930
gistFiles: [],
@@ -36,7 +37,9 @@
3637
this.$refs.noteDescription.focus();
3738
} else {
3839
this.$refs.noteName.focus();
40+
this.note.tags = this.note.tags ? this.note.tags : [];
3941
}
42+
4043
this.noteUpdated = {...this.note};
4144
this.noteUpdated.files = {};
4245
Object.keys(this.note.files).forEach((key, index) => {

src/renderer/components/notes-list/NotesList.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export default {
4343
el =>
4444
item.name.toLowerCase().indexOf(el.toLowerCase()) > -1 ||
4545
item.description.toLowerCase().indexOf(el.toLowerCase()) > -1 ||
46+
(item.tags ? item.tags.some(tag => tag.toLowerCase().indexOf(el.toLowerCase()) > -1) : false) ||
4647
Object.keys(item.files).some(
4748
key =>
4849
key.toLowerCase().indexOf(el.toLowerCase()) > -1 ||

src/renderer/components/notes-list/note-card/NoteCard.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ <h3 v-else>{{ note.name }}</h3>
2525
</div>
2626
<p v-if="!gistsSelected">{{note.description}}</p>
2727

28+
<b-tag type="is-dark" v-for="tag in note.tags" :data="tag"
29+
:key="tag.text">{{tag}}</b-tag>
30+
2831
<div class="note-file" v-for="(value, key, index) in note.files">
2932
<h4>{{value.name}}
3033
<span class="note-file-small">({{value.language}})

src/renderer/components/notes-list/note-card/NoteCard.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,8 @@
7474
.visibility-icon {
7575
font-size: 16px;
7676
}
77+
78+
.tag {
79+
margin-bottom: 12px;
80+
margin-right: 6px;
81+
}

0 commit comments

Comments
 (0)