-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodify.ejs
40 lines (35 loc) · 1.17 KB
/
modify.ejs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Edit Blog</title>
<link rel="stylesheet" href="/styles/main.css">
</head>
<body>
<div class="container">
<h1>
<%= heading %>
</h1>
<% if (locals.post) { %>
<form id="editForm" method="post" action="/api/posts/<%=post.pid%>">
<input type="text" name="title" value="<%=post.title %>">
<textarea name="content" rows="10"><%=post.content %></textarea>
<input type="text" name="author" value="<%=post.author %>">
<button class="full-width" type="submit">
<%= submit %>
</button>
</form>
<% } else {%>
<form id="newPostForm" method="post" action="/api/posts">
<input type="text" name="title" placeholder="Title" required>
<textarea name="content" placeholder="Content" required rows="10"></textarea>
<input type="text" name="author" placeholder="Author" required>
<button class="full-width" type="submit">
<%= submit %>
</button>
</form>
<% } %>
</div>
</body>
</html>