게시판에서 자료등록으로 이동시 분류 자동 선택.

삭제 게시물 보이지 않도록.
master
강석 최 2022-01-11 17:46:51 +09:00
parent f4103b95e3
commit 96ee07e0bc
9 changed files with 41 additions and 31 deletions

View File

@ -48,7 +48,7 @@ public class BoardController {
}
@GetMapping("/contentWrite")
public ModelAndView contentWrite(@AuthenticationPrincipal UserInfo loginUser, Board content) {
public ModelAndView contentWrite(@AuthenticationPrincipal UserInfo loginUser, Board content, Integer categorySeq) {
ModelAndView mav = new ModelAndView("board/contentWrite");
if(content.getContentSeq() == null) {
mav.addObject("type", "new");
@ -58,7 +58,7 @@ public class BoardController {
mav.addObject("type", "modify");
mav.addObject("content", boardService.selectContentModifyInfo(content.getContentSeq()));
}
mav.addObject("categorySeq", categorySeq);
mav.addObject("userRole", loginUser.getUserRole());
CategoryRole categoryRole = new CategoryRole();
categoryRole.setUserSeq(loginUser.getUserSeq());

View File

@ -27,7 +27,7 @@
INNER JOIN CONTENT_POSITION D
ON A.CATEGORY_SEQ = D.CATEGORY_SEQ
</if>
<where>
WHERE A.STATUS != 'D'
<if test="status != null and status != ''">
AND A.STATUS = #{status}
</if>
@ -71,7 +71,6 @@
WHERE ORIGINAL_NAME LIKE CONCAT('%', #{originalName}, '%')
)
</if>
</where>
<if test='status == "M"'>
ORDER BY A.VIEW_CNT DESC
</if>
@ -96,7 +95,7 @@
INNER JOIN CONTENT_POSITION D
ON A.CATEGORY_SEQ = D.CATEGORY_SEQ
</if>
<where>
WHERE A.STATUS != 'D'
<if test="status != null and status != ''">
AND A.STATUS = #{status}
</if>
@ -140,7 +139,6 @@
WHERE ORIGINAL_NAME LIKE CONCAT('%', #{originalName}, '%')
)
</if>
</where>
</select>
<select id="selectHashTagListFromContentSeq" resultType="HashTag" parameterType="int">

View File

@ -1,6 +1,4 @@
$(function(){
setSearchCondition();
$("#dateSelectorDiv").datepicker({
format: "yyyy-mm-dd",
language: "ko"

View File

@ -130,24 +130,3 @@ function getBoardLog(contentSeq){
});
}
}
function setMenu(){
const categorySeq = getParam("categorySeq");
openMenu($("[data-categoryseq='"+categorySeq+"']").attr("data-parentseq"));
}
function getParam(sname) {
const paramAry = location.search.substr(1).split("&");
for (let i = 0; i < paramAry.length; i++) {
const param = paramAry[i].split("=");
if (param[0] === sname) { return param[1]; }
}
}
function openMenu(parentSeq){
if(parentSeq){
const target = $("[data-categoryseq='"+parentSeq+"']")
target.click();
openMenu(target.attr("data-parentseq"));
}
}

View File

@ -5,6 +5,13 @@ $(function(){
$(".categorySelector").removeAttr("disabled");
setParentCategory(4, $("#categorySeq").find("[selected]").attr("data-parentseq"));
}
if(categorySeq !== undefined){
setMenu();
$(".categorySelector").removeAttr("disabled");
const selector = $("#categorySeq").find("[value='"+categorySeq+"']")
selector[0].selected = true;
setParentCategory(4, selector.attr("data-parentseq"));
}
$("#uploadDiv").on("dragenter", function(e) {
// $(this).addClass('drag-over');

View File

@ -1,12 +1,36 @@
let categorySeq;
$(document).on('click', '#moveRightBtn', function (){
moveCategorySelectBody(1);
})
$(document).on('click', '#moveLeftBtn', function (){
moveCategorySelectBody(-1);
})
$(document).on('click', '#contentWriteBtn', function (){
location.href="/board/contentWrite"+(categorySeq!==undefined?("?categorySeq="+categorySeq):"");
})
function moveCategorySelectBody(direction){
const categorySelectBody = $("#categorySelectBody");
const nowX = categorySelectBody.scrollLeft();
categorySelectBody.animate({scrollLeft:(direction*200+nowX)},200);
}
function setMenu(){
const categorySeq = getParam("categorySeq");
openMenu($("[data-categoryseq='"+categorySeq+"']").attr("data-parentseq"));
}
function getParam(sname) {
const paramAry = location.search.substr(1).split("&");
for (let i = 0; i < paramAry.length; i++) {
const param = paramAry[i].split("=");
if (param[0] === sname) { return param[1]; }
}
}
function openMenu(parentSeq){
if(parentSeq){
const target = $("[data-categoryseq='"+parentSeq+"']")
target.click();
openMenu(target.attr("data-parentseq"));
}
}

View File

@ -3,6 +3,9 @@
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{layout/layout}">
<th:block layout:fragment="script">
<script type="text/javascript">
categorySeq = [[${searchParams.categorySeq}]];
</script>
<script type="text/javascript" th:src="@{/js/board/contentList.js}"></script>
</th:block>
<div layout:fragment="content">

View File

@ -12,6 +12,7 @@
<th:block layout:fragment="script">
<script type="text/javascript">
const pageType = '[[${type}]]';
categorySeq = [[${categorySeq}]];
</script>
<script type="text/javascript" th:src="@{/js/board/contentWrite.js}"></script>
</th:block>

View File

@ -17,7 +17,7 @@
<a class="btn btn-primary" href="/board/contentSearch"><i class="bi bi-search"></i> 통합 검색</a>
</div>
<div class="d-grid gap-2 pt-1">
<a class="btn btn-success" href="/board/contentWrite"><i class="bi bi-file-earmark-plus "></i> 자료 등록</a>
<a class="btn btn-success" id="contentWriteBtn"><i class="bi bi-file-earmark-plus "></i> 자료 등록</a>
</div>
<div sec:authorize="isAuthenticated()">
<div class="flex-shrink-0 pe-3 py-3 bg-transparent">