Skip to content

Commit

Permalink
board message delete
Browse files Browse the repository at this point in the history
  • Loading branch information
NyaomiDEV committed Aug 5, 2024
1 parent 67a0147 commit a3eaa8b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
22 changes: 21 additions & 1 deletion src/modals/BoardMessageEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
} from "@ionic/vue";
import {
saveOutline as saveIOS
saveOutline as saveIOS,
trashBinOutline as trashIOS
} from "ionicons/icons";
import saveMD from "@material-design-icons/svg/outlined/save.svg";
import trashMD from "@material-design-icons/svg/outlined/delete.svg";
import { getTable, BoardMessageComplete, newBoardMessage } from "../lib/db/entities/boardMessages";
import { Ref, ShallowReactive, WatchStopHandle, inject, provide, ref, shallowReactive, toRaw, watch } from "vue";
Expand Down Expand Up @@ -61,6 +63,16 @@
// however it's safe for us to ignore
}
async function deleteBoardMessage(){
if(!boardMessage.value) return;
await getTable().delete(boardMessage.value.uuid);
try{
await modalController.dismiss(null, "deleted");
}catch(_){}
}
function present() {
watchStopHandles.forEach(x => x());
watchStopHandles.length = 0;
Expand Down Expand Up @@ -103,6 +115,14 @@
<IonItem lines="none">
<IonTextarea mode="md" fill="outline" auto-grow :label="$t('options:messageBoard.edit.body')" labelPlacement="floating" v-model="boardMessage!.body" />
</IonItem>

<IonItem button lines="none" @click="deleteBoardMessage">
<IonIcon :ios="trashIOS" :md="trashMD" slot="start" aria-hidden="true" />
<IonLabel>
<h3>{{ $t("options:messageBoard.edit.delete.title") }}</h3>
<p>{{ $t("options:messageBoard.edit.delete.desc") }}</p>
</IonLabel>
</IonItem>
</IonList>

<IonFab slot="fixed" vertical="bottom" horizontal="end">
Expand Down
6 changes: 5 additions & 1 deletion translations/en/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@
"header": "Edit message",
"member": "Edit message author",
"title": "Title",
"body": "Message body"
"body": "Message body",
"delete": {
"title": "Delete message on board",
"desc": "You won't be able to undo this action!"
}
}
},
"tagManagement": {
Expand Down

0 comments on commit a3eaa8b

Please sign in to comment.