Merge branch 'feat/categori' into 'develop'
Feat/categori See merge request !4
Showing
16 changed files
with
194 additions
and
211 deletions
Frame.html
deleted
100644 → 0
1 | -<!DOCTYPE html> | ||
2 | -<html> | ||
3 | - <body> | ||
4 | - <div id="player0"></div> | ||
5 | - <div id="player1"></div> | ||
6 | - <div id="player2"></div> | ||
7 | - | ||
8 | - <script> | ||
9 | - var tag = document.createElement('script'); | ||
10 | - | ||
11 | - tag.src = "https://www.youtube.com/iframe_api"; | ||
12 | - var firstScriptTag = document.getElementsByTagName('script')[0]; | ||
13 | - firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); | ||
14 | - | ||
15 | - var player; | ||
16 | - var players = []; | ||
17 | - players.push('player0'); | ||
18 | - players.push('player1'); | ||
19 | - players.push('player2'); | ||
20 | - var videoIds = []; | ||
21 | - videoIds.push('037o6vxm0es'); | ||
22 | - videoIds.push('kR77WlHRZrs'); | ||
23 | - videoIds.push('R6IT_f0XPT8'); | ||
24 | - | ||
25 | - function onYouTubeIframeAPIReady() | ||
26 | - { | ||
27 | - for(var i = 0; i < videoIds.length; i++) | ||
28 | - { | ||
29 | - player = new YT.Player(players[i], { | ||
30 | - height: '360', | ||
31 | - width: '640', | ||
32 | - videoId: videoIds[i], | ||
33 | - events: { | ||
34 | - // 'onReady': onPlayerReady, | ||
35 | - // 'onStateChange': onPlayerStateChange | ||
36 | - } | ||
37 | - }); | ||
38 | - } | ||
39 | - } | ||
40 | - | ||
41 | - // function onPlayerReady(event) { | ||
42 | - // } | ||
43 | - // function onPlayerStateChange(event) { | ||
44 | - // } | ||
45 | - // function stopVideo() { | ||
46 | - // } | ||
47 | - </script> | ||
48 | - </body> | ||
49 | -</html> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -19,12 +19,12 @@ db.on('error', console.error); | ... | @@ -19,12 +19,12 @@ db.on('error', console.error); |
19 | db.once('open', function () { | 19 | db.once('open', function () { |
20 | console.log('mongo db Connection'); | 20 | console.log('mongo db Connection'); |
21 | }); | 21 | }); |
22 | -var connect = mongoose.connect('mongodb://127.0.0.1:27017/cookBook', { | 22 | +var connect = mongoose.connect('mongodb://127.0.0.1:27017/test', { |
23 | useMongoClient: true, | 23 | useMongoClient: true, |
24 | }); | 24 | }); |
25 | 25 | ||
26 | -//admin module get | 26 | +//categori module get |
27 | -var admin = require('./routes/admin'); | 27 | +var categori = require('./routes/categori'); |
28 | var accounts = require('./routes/accounts'); | 28 | var accounts = require('./routes/accounts'); |
29 | var auth = require('./routes/auth'); | 29 | var auth = require('./routes/auth'); |
30 | var connectMongo = require('connect-mongo'); | 30 | var connectMongo = require('connect-mongo'); |
... | @@ -69,18 +69,10 @@ app.use(function (req, res, next) { | ... | @@ -69,18 +69,10 @@ app.use(function (req, res, next) { |
69 | 69 | ||
70 | //routes add | 70 | //routes add |
71 | app.use('/', Search); | 71 | app.use('/', Search); |
72 | -app.use('/admin', admin); | 72 | +app.use('/categori', categori); |
73 | app.use('/accounts', accounts); | 73 | app.use('/accounts', accounts); |
74 | app.use('/auth', auth); | 74 | app.use('/auth', auth); |
75 | 75 | ||
76 | var server = app.listen(port, function () { | 76 | var server = app.listen(port, function () { |
77 | console.log('Express listening on port', port); | 77 | console.log('Express listening on port', port); |
78 | }); | 78 | }); |
79 | - | ||
80 | -var listen = require('socket.io'); | ||
81 | -var io = listen(server); | ||
82 | -//socket io passport 접근하기 위한 미들웨어 적용 | ||
83 | -io.use(function (socket, next) { | ||
84 | - sessionMiddleWare(socket.request, socket.request.res, next); | ||
85 | -}); | ||
86 | -require('./libs/socketConnection')(io); | ... | ... |
libs/socketConnection.js
deleted
100644 → 0
1 | -require('./removeByValue')(); | ||
2 | -var userList = []; //사용자 리스트를 저장할곳 | ||
3 | -module.exports = function(io) { | ||
4 | - io.on('connection', function(socket){ | ||
5 | - | ||
6 | - var session = socket.request.session.passport; | ||
7 | - var user = (typeof session !== 'undefined') ? ( session.user ) : ""; | ||
8 | - | ||
9 | - // userList 필드에 사용자 명이 존재 하지 않으면 삽입 | ||
10 | - if(userList.indexOf(user.displayname) === -1){ | ||
11 | - userList.push(user.displayname); | ||
12 | - } | ||
13 | - io.emit('join', userList); | ||
14 | - | ||
15 | - //사용자 명과 메시지를 같이 반환한다. | ||
16 | - socket.on('client message', function(data){ | ||
17 | - io.emit('server message', { message : data.message , displayname : user.displayname }); | ||
18 | - }); | ||
19 | - | ||
20 | - socket.on('disconnect', function(){ | ||
21 | - userList.removeByValue(user.displayname); | ||
22 | - io.emit('leave', userList); | ||
23 | - }); | ||
24 | - | ||
25 | - }); | ||
26 | -}; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
models/CategoriModel.js
0 → 100644
1 | +var mongoose = require('mongoose'); | ||
2 | +var Schema = mongoose.Schema; | ||
3 | + | ||
4 | +var CategoriSchema = new Schema({ | ||
5 | + title: { | ||
6 | + type: String, | ||
7 | + default: 'default', | ||
8 | + required: [true, '카테고리명이 비어있습니다!'], | ||
9 | + }, | ||
10 | + videoNum: String, | ||
11 | + description: String, //설명 | ||
12 | + created_at: { | ||
13 | + type: Date, | ||
14 | + default: Date.now(), | ||
15 | + }, | ||
16 | + username: String, | ||
17 | +}); | ||
18 | + | ||
19 | +CategoriSchema.virtual('getDate').get(function () { | ||
20 | + var date = new Date(this.created_at); | ||
21 | + return { | ||
22 | + year: date.getFullYear(), | ||
23 | + month: date.getMonth() + 1, | ||
24 | + day: date.getDate(), | ||
25 | + }; | ||
26 | +}); | ||
27 | + | ||
28 | +module.exports = mongoose.model('categories', CategoriSchema); |
... | @@ -9,7 +9,7 @@ var ProductsSchema = new Schema({ | ... | @@ -9,7 +9,7 @@ var ProductsSchema = new Schema({ |
9 | required: [true, '제목은 입력해주세요'], | 9 | required: [true, '제목은 입력해주세요'], |
10 | }, | 10 | }, |
11 | thumbnail: String, //이미지 파일명 | 11 | thumbnail: String, //이미지 파일명 |
12 | - price: Number, //가격 | 12 | + price: Number, //가격 |
13 | description: String, //설명 | 13 | description: String, //설명 |
14 | created_at: { | 14 | created_at: { |
15 | //작성일 | 15 | //작성일 |
... | @@ -31,5 +31,5 @@ ProductsSchema.virtual('getDate').get(function () { | ... | @@ -31,5 +31,5 @@ ProductsSchema.virtual('getDate').get(function () { |
31 | // 1씩 증가하는 primary Key를 만든다 | 31 | // 1씩 증가하는 primary Key를 만든다 |
32 | // model : 생성할 document 이름 | 32 | // model : 생성할 document 이름 |
33 | // field : primary key , startAt : 1부터 시작 | 33 | // field : primary key , startAt : 1부터 시작 |
34 | - | 34 | + |
35 | -module.exports = mongoose.model('products', ProductsSchema); | 35 | +module.exports = mongoose.model('products', ProductsSchema); |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
models/VideoModel.js
0 → 100644
1 | +var mongoose = require('mongoose'); | ||
2 | +var Schema = mongoose.Schema; | ||
3 | +var VideoSchema = new Schema({ | ||
4 | + username: { | ||
5 | + type: String, | ||
6 | + required: [true, '아이디는 필수입니다.'], | ||
7 | + }, | ||
8 | + password: { | ||
9 | + type: String, | ||
10 | + required: [true, '패스워드는 필수입니다.'], | ||
11 | + }, | ||
12 | + displayname: String, | ||
13 | + created_at: { | ||
14 | + type: Date, | ||
15 | + default: Date.now(), | ||
16 | + }, | ||
17 | +}); | ||
18 | + | ||
19 | +module.exports = mongoose.model('videos', VideoSchema); |
models/VideoModels.js
deleted
100644 → 0
... | @@ -4,13 +4,12 @@ var youtube = new Youtube(); | ... | @@ -4,13 +4,12 @@ var youtube = new Youtube(); |
4 | var express = require('express'); | 4 | var express = require('express'); |
5 | var router = express.Router(); | 5 | var router = express.Router(); |
6 | 6 | ||
7 | -var word = '백종원 레시피'; // 검색어 지정 | 7 | +var word = '백종원'; // 검색어 지정 |
8 | var limit = 10; // 출력 갯수 | 8 | var limit = 10; // 출력 갯수 |
9 | var video = []; | 9 | var video = []; |
10 | var test = 'test'; | 10 | var test = 'test'; |
11 | var count = 0; | 11 | var count = 0; |
12 | youtube.setKey('AIzaSyAsKr_oWGZIBbL5tLdIl98Lf9Pzqj8jX4o'); // API 키 입력 | 12 | youtube.setKey('AIzaSyAsKr_oWGZIBbL5tLdIl98Lf9Pzqj8jX4o'); // API 키 입력 |
13 | - | ||
14 | youtube.addParam('order', 'rating'); // 평점 순으로 정렬 | 13 | youtube.addParam('order', 'rating'); // 평점 순으로 정렬 |
15 | youtube.addParam('type', 'video'); // 타입 지정 | 14 | youtube.addParam('type', 'video'); // 타입 지정 |
16 | youtube.addParam('videoLicense', 'creativeCommon'); // 크리에이티브 커먼즈 아이템만 불러옴 | 15 | youtube.addParam('videoLicense', 'creativeCommon'); // 크리에이티브 커먼즈 아이템만 불러옴 | ... | ... |
routes/Videos.js
0 → 100644
1 | +var Youtube = require('youtube-node'); | ||
2 | +var youtube = new Youtube(); | ||
3 | + | ||
4 | +var express = require('express'); | ||
5 | +var router = express.Router(); | ||
6 | + | ||
7 | +var word = '백종원'; // 검색어 지정 | ||
8 | +var limit = 10; // 출력 갯수 | ||
9 | +var video = []; | ||
10 | +var test = 'test'; | ||
11 | +var count = 0; | ||
12 | +youtube.setKey('AIzaSyAsKr_oWGZIBbL5tLdIl98Lf9Pzqj8jX4o'); // API 키 입력 | ||
13 | + | ||
14 | +youtube.addParam('order', 'rating'); // 평점 순으로 정렬 | ||
15 | +youtube.addParam('type', 'video'); // 타입 지정 | ||
16 | +youtube.addParam('videoLicense', 'creativeCommon'); // 크리에이티브 커먼즈 아이템만 불러옴 | ||
17 | + | ||
18 | +youtube.search(word, limit, function (err, result) { | ||
19 | + // 검색 실행 | ||
20 | + if (err) { | ||
21 | + console.log(err); | ||
22 | + } // 에러일 경우 에러공지하고 빠져나감 | ||
23 | + | ||
24 | + //console.log(JSON.stringify(result, null, 2)); // 받아온 전체 리스트 출력 | ||
25 | + | ||
26 | + var items = result['items']; // 결과 중 items 항목만 가져옴 | ||
27 | + for (var i in items) { | ||
28 | + var it = items[i]; | ||
29 | + for (var j in it) { | ||
30 | + if (it[j]['title'] != null) { | ||
31 | + var title = it[j]['title']; | ||
32 | + } | ||
33 | + if (it[j]['videoId'] != null) { | ||
34 | + var video_id = it[j]['videoId']; | ||
35 | + } | ||
36 | + var urls = 'https://www.youtube.com/watch?v=' + video_id; | ||
37 | + } | ||
38 | + var item = { | ||
39 | + id: count, | ||
40 | + title: title, | ||
41 | + video_id: video_id, | ||
42 | + urls: urls, | ||
43 | + }; | ||
44 | + count++; | ||
45 | + video.push(item); | ||
46 | + } | ||
47 | +}); | ||
48 | + | ||
49 | +router.get('/', function (req, res) { | ||
50 | + res.render( | ||
51 | + 'home', | ||
52 | + { videos: video } // DB에서 받은 videos를 videos변수명으로 내보냄 | ||
53 | + ); | ||
54 | +}); | ||
55 | + | ||
56 | +module.exports = router; |
1 | var express = require('express'); | 1 | var express = require('express'); |
2 | var router = express.Router(); | 2 | var router = express.Router(); |
3 | -var ProductsModel = require('../models/ProductsModel'); | 3 | +var CategoriModel = require('../models/CategoriModel'); |
4 | -var CommentsModel = require('../models/VideoModels'); | 4 | +//var csrf = require('csurf'); |
5 | -var csrf = require('csurf'); | 5 | +//var csrfProtection = csrf({ cookie: true }); |
6 | -var csrfProtection = csrf({ cookie: true }); | ||
7 | var loginRequired = require('../libs/loginRequired'); | 6 | var loginRequired = require('../libs/loginRequired'); |
8 | 7 | ||
9 | var path = require('path'); | 8 | var path = require('path'); |
... | @@ -29,62 +28,49 @@ var storage = multer.diskStorage({ | ... | @@ -29,62 +28,49 @@ var storage = multer.diskStorage({ |
29 | var upload = multer({ storage: storage }); | 28 | var upload = multer({ storage: storage }); |
30 | 29 | ||
31 | router.get('/', function (req, res) { | 30 | router.get('/', function (req, res) { |
32 | - res.send('admin main page'); | 31 | + res.send('categori main page'); |
33 | }); | 32 | }); |
34 | 33 | ||
35 | router.get('/products', function (req, res) { | 34 | router.get('/products', function (req, res) { |
36 | - ProductsModel.find(function (err, products) { | 35 | + CategoriModel.find(function (err, products) { |
37 | res.render( | 36 | res.render( |
38 | - 'admin/products', | 37 | + 'category/products', |
39 | - { products: products } | 38 | + { categories: products } |
40 | //ProductModel의 products를 받아서 | 39 | //ProductModel의 products를 받아서 |
41 | - //admin/products로 response를 보낸다. | 40 | + //categori/products로 response를 보낸다. |
42 | ); | 41 | ); |
43 | }); | 42 | }); |
44 | }); | 43 | }); |
45 | 44 | ||
46 | -router.get( | 45 | +router.get('/categories/write', loginRequired, function (req, res) { |
47 | - '/products/write', | 46 | + //edit에서도 같은 form을 사용하므로 빈 변수( product )를 넣어서 에러를 피해준다 |
48 | - loginRequired, | 47 | + res.render('category/form', { categories: '' }); |
49 | - csrfProtection, | 48 | +}); |
50 | - function (req, res) { | ||
51 | - //edit에서도 같은 form을 사용하므로 빈 변수( product )를 넣어서 에러를 피해준다 | ||
52 | - res.render('admin/form', { product: '', csrfToken: req.csrfToken() }); | ||
53 | - } | ||
54 | -); | ||
55 | 49 | ||
56 | -router.post( | 50 | +router.post('/categories/write', loginRequired, function (req, res) { |
57 | - '/products/write', | 51 | + var category = new CategoriModel({ |
58 | - upload.single('thumbnail'), | 52 | + title: req.body.title, |
59 | - loginRequired, | 53 | + description: req.body.description, |
60 | - csrfProtection, | 54 | + username: req.user.username, |
61 | - function (req, res) { | 55 | + }); |
62 | - var product = new ProductsModel({ | 56 | + //이 아래는 수정되지 않았음 |
63 | - name: req.body.name, | 57 | + var validationError = category.validateSync(); |
64 | - thumbnail: req.file ? req.file.filename : '', | 58 | + if (validationError) { |
65 | - price: req.body.price, | 59 | + res.send(validationError); |
66 | - description: req.body.description, | 60 | + } else { |
67 | - username: req.user.username, | 61 | + category.save(function (err) { |
62 | + res.redirect('/categori/products'); | ||
68 | }); | 63 | }); |
69 | - //이 아래는 수정되지 않았음 | ||
70 | - var validationError = product.validateSync(); | ||
71 | - if (validationError) { | ||
72 | - res.send(validationError); | ||
73 | - } else { | ||
74 | - product.save(function (err) { | ||
75 | - res.redirect('/admin/products'); | ||
76 | - }); | ||
77 | - } | ||
78 | - //이 위는 수정되지 않았음 | ||
79 | } | 64 | } |
80 | -); | 65 | + //이 위는 수정되지 않았음 |
66 | +}); | ||
81 | 67 | ||
82 | router.get('/products/detail/:id', function (req, res) { | 68 | router.get('/products/detail/:id', function (req, res) { |
83 | //url 에서 변수 값을 받아올떈 req.params.id 로 받아온다 | 69 | //url 에서 변수 값을 받아올떈 req.params.id 로 받아온다 |
84 | - ProductsModel.findOne({ id: req.params.id }, function (err, product) { | 70 | + CategoriModel.findOne({ _id: req.params.id }, function (err, product) { |
85 | //제품정보를 받고 그안에서 댓글을 받아온다. | 71 | //제품정보를 받고 그안에서 댓글을 받아온다. |
86 | - CommentsModel.find({ product_id: req.params.id }, function (err, comments) { | 72 | + CategoriModel.find({ product_id: req.params.id }, function (err, comments) { |
87 | - res.render('admin/productsDetail', { | 73 | + res.render('category/productsDetail', { |
88 | product: product, | 74 | product: product, |
89 | comments: comments, | 75 | comments: comments, |
90 | }); | 76 | }); |
... | @@ -92,29 +78,23 @@ router.get('/products/detail/:id', function (req, res) { | ... | @@ -92,29 +78,23 @@ router.get('/products/detail/:id', function (req, res) { |
92 | }); | 78 | }); |
93 | }); | 79 | }); |
94 | 80 | ||
95 | -router.get( | 81 | +router.get('/products/edit/:id', loginRequired, function (req, res) { |
96 | - '/products/edit/:id', | 82 | + //기존에 폼에 value안에 값을 셋팅하기 위해 만든다. |
97 | - loginRequired, | 83 | + CategoriModel.findOne({ _id: req.params.id }, function (err, product) { |
98 | - csrfProtection, | 84 | + res.render('category/form', { |
99 | - function (req, res) { | 85 | + categories: product, |
100 | - //기존에 폼에 value안에 값을 셋팅하기 위해 만든다. | ||
101 | - ProductsModel.findOne({ id: req.params.id }, function (err, product) { | ||
102 | - res.render('admin/form', { | ||
103 | - product: product, | ||
104 | - csrfToken: req.csrfToken(), | ||
105 | - }); | ||
106 | }); | 86 | }); |
107 | - } | 87 | + }); |
108 | -); | 88 | +}); |
109 | 89 | ||
110 | router.post( | 90 | router.post( |
111 | '/products/edit/:id', | 91 | '/products/edit/:id', |
112 | loginRequired, | 92 | loginRequired, |
113 | upload.single('thumbnail'), | 93 | upload.single('thumbnail'), |
114 | - csrfProtection, | 94 | + // csrfProtection, |
115 | function (req, res) { | 95 | function (req, res) { |
116 | //그전에 지정되 있는 파일명을 받아온다 | 96 | //그전에 지정되 있는 파일명을 받아온다 |
117 | - ProductsModel.findOne({ id: req.params.id }, function (err, product) { | 97 | + CategoriModel.findOne({ _id: req.params.id }, function (err, product) { |
118 | //아래의 코드만 추가되면 된다. | 98 | //아래의 코드만 추가되면 된다. |
119 | if (req.file && product.thumbnail) { | 99 | if (req.file && product.thumbnail) { |
120 | //요청중에 파일이 존재 할시 이전이미지 지운다. | 100 | //요청중에 파일이 존재 할시 이전이미지 지운다. |
... | @@ -128,11 +108,11 @@ router.post( | ... | @@ -128,11 +108,11 @@ router.post( |
128 | price: req.body.price, | 108 | price: req.body.price, |
129 | description: req.body.description, | 109 | description: req.body.description, |
130 | }; | 110 | }; |
131 | - ProductsModel.update( | 111 | + CategoriModel.update( |
132 | { id: req.params.id }, | 112 | { id: req.params.id }, |
133 | { $set: query }, | 113 | { $set: query }, |
134 | function (err) { | 114 | function (err) { |
135 | - res.redirect('/admin/products/detail/' + req.params.id); | 115 | + res.redirect('/category/products/detail/' + req.params.id); |
136 | } | 116 | } |
137 | ); | 117 | ); |
138 | }); | 118 | }); |
... | @@ -140,13 +120,13 @@ router.post( | ... | @@ -140,13 +120,13 @@ router.post( |
140 | ); | 120 | ); |
141 | 121 | ||
142 | router.get('/products/delete/:id', function (req, res) { | 122 | router.get('/products/delete/:id', function (req, res) { |
143 | - ProductsModel.remove({ id: req.params.id }, function (err) { | 123 | + CategoriModel.deleteMany({ _id: req.params.id }, function (err) { |
144 | - res.redirect('/admin/products'); | 124 | + res.redirect('/categori/products'); |
145 | }); | 125 | }); |
146 | }); | 126 | }); |
147 | 127 | ||
148 | router.post('/products/ajax_comment/insert', function (req, res) { | 128 | router.post('/products/ajax_comment/insert', function (req, res) { |
149 | - var comment = new CommentsModel({ | 129 | + var comment = new CategoriModel({ |
150 | content: req.body.content, | 130 | content: req.body.content, |
151 | product_id: parseInt(req.body.product_id), | 131 | product_id: parseInt(req.body.product_id), |
152 | }); | 132 | }); |
... | @@ -160,7 +140,7 @@ router.post('/products/ajax_comment/insert', function (req, res) { | ... | @@ -160,7 +140,7 @@ router.post('/products/ajax_comment/insert', function (req, res) { |
160 | }); | 140 | }); |
161 | 141 | ||
162 | router.post('/products/ajax_comment/delete', function (req, res) { | 142 | router.post('/products/ajax_comment/delete', function (req, res) { |
163 | - CommentsModel.remove({ id: req.body.comment_id }, function (err) { | 143 | + CategoriModel.remove({ _id: req.body.comment_id }, function (err) { |
164 | res.json({ message: 'success' }); | 144 | res.json({ message: 'success' }); |
165 | }); | 145 | }); |
166 | }); | 146 | }); | ... | ... |
views/admin/form.ejs
deleted
100644 → 0
1 | -<% include ../includes/header.ejs %> | ||
2 | - <form action="" method="post" enctype="multipart/form-data"> | ||
3 | - <input type="hidden" name="_csrf" value="<%=csrfToken%>" /> | ||
4 | - <table class="table table-bordered"> | ||
5 | - <tr> | ||
6 | - <th>제품명</th> | ||
7 | - <td><input type="text" name="name" class="form-control" value="<%=product.name%>"/></td> | ||
8 | - </tr> | ||
9 | - <tr> | ||
10 | - <th>섬네일</th> | ||
11 | - <td> | ||
12 | - <input type="file" name="thumbnail" /> | ||
13 | - <% if(product.thumbnail){ %> | ||
14 | - <a href="/uploads/<%=product.thumbnail%>" target="_blank">업로드 이미지 보기</a> | ||
15 | - <% } %> | ||
16 | - </td> | ||
17 | - </tr> | ||
18 | - <tr> | ||
19 | - <th>가격</th> | ||
20 | - <td><input type="text" name="price" class="form-control" value="<%=product.price%>"/></td> | ||
21 | - </tr> | ||
22 | - <tr> | ||
23 | - <th>설명</th> | ||
24 | - <td><input type="text" name="description" class="form-control" value="<%=product.description%>"/></td> | ||
25 | - </tr> | ||
26 | - </table> | ||
27 | - <button class="btn btn-primary">작성하기</button> | ||
28 | - </form> | ||
29 | -<% include ../includes/footer.ejs %> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
views/category/form.ejs
0 → 100644
1 | +<% include ../includes/header.ejs %> | ||
2 | + <form action="" method="post" > | ||
3 | + <table class="table table-bordered"> | ||
4 | + <tr> | ||
5 | + <th>카테고리명</th> | ||
6 | + <td><input type="text" name="title" class="form-control" value="<%=categories.title%>"/></td> | ||
7 | + </tr> | ||
8 | + <tr> | ||
9 | + <th>설명</th> | ||
10 | + <td><input type="text" name="description" class="form-control" value="<%=categories.description%>"/></td> | ||
11 | + </tr> | ||
12 | + </table> | ||
13 | + <input type="submit" name="submit" value="submit" class="btn btn-primary"> | ||
14 | + </form> | ||
15 | +<% include ../includes/footer.ejs %> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | <% include ../includes/header.ejs %> | 1 | <% include ../includes/header.ejs %> |
2 | <table class="table table-bordered table-hover"> | 2 | <table class="table table-bordered table-hover"> |
3 | <tr> | 3 | <tr> |
4 | - <th>제목</th> | 4 | + <th width="100px" style="text-align: center;">카테고리명</th> |
5 | - <th>작성일</th> | 5 | + <th style="text-align: center;">개설 날짜</th> |
6 | + <th>내용</th> | ||
7 | + <th>사용자명</th> | ||
6 | <th>삭제</th> | 8 | <th>삭제</th> |
7 | </tr> | 9 | </tr> |
8 | - <%products.forEach(function(product){%> | 10 | + <%categories.forEach(function(product){%> |
9 | <tr> | 11 | <tr> |
10 | <td> | 12 | <td> |
11 | - <a href="/admin/products/detail/<%=product.id%>"><%=product.name%></a> | 13 | + <a href="/categori/products/detail/<%=product.id%>"><%=product.title%></a> |
12 | </td> | 14 | </td> |
13 | <td> | 15 | <td> |
14 | <%=product.getDate.year%> - | 16 | <%=product.getDate.year%> - |
... | @@ -16,12 +18,18 @@ | ... | @@ -16,12 +18,18 @@ |
16 | <%=product.getDate.day%> | 18 | <%=product.getDate.day%> |
17 | </td> | 19 | </td> |
18 | <td> | 20 | <td> |
19 | - <a href="/admin/products/delete/<%=product.id%>" class="btn btn-danger" onclick="return confirm('삭제하시겠습니까?')">삭제</a> | 21 | + <%=product.description%> - |
22 | + </td> | ||
23 | + <td> | ||
24 | + <%=product.username%> - | ||
25 | + </td> | ||
26 | + <td> | ||
27 | + <a href="/categori/products/delete/<%=product.id%>" class="btn btn-danger" onclick="return confirm('삭제하시겠습니까?')">삭제</a> | ||
20 | </td> | 28 | </td> |
21 | </tr> | 29 | </tr> |
22 | <% }); %> | 30 | <% }); %> |
23 | </table> | 31 | </table> |
24 | 32 | ||
25 | - <a href="/admin/products/write" class="btn btn-default">작성하기</a> | 33 | + <a href="categori/write" class="btn btn-default">작성하기</a> |
26 | 34 | ||
27 | <% include ../includes/footer.ejs %> | 35 | <% include ../includes/footer.ejs %> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | <% include ../includes/header.ejs %> | 1 | <% include ../includes/header.ejs %> |
2 | <div class="panel panel-default"> | 2 | <div class="panel panel-default"> |
3 | <div class="panel-heading"> | 3 | <div class="panel-heading"> |
4 | - <%=product.name%> | 4 | + <%=product.title%> |
5 | </div> | 5 | </div> |
6 | <div class="panel-body"> | 6 | <div class="panel-body"> |
7 | <div style="padding-bottom: 10px"> | 7 | <div style="padding-bottom: 10px"> |
... | @@ -20,7 +20,7 @@ | ... | @@ -20,7 +20,7 @@ |
20 | <div> | 20 | <div> |
21 | 댓글작성하기 | 21 | 댓글작성하기 |
22 | <form id="commentForm" action="" method="post"> | 22 | <form id="commentForm" action="" method="post"> |
23 | - <input type="hidden" name="product_id" value="<%=product.id%>" /> | 23 | + <input type="hidden" name="product_id" value="<%=product._id%>" /> |
24 | <textarea class="form-control" name="content"></textarea> | 24 | <textarea class="form-control" name="content"></textarea> |
25 | <button class="btn btn-primary" style="margin-top: 10px">댓글작성</button> | 25 | <button class="btn btn-primary" style="margin-top: 10px">댓글작성</button> |
26 | </form> | 26 | </form> |
... | @@ -31,15 +31,15 @@ | ... | @@ -31,15 +31,15 @@ |
31 | <% comments.forEach(function(comment){ %> | 31 | <% comments.forEach(function(comment){ %> |
32 | <div> | 32 | <div> |
33 | <%=comment.content%> | 33 | <%=comment.content%> |
34 | - ( <a class='comment_delete' comment_id='<%=comment.id%>'>삭제</a> ) | 34 | + ( <a class='comment_delete' comment_id='<%=comment._id%>'>삭제</a> ) |
35 | </div> | 35 | </div> |
36 | <% }); %> | 36 | <% }); %> |
37 | </div> | 37 | </div> |
38 | </div> | 38 | </div> |
39 | </div> | 39 | </div> |
40 | 40 | ||
41 | - <a href="/admin/products" class="btn btn-default">목록으로</a> | 41 | + <a href="/categori/products" class="btn btn-default">목록으로</a> |
42 | - <a href="/admin/products/edit/<%=product.id%>" class="btn btn-primary">수정</a> | 42 | + <a href="/categori/products/edit/<%=product._id%>" class="btn btn-primary">수정</a> |
43 | <% include ../includes/footer.ejs %> | 43 | <% include ../includes/footer.ejs %> |
44 | <script> | 44 | <script> |
45 | (function(){ | 45 | (function(){ |
... | @@ -56,7 +56,7 @@ | ... | @@ -56,7 +56,7 @@ |
56 | if(args.message==="success"){ | 56 | if(args.message==="success"){ |
57 | $('#comment_area').append( | 57 | $('#comment_area').append( |
58 | '<div>' + args.content + | 58 | '<div>' + args.content + |
59 | - " ( <a class='comment_delete' comment_id='"+ args.id +"'>삭제</a> ) </div>" | 59 | + " ( <a class='comment_delete' comment_id='"+ args._id +"'>삭제</a> ) </div>" |
60 | ); | 60 | ); |
61 | $('#commentForm textarea[name=content]').val(""); | 61 | $('#commentForm textarea[name=content]').val(""); |
62 | } | 62 | } | ... | ... |
1 | <% include ./includes/header.ejs %> | 1 | <% include ./includes/header.ejs %> |
2 | - <div class="container" id="masonry_container"> | 2 | + <div id="masonry_container"> |
3 | + 한식 | ||
3 | <% for (var i in videos) { %> | 4 | <% for (var i in videos) { %> |
4 | <div id="<%=videos[i].id%>" vid="<%=videos[i].video_id%>"> | 5 | <div id="<%=videos[i].id%>" vid="<%=videos[i].video_id%>"> |
5 | </div> | 6 | </div> | ... | ... |
... | @@ -33,7 +33,7 @@ | ... | @@ -33,7 +33,7 @@ |
33 | <li class="active"> | 33 | <li class="active"> |
34 | <a href="/">Home</a> | 34 | <a href="/">Home</a> |
35 | </li> | 35 | </li> |
36 | - <li><a href="/admin/products">Categori</a></li> | 36 | + <li><a href="/categori/products">Categori</a></li> |
37 | <% if(isLogin){%> | 37 | <% if(isLogin){%> |
38 | <li><a href="/accounts/logout" onclick="return confirm('로그아웃 하시겠습니까?')">LOGOUT</a></li> | 38 | <li><a href="/accounts/logout" onclick="return confirm('로그아웃 하시겠습니까?')">LOGOUT</a></li> |
39 | <%}else{%> | 39 | <%}else{%> | ... | ... |
-
Please register or login to post a comment