Skip to content

Commit 430ac2f

Browse files
committed
Merge branch 'real_honey' into dev
2 parents 2c08974 + c81ddf9 commit 430ac2f

14 files changed

+197
-76
lines changed

comp/static/comp/comp_detail_community_detail.css

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
.post-delete {
103103
border: 1px solid #df7861;
104104
color: #df7861;
105+
background-color: #fdfdfd;
105106
}
106107

107108
.post-delete:hover {
@@ -266,9 +267,30 @@
266267
width: 1000px;
267268
height: 100px;
268269
margin-left: 64px;
270+
border: 0;
269271
}
270272

271273
.write {
272-
display: flex;
273-
margin-left: 1040px;
274+
margin-left: 1010px;
275+
font-family: S-CoreDream-5Medium, sans-serif;
276+
font-size: 14px;
277+
background-color: #f7f7f7;
278+
border: 1px solid white;
279+
width: 50px;
280+
height: 30px;
281+
border-radius: 3px;
282+
line-height: 30px;
283+
transition-duration: 0.3s;
284+
margin-top: 10px;
285+
286+
}
287+
288+
.write:hover {
289+
cursor: pointer;
290+
background-color: white;
291+
}
292+
293+
input::placeholder {
294+
color: black;
295+
font-size: 15px;
274296
}

comp/templates/comp/base.html

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,8 @@
5959

6060
<div class="corp-overview">
6161
<div class="corp-context">
62-
세상이 넓다지만 지구는 좁고 나라가 많다해도 모두가 이웃. <br/>
63-
가슴을 활짝 열고 대화 해보세 인류의 번영위해 행복을 위해 겨례의 앞길은 내가 <br/>
64-
밝히리 희망과 꿈의 전당 외국어고교 부산외국어고교 부산외국어고교 <br/>
65-
동해물과 백두산이 마르고 닮도록 하나님이 보우하사 우리 나라 만세 <br/>
62+
서울특별시 관악구 관악로 1 서울대학교 <br/>
63+
경영대학 58동 218호 <br/>
6664
</div>
6765
<div class="footer-icons">
6866
<div class="footer-icon-wrap">
@@ -81,23 +79,24 @@
8179
<div class="footer-right">
8280
<div class="footer-list">
8381
<div class="footer-list-title">개발자 알아보기</div>
84-
<div>무언가</div>
85-
<div>아무거나</div>
86-
<div>적당히</div>
87-
<div>들어가야함</div>
82+
<div>'Ddo Ddo' 최수현</div>
83+
<div>'Cha Bog' 이재복</div>
84+
<div>'Honey' 이병헌</div>
85+
<div>'Adamin' 김다민</div>
86+
<div>'Sseung JJang' 정승재</div>
8887
</div>
8988
<div class="footer-list">
9089
<div class="footer-list-title">서포터즈</div>
91-
<div>기업이름</div>
92-
<div>적당히</div>
93-
<div>넣으면됨</div>
90+
<div>애플(&copy;Apple)</div>
91+
<div>삼성(&copy;SamSung)</div>
92+
<div>구글(&copy;GooGle)</div>
9493
</div>
9594
<div class="footer-list">
96-
<div class="footer-list-title">리스트 이름</div>
97-
<div>뭐가 될지는</div>
98-
<div>모르겠지만 일단</div>
99-
<div>하나 더</div>
100-
<div>필요할 듯</div>
95+
<div class="footer-list-title">Contact us</div>
96+
<div>Instagram</div>
97+
<div>Facebook</div>
98+
<div>Contact</div>
99+
<div>Donation</div>
101100
</div>
102101
</div>
103102
</div>

comp/templates/comp/comp_detail_code_detail.html

Lines changed: 81 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
</div>
3333

