게시물 작성, 수정시 메인페이지 노출 여부 선택 추가.
parent
8bd2cc6908
commit
ec6468d64b
|
|
@ -32,18 +32,12 @@ public class BaseController {
|
||||||
if(((UserInfo)((UsernamePasswordAuthenticationToken) principal).getPrincipal()).getUserRole().indexOf("ADMIN")>0){
|
if(((UserInfo)((UsernamePasswordAuthenticationToken) principal).getPrincipal()).getUserRole().indexOf("ADMIN")>0){
|
||||||
mav = new ModelAndView("redirect:/admin/main");
|
mav = new ModelAndView("redirect:/admin/main");
|
||||||
}else{
|
}else{
|
||||||
mav = new ModelAndView("redirect:/user/main");
|
mav = new ModelAndView("redirect:/board/main");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/user/main")
|
|
||||||
public ModelAndView main() {
|
|
||||||
ModelAndView mav = new ModelAndView("main");
|
|
||||||
return mav;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/refreshSession")
|
@GetMapping("/refreshSession")
|
||||||
public void getSession(HttpSession session){
|
public void getSession(HttpSession session){
|
||||||
session.setAttribute("positionList", commonCodeService.selectCommonCodeValue("POSITION"));
|
session.setAttribute("positionList", commonCodeService.selectCommonCodeValue("POSITION"));
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,14 @@ public class BoardController {
|
||||||
private final BoardService boardService;
|
private final BoardService boardService;
|
||||||
private final BoardCategoryService boardCategoryService;
|
private final BoardCategoryService boardCategoryService;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/main")
|
||||||
|
public ModelAndView main() {
|
||||||
|
ModelAndView mav = new ModelAndView("main");
|
||||||
|
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/contentWrite")
|
@GetMapping("/contentWrite")
|
||||||
public ModelAndView contentWrite(@AuthenticationPrincipal UserInfo loginUser, Board content) {
|
public ModelAndView contentWrite(@AuthenticationPrincipal UserInfo loginUser, Board content) {
|
||||||
ModelAndView mav = new ModelAndView("board/contentWrite");
|
ModelAndView mav = new ModelAndView("board/contentWrite");
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ public class BoardService {
|
||||||
Board savedContent = boardRepository.findById(contentSeq).orElse(null);
|
Board savedContent = boardRepository.findById(contentSeq).orElse(null);
|
||||||
savedContent.setCategorySeq(updateContent.getCategorySeq());
|
savedContent.setCategorySeq(updateContent.getCategorySeq());
|
||||||
savedContent.setTitle(updateContent.getTitle());
|
savedContent.setTitle(updateContent.getTitle());
|
||||||
|
savedContent.setStatus(updateContent.getStatus());
|
||||||
savedContent.setDescription(updateContent.getDescription());
|
savedContent.setDescription(updateContent.getDescription());
|
||||||
saveBoardLog(contentSeq, LogStatus.MODIFY, null, userInfo.getUserId());
|
saveBoardLog(contentSeq, LogStatus.MODIFY, null, userInfo.getUserId());
|
||||||
deleteHashTagLink(contentSeq);
|
deleteHashTagLink(contentSeq);
|
||||||
|
|
@ -77,7 +78,9 @@ public class BoardService {
|
||||||
if(fileSeqList!=null){
|
if(fileSeqList!=null){
|
||||||
deleteFileInfo(contentSeq, fileSeqList, userInfo.getUserId());
|
deleteFileInfo(contentSeq, fileSeqList, userInfo.getUserId());
|
||||||
}
|
}
|
||||||
|
if(updateContent.getFileList()!=null){
|
||||||
saveUploadFiles(updateContent, userInfo.getUserId());
|
saveUploadFiles(updateContent, userInfo.getUserId());
|
||||||
|
}
|
||||||
return contentSeq;
|
return contentSeq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -162,7 +165,7 @@ public class BoardService {
|
||||||
@Transactional
|
@Transactional
|
||||||
public Board selectContentByContentSeqAndViewCntUp(Integer contentSeq) {
|
public Board selectContentByContentSeqAndViewCntUp(Integer contentSeq) {
|
||||||
Board target = selectContent(contentSeq);
|
Board target = selectContent(contentSeq);
|
||||||
if(target.getStatus()==null){
|
if(!target.getStatus().equals("D")){
|
||||||
target.setViewCnt(target.getViewCnt()+1);
|
target.setViewCnt(target.getViewCnt()+1);
|
||||||
}
|
}
|
||||||
return target;
|
return target;
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ function searchParamCheck(){
|
||||||
emptyCnt++;
|
emptyCnt++;
|
||||||
}
|
}
|
||||||
if(emptyCnt>4){
|
if(emptyCnt>4){
|
||||||
alert("분류를 제외한 5가지 조건 중 1가지 이상 입력해주세요.")
|
alert("분류를 제외한 조건 중 1가지 이상 입력해주세요.")
|
||||||
return false;
|
return false;
|
||||||
}else{
|
}else{
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,9 @@ $(document).on('click', '#saveBtn', function (){
|
||||||
if(confirm("저장하시겠습니까?")){
|
if(confirm("저장하시겠습니까?")){
|
||||||
let ajaxUrl = "/board/saveContent";
|
let ajaxUrl = "/board/saveContent";
|
||||||
const formData = new FormData($("#contentForm")[0]);
|
const formData = new FormData($("#contentForm")[0]);
|
||||||
|
const status = $("#status:checked").val()
|
||||||
|
formData.append("status", status===undefined?"B":status);
|
||||||
|
|
||||||
for(const file of files) {
|
for(const file of files) {
|
||||||
if(!file.isDelete)
|
if(!file.isDelete)
|
||||||
formData.append('uploadFiles', file, file.name);
|
formData.append('uploadFiles', file, file.name);
|
||||||
|
|
@ -133,7 +136,7 @@ function selectorDisabler(depth){
|
||||||
}
|
}
|
||||||
|
|
||||||
function setParentCategory(depth, parentSeq){
|
function setParentCategory(depth, parentSeq){
|
||||||
$("[data-depth='"+depth+"']").children().each(function (){
|
$(".categorySelector[data-depth='"+depth+"']").children().each(function (){
|
||||||
const option = $(this)
|
const option = $(this)
|
||||||
if(parentSeq === option.attr("data-parentseq")){
|
if(parentSeq === option.attr("data-parentseq")){
|
||||||
option.removeAttr("style");
|
option.removeAttr("style");
|
||||||
|
|
@ -141,7 +144,7 @@ function setParentCategory(depth, parentSeq){
|
||||||
option.css("display", "none");
|
option.css("display", "none");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const nextTarget = $("[value='"+parentSeq+"']");
|
const nextTarget = $("option[value='"+parentSeq+"']");
|
||||||
nextTarget.attr("selected", "selected");
|
nextTarget.attr("selected", "selected");
|
||||||
if(depth!==1){
|
if(depth!==1){
|
||||||
setParentCategory(depth-1, nextTarget.attr("data-parentseq"));
|
setParentCategory(depth-1, nextTarget.attr("data-parentseq"));
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -4,7 +4,14 @@
|
||||||
<input type="hidden" id="detailViewContentSeq" th:value="${content.contentSeq}">
|
<input type="hidden" id="detailViewContentSeq" th:value="${content.contentSeq}">
|
||||||
<input type="hidden" id="contentStatus" th:value="${content.status}">
|
<input type="hidden" id="contentStatus" th:value="${content.status}">
|
||||||
<div class="row justify-content-between">
|
<div class="row justify-content-between">
|
||||||
<div class="col-auto"><h5 class="fw-bold" th:text="${content.title}"></h5></div>
|
<div class="col-auto">
|
||||||
|
<h5 class="fw-bold">
|
||||||
|
<th:block th:if="${content.status =='M'}">
|
||||||
|
<i class="bi bi-star-fill"></i>
|
||||||
|
</th:block>
|
||||||
|
<span th:text="${content.title}"></span>
|
||||||
|
</h5>
|
||||||
|
</div>
|
||||||
<div class="col-auto" th:text="|조회수: ${content.viewCnt}|"></div>
|
<div class="col-auto" th:text="|조회수: ${content.viewCnt}|"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row justify-content-between border-bottom pb-3">
|
<div class="row justify-content-between border-bottom pb-3">
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,10 @@
|
||||||
<div class="col-7 card">
|
<div class="col-7 card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="row mb-3 justify-content-end">
|
<div class="row mb-3 justify-content-end">
|
||||||
|
<div class="col-auto my-auto pe-0">
|
||||||
|
<input type="checkbox" id="status" name="status" value="M" th:checked="${type=='new'?false:(content.status=='M'?true:false)}">
|
||||||
|
</div>
|
||||||
|
<label for="status" class="col-auto col-form-label">메인페이지 노출</label>
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
<button class="bi bi-save btn btn-primary" id="saveBtn"> 저장</button>
|
<button class="bi bi-save btn btn-primary" id="saveBtn"> 저장</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
<!--bootstrap-->
|
<!--bootstrap-->
|
||||||
<script type="text/javascript" th:src="@{/vendor/bootstrap-5.1.3-dist/js/bootstrap.bundle.min.js}"></script>
|
<script type="text/javascript" th:src="@{/vendor/bootstrap-5.1.3-dist/js/bootstrap.bundle.min.js}"></script>
|
||||||
<script type="text/javascript" th:src="@{/vendor/bootstrap-5.1.3-dist/js/popper.min.js}"></script>
|
|
||||||
<!--jquery-->
|
<!--jquery-->
|
||||||
<script type="text/javascript" th:src="@{/vendor/jquery-3.6.0/jquery-3.6.0.min.js}"></script>
|
<script type="text/javascript" th:src="@{/vendor/jquery-3.6.0/jquery-3.6.0.min.js}"></script>
|
||||||
<!--bootstrap-datepicker-->
|
<!--bootstrap-datepicker-->
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,11 @@
|
||||||
|
|
||||||
<!--<img class="mb-4" th:src="@{/img/}" alt="" width="72" height="57">-->
|
<!--<img class="mb-4" th:src="@{/img/}" alt="" width="72" height="57">-->
|
||||||
<h1 class="h3 mb-3 fw-normal">로그인</h1>
|
<h1 class="h3 mb-3 fw-normal">로그인</h1>
|
||||||
<div class="form-floating">
|
<div class="form-floating py-2">
|
||||||
<input type="text" class="form-control" id="username" name="username" placeholder="아이디">
|
<input type="text" class="form-control" id="username" name="username" placeholder="아이디">
|
||||||
<label for="username">아이디</label>
|
<label for="username">아이디</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-floating">
|
<div class="form-floating py-2">
|
||||||
<input type="password" class="form-control" id="password" name="password" placeholder="비밀번호">
|
<input type="password" class="form-control" id="password" name="password" placeholder="비밀번호">
|
||||||
<label for="password">비밀번호</label>
|
<label for="password">비밀번호</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
<input type="checkbox" class="disabled" value="remember-me"> 계정저장(비활성화)
|
<input type="checkbox" class="disabled" value="remember-me"> 계정저장(비활성화)
|
||||||
</label>
|
</label>
|
||||||
</div>-->
|
</div>-->
|
||||||
<button class="w-100 btn btn-lg btn-primary" type="submit">로그인</button>
|
<button class="w-100 py-2 btn btn-lg btn-primary" type="submit">로그인</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue