Make edit.html responsive with sticky action bar, Ctrl+S shortcut, and safe save handlers
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<html lang="th">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<title>แก้ไขแบบสอบถาม - TPU Survey</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
@@ -26,79 +26,160 @@
|
||||
</script>
|
||||
<link rel="stylesheet" href="css/style.css?v=6">
|
||||
<style>
|
||||
body { background-color: var(--bg-color); font-family: 'Noto Sans Thai', sans-serif; }
|
||||
.editor-container {
|
||||
max-width: 1000px;
|
||||
margin: 0 auto;
|
||||
padding: 100px 20px 60px;
|
||||
* { box-sizing: border-box; }
|
||||
body {
|
||||
background-color: #f8fafc;
|
||||
font-family: 'Noto Sans Thai', sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
.editor-header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: var(--header-height);
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
min-height: 64px;
|
||||
background: rgba(255, 255, 255, 0.98);
|
||||
backdrop-filter: blur(12px);
|
||||
border-bottom: 3px solid #fbbf24;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 40px;
|
||||
padding: 8px 20px;
|
||||
z-index: 1000;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
|
||||
gap: 12px;
|
||||
}
|
||||
.editor-title {
|
||||
font-size: 1.25rem;
|
||||
font-size: 1.1rem;
|
||||
font-weight: 800;
|
||||
color: #1e3a8a;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 50%;
|
||||
max-width: 450px;
|
||||
}
|
||||
.editor-container {
|
||||
max-width: 1000px;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
padding: 84px 16px 120px;
|
||||
}
|
||||
.editor-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.sticky-bottom-bar {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: rgba(255, 255, 255, 0.98);
|
||||
backdrop-filter: blur(12px);
|
||||
border-top: 1px solid #e2e8f0;
|
||||
padding: 12px 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
z-index: 999;
|
||||
box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
|
||||
gap: 12px;
|
||||
}
|
||||
.section-category-badge {
|
||||
font-size: 10px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
padding: 2px 8px;
|
||||
border-radius: 4px;
|
||||
font-weight: 700;
|
||||
margin-bottom: 8px;
|
||||
display: inline-block;
|
||||
.dirty-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 0.8rem;
|
||||
color: #d97706;
|
||||
font-weight: 600;
|
||||
}
|
||||
@media (max-width: 768px) {
|
||||
.editor-header {
|
||||
padding: 8px 12px;
|
||||
}
|
||||
.editor-title {
|
||||
max-width: 160px;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
.editor-container {
|
||||
padding: 76px 10px 140px;
|
||||
}
|
||||
.editor-actions .btn-preview-text {
|
||||
display: none;
|
||||
}
|
||||
.sticky-bottom-bar {
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
padding: 10px 14px;
|
||||
}
|
||||
.sticky-bottom-bar .bottom-actions {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
.sticky-bottom-bar .bottom-actions button {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Top Header -->
|
||||
<header class="editor-header">
|
||||
<div class="d-flex items-center gap-16">
|
||||
<button class="btn btn-ghost btn-sm" onclick="closeEditor()">✕ ปิด</button>
|
||||
<div class="flex items-center gap-3 overflow-hidden">
|
||||
<button class="btn btn-ghost btn-sm text-slate-600 hover:text-slate-900" onclick="closeEditor()" title="ปิดหน้าแก้ไข">
|
||||
<i class="fas fa-times"></i> <span class="hidden sm:inline">ปิด</span>
|
||||
</button>
|
||||
<div class="editor-title" id="surveyTitleDisplay">กำลังโหลด...</div>
|
||||
</div>
|
||||
<div class="editor-actions">
|
||||
<button class="btn btn-ghost" onclick="previewSurvey()">👁️ พรีวิว</button>
|
||||
<button class="btn btn-primary" onclick="saveSurvey()">💾 บันทึกการเปลี่ยนแปลง</button>
|
||||
<button class="btn btn-ghost btn-sm text-blue-600 hover:bg-blue-50 font-bold border border-blue-200" onclick="previewSurvey()">
|
||||
👁️ <span class="btn-preview-text">พรีวิว</span>
|
||||
</button>
|
||||
<button id="saveSurveyBtnTop" class="btn btn-primary btn-sm font-bold shadow-md bg-blue-600 hover:bg-blue-700 text-white" onclick="saveSurvey()">
|
||||
💾 บันทึกการแก้ไข
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Main Content -->
|
||||
<main class="editor-container">
|
||||
<div id="editorContent">
|
||||
<div class="loading" style="padding: 100px 0;">
|
||||
<div class="loading" style="padding: 100px 0; text-align:center;">
|
||||
<div class="spinner"></div>
|
||||
<p>กำลังโหลดข้อมูลแบบสอบถาม...</p>
|
||||
<p class="text-slate-500 mt-4 font-bold">กำลังโหลดข้อมูลแบบสอบถาม...</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center mt-40">
|
||||
<button class="btn btn-secondary" onclick="addSection()">➕ เพิ่มโพลล์ส่วนใหม่</button>
|
||||
<div class="text-center mt-32 mb-40">
|
||||
<button class="btn btn-secondary font-bold px-6 py-3 shadow-sm hover:shadow" onclick="addSection()">
|
||||
➕ เพิ่มส่วนแบบสอบถามใหม่
|
||||
</button>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script src="js/app.js?v=5"></script>
|
||||
<script src="js/editor.js?v=5"></script>
|
||||
<!-- Sticky Bottom Bar -->
|
||||
<div class="sticky-bottom-bar">
|
||||
<div class="flex items-center gap-4">
|
||||
<span id="saveStatusIndicator" class="dirty-badge" style="display:none;">
|
||||
<span class="w-2.5 h-2.5 rounded-full bg-amber-500 animate-pulse"></span>
|
||||
มีการแก้ไขที่ยังไม่ได้บันทึก (กด Ctrl+S เพื่อบันทึก)
|
||||
</span>
|
||||
</div>
|
||||
<div class="bottom-actions flex items-center gap-3">
|
||||
<button class="btn btn-secondary font-bold text-sm px-4 py-2" onclick="previewSurvey()">
|
||||
👁️ พรีวิวแบบสอบถาม
|
||||
</button>
|
||||
<button id="saveSurveyBtnBottom" class="btn btn-primary font-bold text-sm px-6 py-2.5 shadow-lg bg-blue-600 hover:bg-blue-700 text-white" onclick="saveSurvey()">
|
||||
💾 บันทึกการเปลี่ยนแปลง
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="js/app.js?v=6"></script>
|
||||
<script src="js/editor.js?v=6"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user