askrobots / dbbasic-forms
Public
A form builder that keeps forms and responses in TSV files: git-friendly, no database, CSV export.
editor.html · 12.4 KB · 328 lines
| 1 | <!DOCTYPE html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="UTF-8"> |
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 6 | <title>Form Editor - dbbasic-forms</title> |
| 7 | <link rel="stylesheet" href="../../static/css/admin.css"> |
| 8 | <style> |
| 9 | .editor-container { |
| 10 | display: grid; |
| 11 | grid-template-columns: 300px 1fr 350px; |
| 12 | gap: 1.5rem; |
| 13 | height: calc(100vh - 60px); |
| 14 | } |
| 15 | |
| 16 | .field-palette { |
| 17 | background: var(--surface); |
| 18 | border-right: 1px solid var(--border); |
| 19 | padding: 1.5rem; |
| 20 | overflow-y: auto; |
| 21 | } |
| 22 | |
| 23 | .field-type { |
| 24 | display: flex; |
| 25 | align-items: center; |
| 26 | gap: 0.75rem; |
| 27 | padding: 0.875rem; |
| 28 | background: var(--bg); |
| 29 | border: 1px solid var(--border); |
| 30 | border-radius: 0.375rem; |
| 31 | margin-bottom: 0.75rem; |
| 32 | cursor: move; |
| 33 | transition: all 0.15s; |
| 34 | } |
| 35 | |
| 36 | .field-type:hover { |
| 37 | border-color: var(--primary); |
| 38 | transform: translateY(-1px); |
| 39 | } |
| 40 | |
| 41 | .field-icon { |
| 42 | font-size: 1.25rem; |
| 43 | } |
| 44 | |
| 45 | .form-canvas { |
| 46 | padding: 2rem; |
| 47 | overflow-y: auto; |
| 48 | } |
| 49 | |
| 50 | .form-preview { |
| 51 | max-width: 600px; |
| 52 | margin: 0 auto; |
| 53 | background: var(--surface); |
| 54 | border: 1px solid var(--border); |
| 55 | border-radius: 0.5rem; |
| 56 | padding: 2rem; |
| 57 | } |
| 58 | |
| 59 | .form-field { |
| 60 | margin-bottom: 1.5rem; |
| 61 | padding: 1rem; |
| 62 | border: 2px dashed transparent; |
| 63 | border-radius: 0.375rem; |
| 64 | transition: all 0.15s; |
| 65 | } |
| 66 | |
| 67 | .form-field:hover { |
| 68 | border-color: var(--primary); |
| 69 | background: var(--bg); |
| 70 | } |
| 71 | |
| 72 | .form-field.selected { |
| 73 | border-color: var(--primary); |
| 74 | background: #eff6ff; |
| 75 | } |
| 76 | |
| 77 | .field-actions { |
| 78 | display: flex; |
| 79 | gap: 0.5rem; |
| 80 | margin-top: 0.5rem; |
| 81 | opacity: 0; |
| 82 | transition: opacity 0.15s; |
| 83 | } |
| 84 | |
| 85 | .form-field:hover .field-actions { |
| 86 | opacity: 1; |
| 87 | } |
| 88 | |
| 89 | .properties-panel { |
| 90 | background: var(--surface); |
| 91 | border-left: 1px solid var(--border); |
| 92 | padding: 1.5rem; |
| 93 | overflow-y: auto; |
| 94 | } |
| 95 | |
| 96 | .empty-canvas { |
| 97 | text-align: center; |
| 98 | padding: 4rem 2rem; |
| 99 | color: var(--text-muted); |
| 100 | } |
| 101 | |
| 102 | .drop-zone { |
| 103 | border: 2px dashed var(--border); |
| 104 | border-radius: 0.5rem; |
| 105 | padding: 2rem; |
| 106 | text-align: center; |
| 107 | color: var(--text-muted); |
| 108 | } |
| 109 | </style> |
| 110 | </head> |
| 111 | <body> |
| 112 | <div class="studio-container"> |
| 113 | <header class="studio-header"> |
| 114 | <div class="logo"> |
| 115 | <a href="list.html" style="display: flex; align-items: center; gap: 0.5rem; text-decoration: none; color: inherit;"> |
| 116 | <span class="logo-icon">📋</span> |
| 117 | <span class="logo-text">dbbasic-forms</span> |
| 118 | </a> |
| 119 | </div> |
| 120 | <div style="flex: 1; text-align: center;"> |
| 121 | <input type="text" value="Contact Form" style="font-size: 1.125rem; font-weight: 600; border: none; background: transparent; text-align: center; padding: 0.5rem;"> |
| 122 | </div> |
| 123 | <div class="header-actions"> |
| 124 | <button class="btn-secondary">Preview</button> |
| 125 | <button class="btn-primary">Save & Publish</button> |
| 126 | </div> |
| 127 | </header> |
| 128 | |
| 129 | <div class="editor-container"> |
| 130 | <!-- Left: Field Palette --> |
| 131 | <div class="field-palette"> |
| 132 | <h3 style="margin-bottom: 1rem;">Add Fields</h3> |
| 133 | |
| 134 | <div class="field-type"> |
| 135 | <span class="field-icon">📝</span> |
| 136 | <div> |
| 137 | <div style="font-weight: 500; font-size: 0.875rem;">Short Text</div> |
| 138 | <div style="font-size: 0.75rem; color: var(--text-muted);">Single line input</div> |
| 139 | </div> |
| 140 | </div> |
| 141 | |
| 142 | <div class="field-type"> |
| 143 | <span class="field-icon">📧</span> |
| 144 | <div> |
| 145 | <div style="font-weight: 500; font-size: 0.875rem;">Email</div> |
| 146 | <div style="font-size: 0.75rem; color: var(--text-muted);">Email validation</div> |
| 147 | </div> |
| 148 | </div> |
| 149 | |
| 150 | <div class="field-type"> |
| 151 | <span class="field-icon">📄</span> |
| 152 | <div> |
| 153 | <div style="font-weight: 500; font-size: 0.875rem;">Long Text</div> |
| 154 | <div style="font-size: 0.75rem; color: var(--text-muted);">Multi-line textarea</div> |
| 155 | </div> |
| 156 | </div> |
| 157 | |
| 158 | <div class="field-type"> |
| 159 | <span class="field-icon">🔢</span> |
| 160 | <div> |
| 161 | <div style="font-weight: 500; font-size: 0.875rem;">Number</div> |
| 162 | <div style="font-size: 0.75rem; color: var(--text-muted);">Numeric input</div> |
| 163 | </div> |
| 164 | </div> |
| 165 | |
| 166 | <div class="field-type"> |
| 167 | <span class="field-icon">☑️</span> |
| 168 | <div> |
| 169 | <div style="font-weight: 500; font-size: 0.875rem;">Multiple Choice</div> |
| 170 | <div style="font-size: 0.75rem; color: var(--text-muted);">Radio buttons</div> |
| 171 | </div> |
| 172 | </div> |
| 173 | |
| 174 | <div class="field-type"> |
| 175 | <span class="field-icon">✅</span> |
| 176 | <div> |
| 177 | <div style="font-weight: 500; font-size: 0.875rem;">Checkboxes</div> |
| 178 | <div style="font-size: 0.75rem; color: var(--text-muted);">Multiple select</div> |
| 179 | </div> |
| 180 | </div> |
| 181 | |
| 182 | <div class="field-type"> |
| 183 | <span class="field-icon">📅</span> |
| 184 | <div> |
| 185 | <div style="font-weight: 500; font-size: 0.875rem;">Date</div> |
| 186 | <div style="font-size: 0.75rem; color: var(--text-muted);">Date picker</div> |
| 187 | </div> |
| 188 | </div> |
| 189 | |
| 190 | <div class="field-type"> |
| 191 | <span class="field-icon">📎</span> |
| 192 | <div> |
| 193 | <div style="font-weight: 500; font-size: 0.875rem;">File Upload</div> |
| 194 | <div style="font-size: 0.75rem; color: var(--text-muted);">Upload files</div> |
| 195 | </div> |
| 196 | </div> |
| 197 | </div> |
| 198 | |
| 199 | <!-- Center: Form Canvas --> |
| 200 | <div class="form-canvas"> |
| 201 | <div class="form-preview"> |
| 202 | <h2 style="margin-bottom: 0.5rem;">Contact Form</h2> |
| 203 | <p style="color: var(--text-muted); margin-bottom: 2rem;">Get in touch with us</p> |
| 204 | |
| 205 | <!-- Example Fields --> |
| 206 | <div class="form-field"> |
| 207 | <label style="display: block; font-weight: 500; margin-bottom: 0.5rem;"> |
| 208 | Name <span style="color: var(--danger);">*</span> |
| 209 | </label> |
| 210 | <input type="text" class="form-input" placeholder="Enter your name"> |
| 211 | <div class="field-actions"> |
| 212 | <button class="btn-secondary-small">Edit</button> |
| 213 | <button class="btn-secondary-small">Duplicate</button> |
| 214 | <button class="btn-danger-outline-small">Delete</button> |
| 215 | </div> |
| 216 | </div> |
| 217 | |
| 218 | <div class="form-field selected"> |
| 219 | <label style="display: block; font-weight: 500; margin-bottom: 0.5rem;"> |
| 220 | Email <span style="color: var(--danger);">*</span> |
| 221 | </label> |
| 222 | <input type="email" class="form-input" placeholder="you@example.com"> |
| 223 | <div style="font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem;"> |
| 224 | We'll never share your email |
| 225 | </div> |
| 226 | <div class="field-actions"> |
| 227 | <button class="btn-secondary-small">Edit</button> |
| 228 | <button class="btn-secondary-small">Duplicate</button> |
| 229 | <button class="btn-danger-outline-small">Delete</button> |
| 230 | </div> |
| 231 | </div> |
| 232 | |
| 233 | <div class="form-field"> |
| 234 | <label style="display: block; font-weight: 500; margin-bottom: 0.5rem;"> |
| 235 | Message |
| 236 | </label> |
| 237 | <textarea class="form-textarea" rows="4" placeholder="What's on your mind?"></textarea> |
| 238 | <div class="field-actions"> |
| 239 | <button class="btn-secondary-small">Edit</button> |
| 240 | <button class="btn-secondary-small">Duplicate</button> |
| 241 | <button class="btn-danger-outline-small">Delete</button> |
| 242 | </div> |
| 243 | </div> |
| 244 | |
| 245 | <!-- Drop Zone --> |
| 246 | <div class="drop-zone"> |
| 247 | <div style="font-size: 2rem; margin-bottom: 0.5rem;">📋</div> |
| 248 | <div>Drag fields here or click to add</div> |
| 249 | </div> |
| 250 | |
| 251 | <button class="btn-primary" style="margin-top: 1.5rem; width: 100%;">Submit</button> |
| 252 | </div> |
| 253 | </div> |
| 254 | |
| 255 | <!-- Right: Properties Panel --> |
| 256 | <div class="properties-panel"> |
| 257 | <h3 style="margin-bottom: 1rem;">Field Properties</h3> |
| 258 | |
| 259 | <div class="form-group"> |
| 260 | <label>Field Label</label> |
| 261 | <input type="text" class="form-input" value="Email"> |
| 262 | </div> |
| 263 | |
| 264 | <div class="form-group"> |
| 265 | <label>Placeholder</label> |
| 266 | <input type="text" class="form-input" value="you@example.com"> |
| 267 | </div> |
| 268 | |
| 269 | <div class="form-group"> |
| 270 | <label>Help Text</label> |
| 271 | <input type="text" class="form-input" value="We'll never share your email"> |
| 272 | </div> |
| 273 | |
| 274 | <div class="form-group"> |
| 275 | <label style="display: flex; align-items: center; gap: 0.5rem; cursor: pointer;"> |
| 276 | <input type="checkbox" checked> |
| 277 | <span>Required</span> |
| 278 | </label> |
| 279 | </div> |
| 280 | |
| 281 | <div class="form-group"> |
| 282 | <label>Field Type</label> |
| 283 | <select class="form-select"> |
| 284 | <option>Email</option> |
| 285 | <option>Text</option> |
| 286 | <option>Number</option> |
| 287 | <option>Date</option> |
| 288 | </select> |
| 289 | </div> |
| 290 | |
| 291 | <div class="form-group"> |
| 292 | <label>Validation</label> |
| 293 | <select class="form-select"> |
| 294 | <option>Email format</option> |
| 295 | <option>None</option> |
| 296 | <option>URL</option> |
| 297 | <option>Phone</option> |
| 298 | </select> |
| 299 | </div> |
| 300 | |
| 301 | <hr style="border: none; border-top: 1px solid var(--border); margin: 1.5rem 0;"> |
| 302 | |
| 303 | <h3 style="margin-bottom: 1rem;">Form Settings</h3> |
| 304 | |
| 305 | <div class="form-group"> |
| 306 | <label>Form Title</label> |
| 307 | <input type="text" class="form-input" value="Contact Form"> |
| 308 | </div> |
| 309 | |
| 310 | <div class="form-group"> |
| 311 | <label>Description</label> |
| 312 | <textarea class="form-textarea" rows="2">Get in touch with us</textarea> |
| 313 | </div> |
| 314 | |
| 315 | <div class="form-group"> |
| 316 | <label>Success Message</label> |
| 317 | <textarea class="form-textarea" rows="2">Thanks! We'll get back to you soon.</textarea> |
| 318 | </div> |
| 319 | |
| 320 | <div class="form-group"> |
| 321 | <label>Button Text</label> |
| 322 | <input type="text" class="form-input" value="Submit"> |
| 323 | </div> |
| 324 | </div> |
| 325 | </div> |
| 326 | </div> |
| 327 | </body> |
| 328 | </html> |