|
@@ -40,6 +40,42 @@ function answerConfirm(){
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+function answerDelete() {
|
|
|
+ alertBox({ type : "confirm",
|
|
|
+ txt : "정말 답변을 삭제하시겠습니까? (답변삭제 시 복구가 볼가능합니다.)",
|
|
|
+ callBack : function( result ){
|
|
|
+ console.log( result );
|
|
|
+ if( result ){
|
|
|
+ var newForm = $( "#sendForm" ).clone();
|
|
|
+ newForm.attr("id", "answerFormDelete");
|
|
|
+ newForm.attr("method", "post");
|
|
|
+ newForm.attr("action", "./content/answerDelete");
|
|
|
+
|
|
|
+ $(document.body).append(newForm);
|
|
|
+ newForm.submit();
|
|
|
+ $("#answerForm").remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+function answerUpdate() {
|
|
|
+ if( $("#updateBtn").prop( "accessKey" ) == "false" ){
|
|
|
+ $("#answerContent").hide();
|
|
|
+ $("#answerContentHide").show();
|
|
|
+ $("#updateBtn").text("취소");
|
|
|
+ $("#updateBtn").prop( "accessKey", "true" );
|
|
|
+ $("#insertBtn").show();
|
|
|
+ } else {
|
|
|
+ $("#answerContent").show();
|
|
|
+ $("#answerContentHide").hide();
|
|
|
+ $("#updateBtn").text("수정");
|
|
|
+ $("#updateBtn").prop( "accessKey", "false" );
|
|
|
+ $("#insertBtn").hide();
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
var listPage = '<c:out value="${referer}"/>'.replaceAll( "&", "&" );
|
|
|
if( listPage.includes( '/qna/list' ) ) {
|
|
|
encodeURIComponent(listPage);
|
|
@@ -86,36 +122,45 @@ function goListPage(){
|
|
|
<div class="card-body">
|
|
|
<table class="table mobile-table">
|
|
|
<colgroup>
|
|
|
- <col style="width:75%">
|
|
|
- <col style="width:">
|
|
|
+ <col style="width:10%">
|
|
|
+ <col style="width:20%">
|
|
|
+ <col style="width:10%">
|
|
|
+ <col style="width:20%">
|
|
|
+ <col style="width:10%">
|
|
|
<col style="width:">
|
|
|
</colgroup>
|
|
|
|
|
|
<tr>
|
|
|
- <td>조회수 : <c:out value="${content.views}"></c:out></td>
|
|
|
- <th class="text-center">작성자</th>
|
|
|
- <td><c:out value="${content.createByName}(${content.createBy})" /></td>
|
|
|
+ <td colspan="6" class="text-bold text-info" style="font-size:16px;"><c:out value="${content.title}" /></td>
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
- <td class="text-bold text-info"><c:out value="${content.title}" /></td>
|
|
|
+ <th class="text-center">작성자</th>
|
|
|
+ <td><c:out value="${content.createByName}(${content.createBy})" /></td>
|
|
|
+
|
|
|
<th class="text-center">작성일</th>
|
|
|
<td><c:out value="${content.createDate}" /></td>
|
|
|
+
|
|
|
+ <th class="text-center">조회수</th>
|
|
|
+ <td><fmt:formatNumber value="${content.views}" pattern="#,###" /></td>
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
- <td colspan="3" style="white-space: pre-line;"><div style="min-height:200px;"><c:out value="${content.content}" /></div></td>
|
|
|
+ <td colspan="6" style="white-space: pre-line;"><div style="min-height:200px;"><c:out value="${content.content}" /></div></td>
|
|
|
</tr>
|
|
|
|
|
|
- <tr>
|
|
|
- <td colspan="3">
|
|
|
- <span class="badge bg-primary">첨부파일</span>
|
|
|
- <a href="./content/file?postSeq=${content.postSeq}" class="text-dark" target="_blank"><c:out value="${content.fileOriginalName}" /></a>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
+ <c:if test="${content.fileOriginalName ne ''}">
|
|
|
+ <tr>
|
|
|
+ <td colspan="6">
|
|
|
+ <span class="badge bg-primary">첨부파일</span>
|
|
|
+ <a href="./content/file?postSeq=${content.postSeq}" class="text-dark" target="_blank"><c:out value="${content.fileOriginalName}" /></a>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </c:if>
|
|
|
+
|
|
|
</table>
|
|
|
|
|
|
- <c:if test="${groupIdx eq 1}">
|
|
|
+ <c:if test="${groupIdx eq 1 or content.answerContent ne ''}">
|
|
|
<input type="hidden" name="answerId" value="${sesId}">
|
|
|
<table class="mt-3 table mobile-table">
|
|
|
<colgroup>
|
|
@@ -125,15 +170,12 @@ function goListPage(){
|
|
|
|
|
|
<tr>
|
|
|
<th>작성자</th>
|
|
|
-<!-- <td> -->
|
|
|
-<%-- <c:out value="${sesName}(${sesId})" /> --%>
|
|
|
-<!-- </td> -->
|
|
|
- <c:if test="${content.answerId eq ''}">
|
|
|
+ <c:if test="${content.answerContent eq ''}">
|
|
|
<td>
|
|
|
<c:out value="${sesName}(${sesId})" />
|
|
|
</td>
|
|
|
</c:if>
|
|
|
- <c:if test="${content.answerId ne ''}">
|
|
|
+ <c:if test="${content.answerContent ne ''}">
|
|
|
<td>
|
|
|
<c:out value="${content.answerName}(${content.answerId})" />
|
|
|
</td>
|
|
@@ -147,12 +189,12 @@ function goListPage(){
|
|
|
</td>
|
|
|
</c:if>
|
|
|
<c:if test="${content.answerContent ne ''}">
|
|
|
- <td colspan="3" style="white-space: pre-line;"><div style="min-height:100px;"><c:out value="${content.answerContent}" /></div></td>
|
|
|
+ <td colspan="3" style="white-space: pre-line;"><div id="answerContent"><c:out value="${content.answerContent}" /></div><textarea class="form-control" style="display:none;" id="answerContentHide" rows="2" cols="" name="answerContent" placeholder="내용을 입력하세요" maxlength="1000" required><c:out value="${item.content}" /></textarea></td>
|
|
|
</c:if>
|
|
|
</tr>
|
|
|
</table>
|
|
|
|
|
|
- <c:if test="${content.answerId eq ''}">
|
|
|
+ <c:if test="${content.answerContent eq ''}">
|
|
|
<div class="row mt-3">
|
|
|
<div class="col-12">
|
|
|
<div class="text-right">
|
|
@@ -161,7 +203,19 @@ function goListPage(){
|
|
|
</div>
|
|
|
</div>
|
|
|
</c:if>
|
|
|
-
|
|
|
+ <c:if test="${groupIdx eq 1}">
|
|
|
+ <c:if test="${content.answerContent ne ''}">
|
|
|
+ <div class="row mt-3">
|
|
|
+ <div class="col-12">
|
|
|
+ <div class="text-right">
|
|
|
+ <button type="button" id="deleteBtn" onclick="answerDelete();" class="answer-btn btn btn-danger w100">삭제</button>
|
|
|
+ <button type="button" id="updateBtn" accessKey="false" onclick="answerUpdate();" class="answer-btn btn btn-primary w100">수정</button>
|
|
|
+ <button type="button" id="insertBtn" onclick="answerConfirm();" class="answer-btn btn btn-secondary w100" style="display:none;">등록</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </c:if>
|
|
|
+ </c:if>
|
|
|
</c:if>
|
|
|
|
|
|
<table class="mt-3 table mobile-table">
|
|
@@ -198,8 +252,15 @@ function goListPage(){
|
|
|
<div class="col-12">
|
|
|
<div class="text-right">
|
|
|
<c:if test="${sesId eq content.createBy}">
|
|
|
- <button type="button" onclick="location.href='./edit?postSeq=${content.postSeq}';" class="btn btn-primary w100">수정</button>
|
|
|
- <button type="button" onclick="deleteConfirm();" class="btn btn-danger w100">삭제</button>
|
|
|
+ <c:if test="${content.answerContent eq ''}">
|
|
|
+ <button type="button" onclick="location.href='./edit?postSeq=${content.postSeq}';" class="btn btn-primary w100">수정</button>
|
|
|
+ <button type="button" onclick="deleteConfirm();" class="btn btn-danger w100">삭제</button>
|
|
|
+ </c:if>
|
|
|
+ </c:if>
|
|
|
+ <c:if test="${sesId ne content.createBy}">
|
|
|
+ <c:if test="${groupIdx eq '1'}">
|
|
|
+ <button type="button" onclick="deleteConfirm();" class="btn btn-danger w100">원글 삭제</button>
|
|
|
+ </c:if>
|
|
|
</c:if>
|
|
|
<button type="button" class="btn btn-outline-primary w100" onclick="goListPage();">목록</button>
|
|
|
</div>
|