mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-11-26 13:20:41 +03:00
create_thread is setting with new theme
This commit is contained in:
parent
ea42d3ce24
commit
aad5eb656f
5 changed files with 51 additions and 83 deletions
|
@ -97,8 +97,7 @@ And, you can learn about API in `util/APIDOCS.md`.
|
||||||
- [x] Error
|
- [x] Error
|
||||||
- [x] Users
|
- [x] Users
|
||||||
- [x] Threads
|
- [x] Threads
|
||||||
|
- [x] Create Thread
|
||||||
- [ ] Thread
|
- [ ] Thread
|
||||||
- [ ] User
|
- [ ] User
|
||||||
- [ ] Admin
|
- [ ] Admin
|
||||||
- [ ] Create Thread
|
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ app.get("/", async (req, res) => {
|
||||||
app.get("/create*", async (req, res) => {
|
app.get("/create*", async (req, res) => {
|
||||||
|
|
||||||
const user = req.user
|
const user = req.user
|
||||||
res.render("createThread", { user })
|
res.render("create_thread", { user })
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<%- include("extra/old_header", {title: "Create Thread!" }) %>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<%- include("extra/old_navbar", {user}) %>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<form>
|
|
||||||
<h2>Title:</h2>
|
|
||||||
<input name="title"></input>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
<h2>Content:</h2>
|
|
||||||
<textarea rows="4" cols="50" name="content"></textarea>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
<button class="big" type="submit">Create Thread!</button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
|
|
||||||
<script type="module">
|
|
||||||
|
|
||||||
import request from "../../js/request.js";
|
|
||||||
|
|
||||||
document.addEventListener("submit", async e => {
|
|
||||||
e.preventDefault();
|
|
||||||
const form = e.target;
|
|
||||||
const data = new FormData(form);
|
|
||||||
|
|
||||||
const response = await request("/api/threads/", "POST", {
|
|
||||||
title: data.get("title"), content: data.get("content")
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
if (response) {
|
|
||||||
alert("Thread opened");
|
|
||||||
window.location.href = "/threads/" + response.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<%- include("extra/old_footer") %>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
49
views/create_thread.ejs
Normal file
49
views/create_thread.ejs
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<%- include("extra/meta", {title: "User list!" }) %>
|
||||||
|
|
||||||
|
|
||||||
|
<body style="text-align: center;">
|
||||||
|
<%- include("extra/navbar") %>
|
||||||
|
|
||||||
|
|
||||||
|
<form>
|
||||||
|
<h2 style="color: #4d18e6;">Title:</h2>
|
||||||
|
<input name="title"></input>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<h2 style="color: #4d18e6;">Content:</h2>
|
||||||
|
<textarea rows="4" cols="50" name="content"></textarea>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<button class="big" type="submit">Create Thread!</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
<script type="module">
|
||||||
|
|
||||||
|
import request from "../../js/request.js";
|
||||||
|
|
||||||
|
document.addEventListener("submit", async e => {
|
||||||
|
e.preventDefault();
|
||||||
|
const form = e.target;
|
||||||
|
const data = new FormData(form);
|
||||||
|
|
||||||
|
const response = await request("/api/threads/", "POST", {
|
||||||
|
title: data.get("title"), content: data.get("content")
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if (response) {
|
||||||
|
alert("Thread opened");
|
||||||
|
window.location.href = "/threads/" + response.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
|
@ -1,29 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<%- include("extra/old_header", {title: "Edit user!" }) %>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<%- include("extra/old_navbar", {user}) %>
|
|
||||||
|
|
||||||
|
|
||||||
<h1>This page's development is not completed yet.</h1>
|
|
||||||
<hr>
|
|
||||||
<!--- <form action="/userEdit/<%= %>" method="post">
|
|
||||||
|
|
||||||
|
|
||||||
<input type="text" name="username" placeholder="Username" id="username" required>
|
|
||||||
|
|
||||||
<input type="password" name="password" placeholder="Password" id="password" required>
|
|
||||||
|
|
||||||
<input type="text" name="avatar" placeholder="Avatar URL" id="avatar">
|
|
||||||
|
|
||||||
<input type="submit" value="Register">
|
|
||||||
</form>
|
|
||||||
-->
|
|
||||||
<%- include("extra/old_footer") %>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
Loading…
Reference in a new issue