3434
<div class="post-top-right">
35-
{% if is_post_user == 0 %}
36-
<form action="{% url 'comp:comp_code_update' comp.pk codepost.pk %}">
37-
<input class="post-update" value="수정" type="submit">
38-
</form>
39-
<form action="{% url 'comp:comp_code_delete' comp.pk codepost.pk %}" method="post">
40-
{% csrf_token %}
41-
<input class="post-delete" value="삭제" type="submit">
42-
</form>
43-
{% endif %}
35+
{% if is_post_user == 0 %}
36+
<form action="{% url 'comp:comp_code_update' comp.pk codepost.pk %}">
37+
<input class="post-update" value="수정" type="submit">
38+
</form>
39+
<form action="{% url 'comp:comp_code_delete' comp.pk codepost.pk %}" method="post">
40+
{% csrf_token %}
41+
<input class="post-delete" value="삭제" type="submit">
42+
</form>
43+
{% endif %}
4444
</div>
4545
</div>
4646

@@ -73,23 +73,24 @@
7373
</div>
7474

7575

76-
{#================여기부터 코멘트====================#}
76+
{#================여기부터 코멘트====================#}
7777

7878
<div class="comment-wrap">
7979
<div class="comment-nav">
8080
<div class="count_comment">총 {{ count_comment }}개의 댓글</div>
8181

82-
{% if user.is_authenticated %}
83-
<a href="{% url 'comp:comp_code_comment_create' comp.pk codepost.pk %}" class="create-code">
84-
<i class="fas fa-pen"></i>
85-
</a>
82+
{% if user.is_authenticated %}
83+
<a href="{% url 'comp:comp_code_comment_create' comp.pk codepost.pk %}" class="create-code">
84+
<i class="fas fa-pen"></i>
85+
</a>
8686
{% endif %}
8787
</div>
8888

8989
<div class="comment">
9090
{% for comment in comment_list %}
9191
<div class="comment-unit">
92-
<div class="comment-profile"><a href="{% url 'profile_view' comment.user %}"><img src="{{ comment.user.profile_set.image.url }}" alt=""></a></div>
92+
<div class="comment-profile"><a href="{% url 'profile_view' comment.user %}"><img
93+
src="{{ comment.user.profile_set.image.url }}" alt=""></a></div>
9394

9495
<div class="comment-main">
9596
<div class="comment-unit-nav">
@@ -104,16 +105,17 @@
104105
<form action="{% url 'comp:comp_code_comment_update' comp.pk codepost.pk comment.pk %}">
105106
<input class="post-update" value="수정" type="submit">
106107
</form>
107-
<form action="{% url 'comp:comp_code_comment_delete' comp.pk codepost.pk comment.pk %}" method="post">
108+
<form action="{% url 'comp:comp_code_comment_delete' comp.pk codepost.pk comment.pk %}"
109+
method="post">
108110
{% csrf_token %}
109111
<input class="post-delete" value="삭제" type="submit">
110112
</form>
111113
{% endif %}
112114

113115
{% if user.is_authenticated %}
114-
<a href="{% url 'comp:comp_code_commcomment_create' comp.pk codepost.pk comment.pk %}">
115-
<div>답글쓰기</div>
116-
</a>
116+
<a href="{% url 'comp:comp_code_commcomment_create' comp.pk codepost.pk comment.pk %}" style="display:none;">
117+
<div>답글쓰기</div>
118+
</a>
117119
{% endif %}
118120
</div>
119121
</div>
@@ -134,10 +136,11 @@
134136

135137
{#------------여기부터 답글---------------#}
136138

137-
{% for commcomment in commcomment_list %}
139+
{% for commcomment in commcomment_list %}
138140
{% if commcomment.commcomment == comment %}
139141
<div class="commcomment-wrap">
140-
<div class="comment-profile"><a href="{% url 'profile_view' comment.user %}"><img src="{{ comment.user.profile_set.image.url }}" alt=""></a></div>
142+
<div class="comment-profile"><a href="{% url 'profile_view' comment.user %}"><img
143+
src="{{ comment.user.profile_set.image.url }}" alt=""></a></div>
141144

142145
<div class="commcomment-main">
143146
<div class="post-top-right">
@@ -148,7 +151,8 @@
148151
</div>
149152

150153
{% if is_post_user == 0 %}
151-
<form action="{% url 'comp:comp_code_commcomment_delete' comp.pk codepost.pk comment.pk commcomment.pk %}" method="post">
154+
<form action="{% url 'comp:comp_code_commcomment_delete' comp.pk codepost.pk comment.pk commcomment.pk %}"
155+
method="post">
152156
{% csrf_token %}
153157
<input class="post-delete" value="삭제" type="submit">
154158
</form>
@@ -159,9 +163,11 @@
159163

160164
<div class="good">
161165
{% if commcomment.id in comment_likelist %}
162-
<i class="fas fa-thumbs-up like" name="cdc-like-{{ commcomment.id }}"></i>
166+
<i class="fas fa-thumbs-up like"
167+
name="cdc-like-{{ commcomment.id }}"></i>
163168
{% else %}
164-
<i class="far fa-thumbs-up like" name="cdc-like-{{ commcomment.id }}"></i>
169+
<i class="far fa-thumbs-up like"
170+
name="cdc-like-{{ commcomment.id }}"></i>
165171
{% endif %}
166172
<div>추천</div>
167173
<div id="cdc-likecount-{{ commcomment.id }}">{{ commcomment.like.count }}</div>
@@ -171,9 +177,60 @@
171177
</div>
172178
{% endif %}
173179
{% endfor %}
180+
<div class="comment-unit-nav" style="margin: 10px;">
181+
<div class="comment-unit-nav-left"></div>
182+
<div class="comment-unit-nav-right">
183+
{% if user.is_authenticated %}
184+
<a class="reply" name="reply-{{ comment.id }}" style="cursor: pointer;">
185+
<div>답글쓰기</div>
186+
</a>
187+
{% endif %}
188+
</div>
189+
</div>
190+
191+
<div id="comcomment-wrap-{{ comment.id }}" class="comcomment_wrap_off">
192+
<input type="text" class="comcomment_text" name="input_comment-{{ comment.id }}"
193+
placeholder="댓글 입력">
194+
<button class="write">작성</button>
195+
</div>
196+
174197
</div>
175198
</div>
176199
{% endfor %}
177200
</div>
178201
</div>
202+
203+
<script>
204+
$('button.write').click(function () {
205+
var context = $(this).prev().val();
206+
var codepost_pk = {{ codepost.id }};
207+
var codecomment_pk = $(this).prev().attr('name').substr(14);
208+
if (context !== '') {
209+
$.ajax({
210+
type: 'POST',
211+
url: "{% url 'comp:codecomment_create_ajax' %}",
212+
data: {
213+
'context': context,
214+
'codepost_pk': codepost_pk,
215+
'codecomment_pk': codecomment_pk,
216+
'csrfmiddlewaretoken': '{{ csrf_token }}',
217+
},
218+
datatype: "json",
219+
220+
success: function (response) {
221+
{#$("#damin").load(window.location.href);#}
222+
location.reload();
223+
224+
},
225+
226+
error: function (request, status, error) { // 통신 실패시
227+
alert('댓글 작성에 실패하셨습니다');
228+
229+
},
230+
})
231+
} else {
232+
alert('내용을 입력해주세요');
233+
}
234+
})
235+
</script>
179236
{% endblock %}

comp/templates/comp/comp_detail_community_detail.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
{% endif %}
139139
</div>
140140

141-
<div class="comment-text">{{ comment.context }}</div>
141+
<div class="comment-text">{{ commcomment.context }}</div>
142142

143143
<div class="good">
144144
{% if commcomment.id in comment_likelist %}
@@ -188,6 +188,7 @@
188188
var context = $(this).prev().val();
189189
var compost_pk = {{ compost.id }};
190190
var comcomment_pk = $(this).prev().attr('name').substr(14);
191+
if(context!==''){
191192
$.ajax({
192193
type: 'POST',
193194
url: "{% url 'comp:comment_create_ajax' %}",
@@ -201,15 +202,18 @@
201202

202203
success: function (response) {
203204
{#$("#damin").load(window.location.href);#}
204-
location.reload()
205+
location.reload();
205206

206207
},
207208

208209
error: function (request, status, error) { // 통신 실패시
209210
alert('댓글 작성에 실패하셨습니다');
210211

211212
},
212-
})
213+
})}
214+
else{
215+
alert('내용을 입력해주세요')
216+
}
213217
})
214218
</script>
215219
{% endblock %}

comp/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
name="comp_community_comment_create"),
2828
path("community/ajax/", views.comment_create_ajax,
2929
name="comment_create_ajax"),
30+
path("code/ajax", views.codecomment_create_ajax, name="codecomment_create_ajax"),
3031
path("<int:pk>/community/<int:pk2>/<int:pk3>/update/", views.comp_detail_community_comment_update,
3132
name="comp_community_comment_update"),
3233
path("<int:pk>/community/<int:pk2>/<int:pk3>/delete/", views.comp_detail_community_comment_delete,

comp/utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
from comp.models import *
55

66

7+
def join_user():
8+
return len(Answer.objects.all())
9+
10+
711
def user_profile_image_path(instance, filename):
812
# 프로필은 MEDIA/user_<id>/<profile> 에 저장될거야. 그냥 파일명으로!
913
return 'user_{}/profile'.format(instance.user.id)
@@ -15,6 +19,7 @@ def user_answer_upload_to(instance, filename):
1519
extension = os.path.splitext(filename)[-1].lower() # 확장자 추출하고, 소문자로 변환
1620
return 'comp_{}/user_{}/{}'.format(instance.comp, instance.user, uuid_name[:2] + filename)
1721

22+
1823
def comp_answer_upload_to(instance, filename):
1924
# 대회의 정답은 MEDIA/comp_<대회명>/<파일명> 에 저장될거야. 유저가 올린 파일명을 랜덤으로 바꿔서!
2025
extension = os.path.splitext(filename)[-1].lower()

comp/views.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ def comp_detail_code_commcomment_delete(request, pk, pk2, pk3, pk4):
558558
comp = Comp.objects.get(pk=pk)
559559
codepost = CodePost.objects.filter(comp=comp).get(pk=pk2)
560560
codecomment = CodeComment.objects.filter(codepost=codepost).get(pk=pk3)
561-
codecommcomment = CodeComment.objects.filter(codecomment=codecomment).get(pk=pk4)
561+
codecommcomment = CodeComment.objects.filter(commcomment=codecomment).get(pk=pk4)
562562

563563
if request.method == "POST":
564564
codecommcomment.delete()
@@ -790,4 +790,20 @@ def comp_ranking(request, pk):
790790
"comp": comp,
791791
"user_list": user,
792792
}
793-
return render(request, 'comp/comp_ranking.html', context)
793+
return render(request, 'comp/comp_ranking.html', context)
794+
795+
def codecomment_create_ajax(request):
796+
codepost_pk = request.POST.get('codepost_pk', None)
797+
codecomment_pk = request.POST.get('codecomment_pk', None)
798+
799+
newcodecomment = CodeComment()
800+
newcodecomment.codepost = CodePost.objects.get(pk=codepost_pk)
801+
newcodecomment.commcomment = CodeComment.objects.get(pk=codecomment_pk)
802+
newcodecomment.user = request.user
803+
newcodecomment.context = request.POST.get('context')
804+
newcodecomment.save()
805+
806+
ctx = {
807+
'context': newcodecomment.context,
808+
}
809+
return JsonResponse(ctx)

main/static/main/main.css

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ html, body {
181181

182182
.main-sub {
183183
font-family: S-CoreDream-3Light, sans-serif;
184-
font-size: 13px;
184+
font-size: 16px;
185185
color: white;
186186
margin-top: 5px;
187187
}
@@ -305,6 +305,7 @@ html, body {
305305
padding: 30px 0 0;
306306
text-align: center;
307307
background-color: #e2eff1;
308+
justify-content: center;
308309
}
309310

310311
.explanation-title {
@@ -315,10 +316,12 @@ html, body {
315316
}
316317

317318
.explanation-context {
318-
margin-top: 5px;
319+
margin-top: 50px;
319320
font-family: S-CoreDream-3Light, 'sans-serif';
320-
font-size: 13px;
321+
font-size: 16px;
321322
color: #333333;
323+
line-height: 40px;
324+
text-align: center;
322325
}
323326

324327
#explanation-text a {

0 commit comments

Comments
 (0)