Skip to content

Commit

Permalink
Added delete threads button
Browse files Browse the repository at this point in the history
  • Loading branch information
ryankeegan committed Apr 9, 2018
1 parent 1ad4542 commit 091eed5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion routes/delete/thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const Thread = require(_base + 'models/thread');

module.exports = {
'/delete/thread': {
methods: ['delete'],
methods: ['post'],
fn: function(req, res, next) {
let _id = req.body._id;
Thread.findByIdAndRemove(_id, function(err, thread) {
Expand Down
8 changes: 4 additions & 4 deletions src/components/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
<table class="postForm">
<tbody>
<tr>
<td style="text-align: center; width: 65px;">Email</td>
<td style="width: 65px; text-align: center">Email</td>
<td>
<input name="username" style="width: 145px; text-align: center" type="text" v-model="username">
<input name="username" style="width: 145px;" type="text" v-model="username">
</td>
</tr>
<tr>
<td style="text-align: center; width: 65px;">Password</td>
<td style="width: 65px; text-align: center">Password</td>
<td>
<input name="password" style="width: 145px; text-align: center" type="password"
<input name="password" style="width: 145px;" type="password"
v-model="password">
</td>
</tr>
Expand Down
10 changes: 5 additions & 5 deletions src/components/Thread.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
:href="'#' + thread._id" title="Link to this post">No.</a> <a href="#"
v-on:click="appendUserIdToReplyContent(thread._id + '\n')"
title="Reply to this post">{{ thread._id }}</a> </span>
<span v-if="isMod"><button v-on:click="ban(thread)">Ban</button></span></div>
<span v-if="isMod"><button v-on:click="ban(thread)">Ban</button> <button v-on:click="deleteThread(thread, $route.params.board)">Delete</button></span></div>
<blockquote class="postMessage" v-html="thread.content"></blockquote>
</div>
</div>
Expand Down Expand Up @@ -70,7 +70,7 @@
<div id="bottom">
<hr>
<div id="bottomNav" class="boardNav"><span class="boardList"> [ <span v-html="boardList"></span> ] </span>
<span class="actionList"> [ <a href="catalog.php#top">Top</a> / <a href="/bans" target="_top">Bans</a> / <a href="/"
<span class="actionList"> [ <a href="#top">Top</a> / <a href="/bans" target="_top">Bans</a> / <a href="/"
target="_top">Home</a> ] </span>
</div>
<br>
Expand Down Expand Up @@ -313,14 +313,14 @@
}
});
},
deleteThread(id) {
deleteThread(thread, boardId) {
let vm = this;
_api.deleteThread(id, function (err, res) {
_api.deleteThread(thread._id, function (err, res) {
if (err) {
console.log(err);
}
else if (res.result) {
vm.$router.push('/' + board.letter + '/catalog');
vm.$router.push('/' + boardId + '/catalog');
}
});
},
Expand Down

0 comments on commit 091eed5

Please sign in to comment.