design: Nubes design system — logo, favicon in assets/, card layout, brand colors
This commit is contained in:
@@ -85,74 +85,191 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>CRUD — <cfoutput>#tableName#</cfoutput></title>
|
||||
<link rel="icon" type="image/svg+xml" href="assets/favicon.svg" />
|
||||
<style>
|
||||
body { font-family: sans-serif; max-width: 600px; margin: 40px auto; }
|
||||
table { border-collapse: collapse; width: 100%; margin-bottom: 20px; }
|
||||
th, td { border: 1px solid #ccc; padding: 8px; text-align: left; }
|
||||
th { background: #f5f5f5; }
|
||||
form { margin-bottom: 20px; }
|
||||
input, button { padding: 6px 10px; margin: 2px; }
|
||||
.actions a { margin: 0 4px; }
|
||||
:root {
|
||||
--brand-primary: #2563eb;
|
||||
--brand-primary-dark: #1d4ed8;
|
||||
--brand-gray: #d1d5db;
|
||||
--brand-grey-light: #f3f4f6;
|
||||
--brand-destructive: #ef4444;
|
||||
--brand-success: #22c55e;
|
||||
--text-primary: #1a1a1a;
|
||||
--text-muted: #6b7280;
|
||||
--bg-card: #ffffff;
|
||||
--radius: 12px;
|
||||
}
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body {
|
||||
font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
|
||||
font-size: 14px;
|
||||
color: var(--text-primary);
|
||||
background: var(--brand-grey-light);
|
||||
min-height: 100vh;
|
||||
padding: 40px 16px;
|
||||
}
|
||||
.container { max-width: 720px; margin: 0 auto; }
|
||||
|
||||
/* Header */
|
||||
.header {
|
||||
display: flex; align-items: center; gap: 12px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
.header img { height: 36px; }
|
||||
.header h1 { font-size: 20px; font-weight: 600; color: #001C34; }
|
||||
|
||||
/* Card */
|
||||
.card {
|
||||
background: var(--bg-card);
|
||||
border-radius: var(--radius);
|
||||
border: 1px solid var(--brand-gray);
|
||||
box-shadow: 0 1px 2px rgba(0,0,0,0.05);
|
||||
overflow: hidden;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.card-header {
|
||||
background: var(--brand-grey-light);
|
||||
padding: 12px 16px;
|
||||
font-weight: 600;
|
||||
font-size: 16px;
|
||||
}
|
||||
.card-body { padding: 16px; }
|
||||
|
||||
/* Table */
|
||||
table { width: 100%; border-collapse: collapse; }
|
||||
th {
|
||||
background: var(--brand-grey-light);
|
||||
text-transform: uppercase;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: var(--text-muted);
|
||||
padding: 8px 12px;
|
||||
text-align: left;
|
||||
border-right: 1px solid var(--brand-gray);
|
||||
}
|
||||
th:last-child { border-right: none; text-align: center; width: 80px; }
|
||||
td {
|
||||
padding: 8px 12px;
|
||||
border-bottom: 1px solid var(--brand-gray);
|
||||
border-right: 1px solid var(--brand-gray);
|
||||
}
|
||||
td:last-child { border-right: none; text-align: center; }
|
||||
tr:hover { background: rgba(243,244,246,0.5); }
|
||||
tr:last-child td { border-bottom: none; }
|
||||
|
||||
/* Buttons */
|
||||
.btn {
|
||||
display: inline-flex; align-items: center; gap: 4px;
|
||||
height: 32px; padding: 0 12px;
|
||||
border: 1px solid var(--brand-gray);
|
||||
border-radius: 6px;
|
||||
background: var(--bg-card);
|
||||
font-size: 14px; font-family: inherit;
|
||||
cursor: pointer; white-space: nowrap;
|
||||
}
|
||||
.btn:hover { background: var(--brand-grey-light); }
|
||||
.btn-primary {
|
||||
background: var(--brand-primary); color: #fff; border-color: var(--brand-primary);
|
||||
}
|
||||
.btn-primary:hover { background: var(--brand-primary-dark); }
|
||||
.btn-destructive { background: var(--brand-destructive); color: #fff; border-color: var(--brand-destructive); }
|
||||
.btn-destructive:hover { opacity: 0.9; }
|
||||
.btn-sm { height: 28px; padding: 0 8px; font-size: 13px; }
|
||||
|
||||
/* Form */
|
||||
.form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: 12px;
|
||||
}
|
||||
.form-row {
|
||||
display: flex; gap: 8px; align-items: flex-end;
|
||||
}
|
||||
.form-row input { flex: 1; }
|
||||
input[type="text"] {
|
||||
height: 36px; padding: 0 12px;
|
||||
border: 1px solid var(--brand-gray);
|
||||
border-radius: 6px; font-size: 14px; font-family: inherit;
|
||||
}
|
||||
input[type="text"]:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.15); }
|
||||
|
||||
/* Action links */
|
||||
.icon-link { text-decoration: none; font-size: 18px; cursor: pointer; }
|
||||
.icon-link:hover { opacity: 0.7; }
|
||||
.empty-cell { color: var(--text-muted); padding: 24px; text-align: center; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
|
||||
<h1><cfoutput>#tableName#</cfoutput></h1>
|
||||
<div class="header">
|
||||
<img src="assets/logo.svg" alt="Nubes" />
|
||||
<h1><cfoutput>#tableName#</cfoutput></h1>
|
||||
</div>
|
||||
|
||||
<!--- Таблица записей --->
|
||||
<table>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Value</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<!--- cfoutput query="rows" — цикл по всем строкам результата SELECT --->
|
||||
<cfoutput query="rows">
|
||||
<tr>
|
||||
<td>#id#</td>
|
||||
<td>#value#</td>
|
||||
<td class="actions">
|
||||
<!--- Ссылка на редактирование: index.cfm?edit={id} --->
|
||||
<a href="index.cfm?edit=#id#">✏️</a>
|
||||
<!--- Форма удаления: POST с action=delete и id записи.
|
||||
JS confirm() — защита от случайного удаления. --->
|
||||
<form method="post" style="display:inline">
|
||||
<input type="hidden" name="action" value="delete" />
|
||||
<input type="hidden" name="id" value="#id#" />
|
||||
<button type="submit" onclick="return confirm('Удалить #id#?')">🗑️</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
<!--- Если записей нет — показываем информационное сообщение --->
|
||||
<cfif rows.recordCount EQ 0>
|
||||
<tr><td colspan="3">Нет записей. Создайте первую.</td></tr>
|
||||
</cfif>
|
||||
</table>
|
||||
<div class="card">
|
||||
<div class="card-header">Записи</div>
|
||||
<div class="card-body" style="padding: 0;">
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th>ID</th><th>Value</th><th></th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<cfoutput query="rows">
|
||||
<tr>
|
||||
<td>#id#</td>
|
||||
<td>#value#</td>
|
||||
<td>
|
||||
<a href="index.cfm?edit=#id#" class="icon-link" title="Редактировать">✏️</a>
|
||||
<form method="post" style="display:inline">
|
||||
<input type="hidden" name="action" value="delete" />
|
||||
<input type="hidden" name="id" value="#id#" />
|
||||
<button type="submit" class="btn btn-destructive btn-sm" onclick="return confirm('Удалить #id#?')">🗑️</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
</tbody>
|
||||
</table>
|
||||
<cfif rows.recordCount EQ 0>
|
||||
<div class="empty-cell">Нет записей. Создайте первую.</div>
|
||||
</cfif>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- ====== ФОРМА: редактирование ИЛИ добавление ====== --->
|
||||
<!--- structIsEmpty(editRow) — true если нет записи для редактирования → показываем форму ДОБАВЛЕНИЯ --->
|
||||
<!--- false если URL.edit задан и запись найдена → показываем форму РЕДАКТИРОВАНИЯ --->
|
||||
<cfif NOT structIsEmpty(editRow)>
|
||||
<!--- cfoutput нужен чтобы #editRow.id# и #editRow.value# вычислились --->
|
||||
<cfoutput>
|
||||
<h2>Редактировать #editRow.id#</h2>
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="id" value="#editRow.id#" />
|
||||
<!--- type="text" — позволяет вводить любые символы, не только цифры --->
|
||||
<input type="text" name="value" value="#editRow.value#" required />
|
||||
<button type="submit">Сохранить</button>
|
||||
<a href="index.cfm">Отмена</a>
|
||||
</form>
|
||||
</cfoutput>
|
||||
<cfelse>
|
||||
<h2>Добавить</h2>
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="create" />
|
||||
<!--- placeholder — подсказка в пустом поле --->
|
||||
<input type="text" name="value" placeholder="Значение" required />
|
||||
<button type="submit">Добавить</button>
|
||||
<div class="card">
|
||||
<cfif NOT structIsEmpty(editRow)>
|
||||
<cfoutput>
|
||||
<div class="card-header">Редактировать ##editRow.id#</div>
|
||||
<div class="card-body">
|
||||
<form method="post" class="form-grid">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="id" value="#editRow.id#" />
|
||||
<div class="form-row">
|
||||
<input type="text" name="value" value="#editRow.value#" required placeholder="Значение" />
|
||||
<button type="submit" class="btn btn-primary">Сохранить</button>
|
||||
<a href="index.cfm" class="btn">Отмена</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</cfoutput>
|
||||
<cfelse>
|
||||
<div class="card-header">Добавить</div>
|
||||
<div class="card-body">
|
||||
<form method="post" class="form-grid">
|
||||
<input type="hidden" name="action" value="create" />
|
||||
<div class="form-row">
|
||||
<input type="text" name="value" placeholder="Значение" required />
|
||||
<button type="submit" class="btn btn-primary">Добавить</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</cfif>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</form>
|
||||
</cfif>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user