This repository has been archived by the owner on Oct 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CardModal.vue
191 lines (186 loc) · 4.56 KB
/
CardModal.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<template>
<CardModalBase>
<div slot="header">
<div class="modal-card-header-title">
<awesome
:icon="['far', 'clipboard']"
class="far fa-clipboard"
></awesome>
<input
class="form-control card-title-input"
type="text"
ref="inputTitle"
v-if="isEditTitle"
:value="card.title"
@blur="onSubmitTitle"
@keypress.enter="onKeyupEnter"
maxlength="44"
/>
<a v-else href="" @click.prevent="onEditTitle">
{{ card.title }} <awesome icon="edit" class="fas fa-edit"></awesome>
</a>
<span class="card-list-title">in list {{ listTitle }}</span>
</div>
</div>
<div slot="body" class="modal-card-body">
<ul class="body-items">
<DetailLabels />
<DetailDueDate />
<DetailDescription :card="card" />
<DetailAttachment />
<DetailChecklist v-if="checklists" />
<DetailLocation />
<DetailComment />
</ul>
</div>
<div slot="footer"></div>
<div slot="side" class="side-slot">
<CardModalSide />
</div>
</CardModalBase>
</template>
<script>
import CardModalBase from '@/components/card/cardDetail/CardModalBase';
import CardModalSide from '@/components/card/cardDetail/side/CardModalSide';
import DetailLabels from './detailItems/DetailLabels';
import DetailChecklist from './detailItems/detailChecklists/DetailChecklist';
import DetailDueDate from './detailItems/DetailDueDate';
import DetailLocation from './detailItems/detailLocation/DetailLocation';
import DetailDescription from './detailItems/DetailDescription';
import DetailComment from './detailItems/detailComment/DetailComment';
import DetailAttachment from './detailItems/detailAttachment/DetailAttachment';
import { mapActions, mapMutations, mapState } from 'vuex';
export default {
components: {
CardModalBase,
CardModalSide,
DetailLabels,
DetailChecklist,
DetailDueDate,
DetailDescription,
DetailLocation,
DetailComment,
DetailAttachment,
},
data() {
return {
isEditTitle: false,
listTitle: '',
};
},
computed: {
...mapState(['board', 'card', 'checklists']),
},
watch: {
// UPDATE_CARD 후 card가 들어오면 실행되도록.
card() {
const { title } = this.board.lists.filter(l => {
return l.id == this.card.listId;
})[0];
this.listTitle = title;
},
},
methods: {
...mapActions([
'READ_CARD',
'UPDATE_CARD',
'READ_CHECKLIST',
'READ_COMMENT',
'READ_FILE',
]),
...mapMutations(['deleteComment', 'deleteFile']),
onEditTitle() {
this.isEditTitle = true;
this.$nextTick(() => this.$refs.inputTitle.focus());
},
onSubmitTitle() {
this.isEditTitle = false;
const inputTitle = this.$refs.inputTitle.value || '';
if (inputTitle === this.card.title) return;
this.UPDATE_CARD({ id: this.card.id, title: inputTitle });
},
onKeyupEnter(event) {
event.target.blur();
},
},
async created() {
await this.READ_CARD({ id: this.$route.params.cardId });
await this.READ_CHECKLIST({ id: this.card.id });
await this.READ_COMMENT(this.card.id);
await this.READ_FILE(this.card.id);
},
};
</script>
<style lang="scss">
.modal-card-header-title {
padding-right: 30px;
min-height: 30px;
a {
color: #212732;
font-size: 20px;
margin-left: 15px;
.fa-edit {
display: none;
font-size: 10px;
color: #4f5d76;
}
&:hover {
color: rgba(0, 0, 0, 0.3);
.fa-edit {
display: inline-block;
color: #4f5d76;
}
}
}
.card-title-input {
position: absolute;
margin: 0 0 0 15px;
padding: 3px 6px;
width: 80%;
display: inline;
overflow: hidden;
overflow-wrap: break-word;
height: 28px;
font-size: 17px;
}
.card-list-title {
position: absolute;
padding: 7px 0 40px 39px;
display: block;
font-size: 13px;
font-weight: 400;
}
.fa-clipboard {
padding: 1px;
margin-top: 5px;
font-size: 20px;
color: #4f5d76;
}
}
.modal-card-body {
margin-bottom: 10px;
.body-items {
.body-item {
padding-top: 40px;
.fas,
.fa {
font-size: 16px;
color: #4f5d76;
}
.body-card-text {
display: inline;
margin-left: 14px;
padding: 3px 6px;
width: 90%;
overflow: hidden;
overflow-wrap: break-word;
height: 28px;
font-size: 18px;
}
}
}
}
.side-slot {
height: 100%;
}
</style>