Skip to content

Commit

Permalink
Merge pull request #31 from iqeq1945/feat-#30
Browse files Browse the repository at this point in the history
Feat #30
  • Loading branch information
iqeq1945 authored Jun 19, 2023
2 parents bdb3363 + 2af261b commit eaab63c
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 13 deletions.
3 changes: 3 additions & 0 deletions src/controllers/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ Router.post("/upload", ImageServices.upload.single("upload"), (req, res) => {
res.send(req.file);
});

Router.get("/session", function (req, res) {
res.send(req.session);
});
export default Router;
1 change: 1 addition & 0 deletions src/views/home/welcome.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<h4 class="border-bottom"style="width: 5%">랭킹</h4>
<div class="d-flex flex-wrap justify-content-around my-2">
<% novel.forEach(function(post,idx){ %>
<% if(idx >3) return; %>
<div class="card my-1" style="width: 20%; cursor: pointer;" onclick="location.href='/novels/<%= post.id %>'">
<img class="card-img-top" src="<%= post.image %>" alt="Card image cap">
<div class="card-body border-top">
Expand Down
19 changes: 17 additions & 2 deletions src/views/novels/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@
<div class="d-flex flex-column my-3">
<div class="d-flex mb-3">
<div class="me-2">
<span class="px-1 py-1 round">연재 목록</span>
<span id="storage" class="px-1 py-1 round" style="cursor: pointer"
>이어보기</span
>
</div>
<div><span class="px-1 py-1 round">공지</span></div>
</div>
<div class="d-flex justify-content-between">
<span>총 <%= novel.post.length %>화</span>
Expand Down Expand Up @@ -215,5 +216,19 @@
$(".look").toggleClass("look_chk");
$("#look_post").toggleClass("flex-column-reverse");
});
$("#storage").click(function () {
if (
localStorage.getItem("<%= currentUser.id %>" + "_" + "<%= novel.id %>")
) {
location.href =
"/posts/view/" +
localStorage.getItem(
"<%= currentUser.id %>" + "_" + "<%= novel.id %>"
);
} else {
alert("최근 본 화가 없습니다.");
}
});
</script>
</html>
21 changes: 13 additions & 8 deletions src/views/posts/viewer.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,14 @@
}
});
/*
$(".line").click(function () {
$("#cite").text($(this).text());
$(".chat_box").fadeIn();
});
$(document).mouseup(function () {
$(".chat_box").fadeOut();
});
*/
$(".line").click(function () {
$("#cite").text($(this).text());
$(".chat_box").fadeIn();
});
$(document).mouseup(function () {
$(".chat_box").fadeOut();
});
*/
$(document).mouseup(function () {
$(".move_box").fadeOut();
});
Expand Down Expand Up @@ -309,5 +309,10 @@
$("#ok_move").click(function () {
$("#move_form").submit();
});
window.localStorage.setItem(
"<%= currentUser.id %>" + "_" + "<%= post.novel.id %>",
"<%= post.id %>"
);
</script>
</html>
6 changes: 6 additions & 0 deletions src/views/user/login.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@
id="password"
name="password"
placeholder="비밀번호"
pattern="^[a-zA-Z0-9가-힣]{8,}$"
title="특수문자를 제외한 문자 8이상으로 작성하시오."
required
/>
<input
type="password"
id="passwordConfirmation"
name="passwordConfirmation"
placeholder="비밀번호 확인"
pattern="^[a-zA-Z0-9가-힣]{8,}$"
title="특수문자를 제외한 문자 8이상으로 작성하시오."
required
/>
<button>회원 가입</button>
Expand All @@ -47,6 +51,8 @@
id="password"
name="password"
placeholder="비밀번호"
pattern="^[a-zA-Z0-9가-힣]{8,}$"
title="특수문자를 제외한 문자 8이상으로 작성하시오."
required
/>
<button type="submit">로그인</button>
Expand Down
32 changes: 29 additions & 3 deletions src/views/user/signup.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,53 @@
<div class="form-container sign-up-container">
<form action="/users" method="post">
<h1>계정 생성</h1>
<input type="email" id="email" name="email" placeholder="이메일" />
<input type="text" id="name" name="name" placeholder="닉네임" />
<input
type="email"
id="email"
name="email"
placeholder="이메일"
required
/>
<input type="text" id="name" name="name" placeholder="닉네임" required />
<input
type="password"
id="password"
name="password"
pattern="^[a-zA-Z0-9가-힣]{8,}$"
title="특수문자를 제외한 문자 8이상으로 작성하시오."
placeholder="비밀번호"
/>

<input
type="password"
id="passwordConfirmation"
name="passwordConfirmation"
pattern="^[a-zA-Z0-9가-힣]{8,}$"
title="특수문자를 제외한 문자 8이상으로 작성하시오."
placeholder="비밀번호 확인"
required
/>
<button>회원 가입</button>
</form>
</div>
<div class="form-container sign-in-container">
<form action="/login" method="post">
<h1>로그인</h1>
<input type="email" id="email" name="email" placeholder="이메일" />
<input
type="email"
id="email"
name="email"
placeholder="이메일"
required
/>
<input
type="password"
id="password"
name="password"
pattern="^[a-zA-Z0-9가-힣]{8,}$"
title="특수문자를 제외한 문자 8이상으로 작성하시오."
placeholder="비밀번호"
required
/>
<button type="submit">로그인</button>
</form>
Expand Down Expand Up @@ -65,4 +86,9 @@
});
let errors = "<%= errors %>";
alert(errors);
function passwordCheck(asValue) {
var regExp = /^[a-zA-Z0-9가-힣]{8,}$/;
return regExp.test(asValue);
}
</script>

0 comments on commit eaab63c

Please sign in to comment.