Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이승윤
/
OpenSource-MyCookBook
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
이승윤
2021-05-30 17:51:07 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4a5c93896c83170fc035e520365141eff3c23049
4a5c9389
1 parent
b723259c
feat: 현재 카테고리에 있는 영상 목록 보여주기 기능
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
14 deletions
routes/Videos.js
routes/categori.js
views/category/productsDetail.ejs
routes/Videos.js
View file @
4a5c938
...
...
@@ -16,7 +16,7 @@ router.get('/', function (req, res) {
}
if
(
videos
.
length
!=
0
)
{
// 빈 배열 체크
console
.
log
(
videos
);
//
console.log(videos);
var
items
=
{
category
:
category
[
i
],
videos
:
videos
,
...
...
routes/categori.js
View file @
4a5c938
...
...
@@ -54,6 +54,22 @@ router.get('/products/detail/:id', function (req, res) {
var
video
=
[];
//제품정보를 받고 그안에서 댓글을 받아온다.
CategoriModel
.
find
({
product_id
:
req
.
params
.
id
},
function
(
err
,
comments
)
{
VideoModel
.
find
(
function
(
err
,
myVideo
)
{
var
mitem
=
[];
// 카테고리별 비디오 목록을 담아두는 배열
var
videos
=
[];
// 비디오 목록을 담는 임시 배열
for
(
var
j
in
myVideo
)
{
if
(
product
.
title
==
myVideo
[
j
].
categori
)
{
videos
.
push
(
myVideo
[
j
].
title
);
}
}
if
(
videos
.
length
!=
0
)
{
// 빈 배열 체크
//console.log(videos);
var
items
=
videos
;
mitem
.
push
(
items
);
}
//console.log(item[2].category.title);
//console.log(item[2].videos);
if
(
word
!=
null
)
{
var
count
=
0
;
youtube
.
addParam
(
'order'
,
'rating'
);
// 평점 순으로 정렬
...
...
@@ -61,7 +77,7 @@ router.get('/products/detail/:id', function (req, res) {
youtube
.
addParam
(
'videoLicense'
,
'creativeCommon'
);
// 크리에이티브 커먼즈 아이템만 불러옴
youtube
.
search
(
word
,
limit
,
function
(
err
,
result
)
{
// 검색 실행
console
.
log
(
word
);
//
console.log(word);
if
(
err
)
{
console
.
log
(
err
);
}
// 에러일 경우 에러공지하고 빠져나감
...
...
@@ -92,17 +108,21 @@ router.get('/products/detail/:id', function (req, res) {
product
:
product
,
comments
:
comments
,
videos
:
video
,
items
:
mitem
,
});
});
}
else
{
//console.log(item[0]);
res
.
render
(
'category/productsDetail'
,
{
product
:
product
,
comments
:
comments
,
videos
:
video
,
items
:
mitem
,
});
}
});
});
});
});
router
.
post
(
'/products/detail/:id'
,
loginRequired
,
function
(
req
,
res
)
{
...
...
views/category/productsDetail.ejs
View file @
4a5c938
...
...
@@ -3,6 +3,24 @@
<div class="panel-heading">
<%=product.title%>
</div>
<div style="padding-bottom: 10px">
작성일 :
<%=product.getDate.year%> -
<%=product.getDate.month%> -
<%=product.getDate.day%>
</div>
<div>
<% var count=0; %>
보유중인 영상
<% for (var i in items[0]) { %>
<div>
<%=items[0][i]%>
</div>
<%count++;};%>
</div>
<div>
설명 : <%=product.description%>
</div>
<form method="get" action="">
<div class="input-group">
<input type="text" class="form-control" placeholder="검색 키워드를 입력하세요!" name="keyword" autocomplete='off'>
...
...
@@ -30,18 +48,6 @@
<button class="btn btn-primary" style="margin-top: 10px; margin-left: 15px;" >영상담기</button>
</form>
<div class="panel-body">
<div style="padding-bottom: 10px">
작성일 :
<%=product.getDate.year%> -
<%=product.getDate.month%> -
<%=product.getDate.day%>
</div>
<% if(product.thumbnail){%>
<p>
<img src="/uploads/<%=product.thumbnail%>" style="max-width: 100%"/>
</p>
<% } %>
<%=product.description%>
<!-- 댓글영역 -->
<div>
댓글작성하기
...
...
Please
register
or
login
to post a comment