Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ryankeegan committed Apr 9, 2018
2 parents b258285 + 535ef4e commit 8ed084e
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Router.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import NewThread from './components/NewThread.vue'
import BanList from './components/BanList.vue'
import Ban from './components/Ban.vue'
import EditBoard from './components/EditBoard.vue'
import CreateBoard from './components/CreateBoard.vue'
import CreateMod from './components/CreateMod.vue'

Vue.use(Router);
Expand Down Expand Up @@ -61,6 +62,11 @@ export default new Router({
name: 'EditBoard',
component: EditBoard
},
{
path: '/create/board',
name: 'CreateBoard',
component: CreateBoard
},
{
path: '/create/mod',
name: 'CreateMod',
Expand Down
5 changes: 5 additions & 0 deletions src/assets/js/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ axios.defaults.withCredentials = true;
numRepliesUrl: 'read/numReplies',
updateBoardUrl: 'update/board',
deleteThreadUrl: 'delete/thread',
createBoardUrl: 'create/board',
createModUrl: 'create/mod'
};

Expand Down Expand Up @@ -124,6 +125,10 @@ axios.defaults.withCredentials = true;
post(url('deleteThreadUrl'), {_id: id}, fn);
};

_api.createBoard = function (name, letter, fn) {
post(url('createBoardUrl'), { name: name, letter: letter }, fn);
};

_api.createMod = function (username, password, fn) {
post(url('createModUrl'), { username: username, password: password }, fn);
};
Expand Down
110 changes: 110 additions & 0 deletions src/components/CreateBoard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<template>
<div class="createBoard">
<div class="boardBanner">
<div class="boardTitle">Image Board Create Board</div>
</div>
<hr style="width: 90%">
<br>
<form action="#" method="post">
<table class="postForm">
<tbody>
<tr>
<td style="text-align: center; width: 65px;">Letter</td>
<td>
<input name="letter" style="width: 145px; text-align: center" type="text"
v-model="letter">
</td>
</tr>
<tr>
<td style="text-align: center; width: 65px;">Name</td>
<td>
<input name="name" style="width: 145px; text-align: center" type="text" v-model="name">
</td>
</tr>
<tr>
<td colspan="2"
style="padding: 5px 0; border: none; background: none; text-align: center; font-weight: normal; padding-bottom: 20px">
<input value="Submit" style="margin: 0px;" type="button" v-on:click="createBoard">
</td>
</tr>
</tbody>
<p v-if="error">{{ error }}</p>
</table>
</form>
</div>
</template>

<style scoped>
.boardBanner {
text-align: center;
clear: both;
}
.boardBanner .boardTitle {
font-family: Tahoma, sans-serif;
font-size: 28px;
font-weight: 700;
letter-spacing: -2px;
margin-top: 0;
color: #AF0A0F;
}
body {
background: #eef2ff url(http://s.4cdn.org/image/fade-blue.png) top center repeat-x;
}
hr {
border: 0;
border-top: 1px solid #b7c5d9;
height: 0;
}
table {
border-spacing: 1px;
margin-left: auto;
margin-right: auto;
}
td {
margin: 0;
padding: 0;
font-size: 10pt;
}
td:first-child {
background-color: #D6DAF0;
border: 1px solid #34345C;
color: #34345C;
font-weight: 700;
padding: 0 5px;
font-size: 10pt;
}
</style>

<script>
export default {
data() {
return {
name: '',
letter: '',
error: null
}
},
methods: {
createBoard() {
let vm = this;
_api.createBoard(this.name, this.letter, function (err, res) {
if (err) {
vm.error = err;
}
else if (res.result) {
vm.$router.push('/' + this.letter + '/catalog');
}
else if (res.error) {
vm.error = res.error;
}
});
}
}
}
</script>

0 comments on commit 8ed084e

Please sign in to comment.