v1.8.4: единая стилистика — замена confirm/alert/prompt на кастомные модалки, SERVICE_STYLE_GUIDE.md, обновлен AGENTS.md
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
<td><small>{{ p.created_at.strftime('%d.%m.%Y') if p.created_at else '' }}</small></td>
|
||||
<td class="actions">
|
||||
<button class="btn btn-secondary btn-sm" onclick="editBlog({{ p.id }},'{{ p.title|e }}','{{ p.slug|e }}','{{ p.category|e }}','{{ p.status }}','{{ p.excerpt|e }}','{{ p.content|e }}')">✎</button>
|
||||
<form method="post" action="/service/blog/delete" style="display:inline" onsubmit="return confirm('Удалить запись?')"><input type="hidden" name="id" value="{{ p.id }}"><button class="btn btn-danger btn-sm">✕</button></form>
|
||||
<form method="post" action="/service/blog/delete" style="display:inline" id="delete-blog-form-{{ p.id }}"><input type="hidden" name="id" value="{{ p.id }}"><button type="button" class="btn btn-danger btn-sm" onclick="openConfirmDeleteBlog({{ p.id }},'{{ p.title|e }}')" title="Удалить">✕</button></form>
|
||||
</td>
|
||||
</tr>{% endfor %}</tbody></table>
|
||||
</div>
|
||||
@@ -33,7 +33,34 @@
|
||||
<button type="button" class="btn btn-secondary" onclick="this.closest('.modal-overlay').classList.remove('open')">Отмена</button></div>
|
||||
</form>
|
||||
</div></div>
|
||||
<div class="modal-overlay" id="confirm-delete-blog">
|
||||
<div class="modal" style="max-width:420px;">
|
||||
<h2 style="font-size:16px;margin-bottom:8px;">Удалить запись?</h2>
|
||||
<p style="color:var(--text-secondary);font-size:14px;margin-bottom:20px;">
|
||||
<strong id="delete-blog-name"></strong> будет удалён навсегда. Это действие нельзя отменить.
|
||||
</p>
|
||||
<div class="modal-actions" style="justify-content:flex-end;">
|
||||
<button type="button" class="btn btn-danger" onclick="confirmDeleteBlog()">Удалить</button>
|
||||
<button type="button" class="btn" onclick="closeConfirmDeleteBlog()">Отмена</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var deleteBlogId = null;
|
||||
function openConfirmDeleteBlog(id, name){
|
||||
deleteBlogId = id;
|
||||
document.getElementById('delete-blog-name').textContent = name || '#' + id;
|
||||
document.getElementById('confirm-delete-blog').classList.add('open');
|
||||
}
|
||||
function closeConfirmDeleteBlog(){
|
||||
document.getElementById('confirm-delete-blog').classList.remove('open');
|
||||
deleteBlogId = null;
|
||||
}
|
||||
function confirmDeleteBlog(){
|
||||
if(!deleteBlogId) return;
|
||||
document.getElementById('delete-blog-form-' + deleteBlogId).submit();
|
||||
closeConfirmDeleteBlog();
|
||||
}
|
||||
function editBlog(id,title,slug,category,status,excerpt,content){
|
||||
document.getElementById('modal-blog').classList.add('open');
|
||||
document.getElementById('modal-blog-title').textContent = 'Редактировать запись';
|
||||
|
||||
Reference in New Issue
Block a user