ピン留めを解除することができるようにしたり

This commit is contained in:
syuilo
2018-09-24 16:26:12 +09:00
parent 7b4c307c46
commit 59d67d3140
6 changed files with 128 additions and 46 deletions

View File

@ -28,11 +28,19 @@ export default Vue.extend({
}];
if (this.note.userId == this.$store.state.i.id) {
items.push({
icon: '%fa:thumbtack%',
text: '%i18n:@pin%',
action: this.pin
});
if (this.$store.state.i.pinnedNoteIds.includes(this.note.id)) {
items.push({
icon: '%fa:thumbtack%',
text: '%i18n:@unpin%',
action: this.unpin
});
} else {
items.push({
icon: '%fa:thumbtack%',
text: '%i18n:@pin%',
action: this.pin
});
}
}
if (this.note.userId == this.$store.state.i.id || this.$store.state.i.isAdmin) {
@ -56,6 +64,7 @@ export default Vue.extend({
return items;
}
},
methods: {
detail() {
this.$router.push(`/notes/${ this.note.id }`);
@ -73,6 +82,14 @@ export default Vue.extend({
});
},
unpin() {
(this as any).api('i/unpin', {
noteId: this.note.id
}).then(() => {
this.destroyDom();
});
},
del() {
if (!window.confirm('%i18n:@delete-confirm%')) return;
(this as any).api('notes/delete', {