Commit 7f195dc7 authored by shj's avatar shj

[IMPLEMENT] 인덱스 관리 dialog 구현

parent 68d538d8
......@@ -23,6 +23,12 @@ public class GuideTestController {
GuideService guideService;
GuideTestService guideTestService;
@GetMapping
public ResponseEntity<?> getGuide(@RequestParam(value = "guideId") String guideId) throws Exception{
return new ResponseEntity<>(guideTestService.findGuideById(guideId), HttpStatus.OK);
}
@ApiOperation(value="모든 가이드 목차 조회")
@GetMapping("/index")
public ResponseEntity<?> findIndex()throws Exception{
......@@ -45,8 +51,8 @@ public class GuideTestController {
}
@PutMapping("/index")
public ResponseEntity<?> updateGuideIndex(@RequestBody Guide guide) throws Exception{
return new ResponseEntity<>(guideService.updateGuide(guide), HttpStatus.OK);
public ResponseEntity<?> updateGuideIndex(@RequestBody GuideTest guide) throws Exception{
return new ResponseEntity<>(guideTestService.updateGuide(guide), HttpStatus.OK);
}
......@@ -56,16 +62,10 @@ public class GuideTestController {
}
@GetMapping
public ResponseEntity<?> getGuide(@RequestParam(value = "guideId") String guideId) throws Exception{
return new ResponseEntity<>(guideTestService.findGuideById(guideId), HttpStatus.OK);
}
@DeleteMapping
public ResponseEntity<?> deleteGuideIndex(@RequestParam(value = "guideId") String guideId, @RequestParam(value = "cascade", required = false) boolean cascade) throws Exception{
return new ResponseEntity<>(guideService.deleteGuide(guideId, cascade), HttpStatus.OK);
public ResponseEntity<?> deleteGuideIndex(@RequestParam(value = "guideId") String guideId) throws Exception{
return new ResponseEntity<>(guideTestService.deleteGuide(guideId), HttpStatus.OK);
}
@PutMapping
......
package com.vazil.vridge.docs.service;
import com.vazil.vridge.docs.model.Guide;
import com.vazil.vridge.docs.model.GuideTest;
import com.vazil.vridge.docs.repository.GuideTestRepository;
import com.vazil.vridge.docs.utils.TimeManager;
......@@ -100,6 +101,10 @@ public class GuideTestService {
@Transactional
public GuideTest createGuide(GuideTest guide) throws Exception{
// guide.setOrder(guide.getOrder() == null ? getLastOrder(guide.getParentId()) : 0);
// todo : 기존 인덱스와 위치가 중복될 경우, 기존 인덱스들 order + 1
guide.setLike(0);
guide.setView(0);
guide.setCreateDate(TimeManager.now());
......@@ -108,11 +113,24 @@ public class GuideTestService {
@Transactional
public GuideTest updateGuide(GuideTest guide) throws Exception{
GuideTest savedGuide = repository.findById(guide.getId()).orElseThrow(NoSuchElementException::new);
GuideTest db = repository.findById(guide.getId()).orElseThrow(NoSuchElementException::new);
// todo : 기존 인덱스와 위치가 중복될 경우, 기존 인덱스들 order + 1
savedGuide.setOrder(guide.getOrder());
savedGuide.setUpdateDate(TimeManager.now());
return repository.save(savedGuide);
db.setLocale(guide.getLocale());
db.setTitle(guide.getTitle());
db.setOrder(guide.getOrder());
db.setPath(guide.getPath());
db.setDepth(guide.getDepth());
return repository.save(db);
}
@Transactional
public String deleteGuide(String guideId) throws Exception{
GuideTest db = repository.findById(guideId).orElseThrow(NoSuchElementException::new);
repository.delete(db);
return db.getId();
}
}
......@@ -12,7 +12,7 @@
padding-right: 240px;
}
.guide-wrap {
min-height: 100vh !important;
min-height: 90vh !important;
max-width: 1280px !important;
margin:0 auto;
margin-top:36px;
......@@ -46,7 +46,7 @@
}
.guide-content{
margin-top:200px;
margin-top:130px;
width:100% !important;
h2{
......
......@@ -8,10 +8,10 @@
>
<v-list-item
v-if="item.children.length === 0"
@click="clickChildEvent(item)"
@click="clickItemEvent(item)"
:ripple="false"
:class="isActiveMenu(item.id) ? 'active' : ''"
:style="isActiveMenu(item.id) ? 'border-left: 2px solid #1E88E5;' : 'border-left: 1px solid rgba(0,0,0,0.15);'"
:style="{'border-left': depth !== 1 && '1px solid rgba(0,0,0,0.15)'}"
:class="selectedItem === item ? 'active' : ''"
>
<v-list-item-title v-text="item.title" />
</v-list-item>
......@@ -20,9 +20,9 @@
v-else
v-model="item.active"
:ripple="false"
:class="isActiveMenu(item.id) ? 'active' : ''"
:sub-group="depth > 1 ? true : false"
:style="isActiveMenu(item.id) ? 'border-left: 2px solid #1E88E5;' : 'border-left: 1px solid rgba(0,0,0,0.15);'"
:class="selectedItem === item ? 'active' : ''"
:style="{'border-left': depth !== 1 && '1px solid rgba(0,0,0,0.15)'}"
prepend-icon=""
>
<template v-slot:appendIcon>
......@@ -32,7 +32,7 @@
<template v-slot:activator>
<v-list-item-content
v-if="item"
@click="clickParentEvent(item)"
@click="clickItemEvent(item)"
active-class="active"
>
<v-list-item-title v-text="item.title" />
......@@ -42,8 +42,8 @@
<tree
:items="item.children"
:depth="depth+1"
@clickParentEvent="clickParentEvent"
@clickChildEvent="clickChildEvent"
:selectedItem="selectedItem"
@clickItemEvent="clickItemEvent"
/>
</v-list-group>
</div>
......@@ -58,6 +58,9 @@ export default {
type: Array,
required: true,
},
selectedItem: {
type: Object,
},
depth: {
type: [String, Number],
default: 1
......@@ -67,16 +70,12 @@ export default {
active: [],
}),
methods: {
clickParentEvent(item){
this.$emit('clickParentEvent', item)
},
clickChildEvent(item){
this.$emit('clickChildEvent', item)
},
isActiveMenu(id) {
return this.$route.path.indexOf(id) > -1
clickItemEvent(item){
this.$emit('clickItemEvent', item)
},
},
watch: {
},
mounted() {
},
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment