93 lines
4.1 KiB
HTML
93 lines
4.1 KiB
HTML
|
|
{% extends 'base.html' %}
|
||
|
|
|
||
|
|
{% block content %}
|
||
|
|
<div class="uk-container" style="margin-top: 30px">
|
||
|
|
<div class="uk-card uk-card-default uk-margin" style="padding: 10px 30px">
|
||
|
|
<div class="uk-card-body" style="padding: 10px 30px">
|
||
|
|
{% if g.is_login and (g.user_info.mb_id == post.mb_id or g.user_info.mb_id in ['admin', 'wixon']) %}
|
||
|
|
<div style="float: right;color: white">
|
||
|
|
<a href="{{ url_for('edit_post', post_id=post.id) }}" class="uk-button uk-button-primary">수정</a>
|
||
|
|
<a class="uk-button uk-button-danger" href="javascript:blogDelete('{{ post.id }}');">삭제</a>
|
||
|
|
</div>
|
||
|
|
{% endif %}
|
||
|
|
<h3 class="uk-card-title">[{{ post.category }}] {{ post.title }}</h3>
|
||
|
|
<p class="uk-text-meta" style="float: right">Posted on {{ post.add_date }}</p>
|
||
|
|
<div style="width: 100%;border-top: 1px solid #eee;padding: 15px">
|
||
|
|
{{ post.contents | safe }}
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="uk-card uk-card-default uk-margin custom-table">
|
||
|
|
<div class="uk-card-body" style="padding: 0px">
|
||
|
|
<table class="uk-table uk-table-divider">
|
||
|
|
<tbody>
|
||
|
|
{% if prev_post is not none %}
|
||
|
|
<tr>
|
||
|
|
<td style="width: 80px;text-align: center;padding: 8px 6px;">이전</td>
|
||
|
|
<td style="padding: 8px 6px;">
|
||
|
|
<a href="{{ url_for('post', post_id=prev_post.id) }}">{{ prev_post.title }}</a>
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
{% endif %}
|
||
|
|
{% if next_post is not none %}
|
||
|
|
<tr>
|
||
|
|
<td style="width: 80px;text-align: center;padding: 8px 6px;">다음</td>
|
||
|
|
<td style="padding: 8px 6px;">
|
||
|
|
<a href="{{ url_for('post', post_id=next_post.id) }}">
|
||
|
|
<div style="width: 100%">
|
||
|
|
{{ next_post.title }}
|
||
|
|
</div>
|
||
|
|
</a>
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
{% endif %}
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div style="text-align: right;padding: 15px;">
|
||
|
|
<a href="{{ url_for('index') }}" class="uk-button uk-button-default">목록</a>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
function blogDelete(id) {
|
||
|
|
Swal.fire({
|
||
|
|
title: '정말로 삭제하시겠습니까?',
|
||
|
|
text: "이 작업은 되돌릴 수 없습니다!",
|
||
|
|
icon: 'warning',
|
||
|
|
showCancelButton: true,
|
||
|
|
confirmButtonColor: '#3085d6',
|
||
|
|
cancelButtonColor: '#d33',
|
||
|
|
confirmButtonText: '네, 삭제합니다!'
|
||
|
|
}).then((result) => {
|
||
|
|
if (result.isConfirmed) {
|
||
|
|
$.ajax({
|
||
|
|
url: "/blog/" + id,
|
||
|
|
type: "DELETE",
|
||
|
|
success: function (result) {
|
||
|
|
Swal.fire(
|
||
|
|
'삭제 완료!',
|
||
|
|
'포스트가 성공적으로 삭제되었습니다.',
|
||
|
|
'success'
|
||
|
|
);
|
||
|
|
// 포스트를 UI에서 삭제하거나 페이지를 다시 로드합니다.
|
||
|
|
location.href = '/';
|
||
|
|
},
|
||
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
||
|
|
Swal.fire(
|
||
|
|
'오류!',
|
||
|
|
'문제가 발생했습니다: ' + textStatus,
|
||
|
|
'error'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
{% endblock %}
|
||
|
|
|