Showing
3 changed files
with
0 additions
and
150 deletions
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/admin/products.ejs
deleted
100644 → 0
| 1 | -<% include ../includes/header.ejs %> | ||
| 2 | - <table class="table table-bordered table-hover"> | ||
| 3 | - <tr> | ||
| 4 | - <th width="100px" style="text-align: center;">카테고리명</th> | ||
| 5 | - <th style="text-align: center;">영상 개수</th> | ||
| 6 | - <th>내용</th> | ||
| 7 | - <th>삭제</th> | ||
| 8 | - </tr> | ||
| 9 | - <%products.forEach(function(product){%> | ||
| 10 | - <tr> | ||
| 11 | - <td> | ||
| 12 | - <a href="/admin/products/detail/<%=product.id%>"><%=product.name%></a> | ||
| 13 | - </td> | ||
| 14 | - <td> | ||
| 15 | - <%=product.getDate.year%> - | ||
| 16 | - <%=product.getDate.month%> - | ||
| 17 | - <%=product.getDate.day%> | ||
| 18 | - </td> | ||
| 19 | - <td> | ||
| 20 | - <a href="/admin/products/delete/<%=product.id%>" class="btn btn-danger" onclick="return confirm('삭제하시겠습니까?')">삭제</a> | ||
| 21 | - </td> | ||
| 22 | - </tr> | ||
| 23 | - <% }); %> | ||
| 24 | - </table> | ||
| 25 | - | ||
| 26 | - <a href="/admin/products/write" class="btn btn-default">작성하기</a> | ||
| 27 | - | ||
| 28 | -<% include ../includes/footer.ejs %> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
views/admin/productsDetail.ejs
deleted
100644 → 0
| 1 | -<% include ../includes/header.ejs %> | ||
| 2 | - <div class="panel panel-default"> | ||
| 3 | - <div class="panel-heading"> | ||
| 4 | - <%=product.name%> | ||
| 5 | - </div> | ||
| 6 | - <div class="panel-body"> | ||
| 7 | - <div style="padding-bottom: 10px"> | ||
| 8 | - 작성일 : | ||
| 9 | - <%=product.getDate.year%> - | ||
| 10 | - <%=product.getDate.month%> - | ||
| 11 | - <%=product.getDate.day%> | ||
| 12 | - </div> | ||
| 13 | - <% if(product.thumbnail){%> | ||
| 14 | - <p> | ||
| 15 | - <img src="/uploads/<%=product.thumbnail%>" style="max-width: 100%"/> | ||
| 16 | - </p> | ||
| 17 | - <% } %> | ||
| 18 | - <%=product.description%> | ||
| 19 | - <!-- 댓글영역 --> | ||
| 20 | - <div> | ||
| 21 | - 댓글작성하기 | ||
| 22 | - <form id="commentForm" action="" method="post"> | ||
| 23 | - <input type="hidden" name="product_id" value="<%=product.id%>" /> | ||
| 24 | - <textarea class="form-control" name="content"></textarea> | ||
| 25 | - <button class="btn btn-primary" style="margin-top: 10px">댓글작성</button> | ||
| 26 | - </form> | ||
| 27 | - </div> | ||
| 28 | - <!-- 댓글영역 --> | ||
| 29 | - <hr /> | ||
| 30 | - <div id="comment_area"> | ||
| 31 | - <% comments.forEach(function(comment){ %> | ||
| 32 | - <div> | ||
| 33 | - <%=comment.content%> | ||
| 34 | - ( <a class='comment_delete' comment_id='<%=comment.id%>'>삭제</a> ) | ||
| 35 | - </div> | ||
| 36 | - <% }); %> | ||
| 37 | - </div> | ||
| 38 | - </div> | ||
| 39 | - </div> | ||
| 40 | - | ||
| 41 | - <a href="/admin/products" class="btn btn-default">목록으로</a> | ||
| 42 | - <a href="/admin/products/edit/<%=product.id%>" class="btn btn-primary">수정</a> | ||
| 43 | -<% include ../includes/footer.ejs %> | ||
| 44 | -<script> | ||
| 45 | -(function(){ | ||
| 46 | - $(document).ready(function() { | ||
| 47 | - $('#commentForm').submit(function(){ | ||
| 48 | - var $contentVal = $(this).children('textarea[name=content]').val(); | ||
| 49 | - if($contentVal){ | ||
| 50 | - $.ajax({ | ||
| 51 | - url: '/admin/products/ajax_comment/insert', | ||
| 52 | - type: 'POST', | ||
| 53 | - data: $(this).serialize(), | ||
| 54 | - }) | ||
| 55 | - .done(function(args) { | ||
| 56 | - if(args.message==="success"){ | ||
| 57 | - $('#comment_area').append( | ||
| 58 | - '<div>' + args.content + | ||
| 59 | - " ( <a class='comment_delete' comment_id='"+ args.id +"'>삭제</a> ) </div>" | ||
| 60 | - ); | ||
| 61 | - $('#commentForm textarea[name=content]').val(""); | ||
| 62 | - } | ||
| 63 | - }) | ||
| 64 | - .fail(function(args) { | ||
| 65 | - console.log(args); | ||
| 66 | - }); | ||
| 67 | - }else{ | ||
| 68 | - alert('댓글 내용을 입력해주세요.') | ||
| 69 | - } | ||
| 70 | - return false; | ||
| 71 | - }); | ||
| 72 | - }); | ||
| 73 | -})(); | ||
| 74 | -</script> | ||
| 75 | -<script> | ||
| 76 | -$(document).on('click' , '.comment_delete' , function(){ | ||
| 77 | - if(confirm('삭제하시겠습니까?')){ //확인창 예 눌렀을 시만 진행 | ||
| 78 | - var $self = $(this); | ||
| 79 | - $.ajax({ | ||
| 80 | - url: '/admin/products/ajax_comment/delete', | ||
| 81 | - type: 'POST', | ||
| 82 | - data: { comment_id : $self.attr('comment_id') }, | ||
| 83 | - }) | ||
| 84 | - .done(function() { | ||
| 85 | - $self.parent().remove(); | ||
| 86 | - alert("삭제가 완료되었습니다."); | ||
| 87 | - }) | ||
| 88 | - .fail(function(args) { | ||
| 89 | - console.log(args); | ||
| 90 | - }); | ||
| 91 | - } | ||
| 92 | -}); | ||
| 93 | -</script> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment