Commit 7f195dc7 authored by shj's avatar shj

[IMPLEMENT] 인덱스 관리 dialog 구현

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