diff --git a/app/assets/admin-app.css b/app/assets/admin-app.css index ec07348..ce3a4f8 100644 --- a/app/assets/admin-app.css +++ b/app/assets/admin-app.css @@ -346,6 +346,25 @@ button { padding: 18px; } +.stack { + display: grid; + gap: 18px; +} + +.subhead, +.inline-actions { + display: flex; + align-items: center; + justify-content: space-between; + gap: 10px; +} + +.subhead h4 { + margin: 0; + color: #364257; + font-size: 15px; +} + .toolbar { display: flex; align-items: center; @@ -483,3 +502,24 @@ button { color: #245d5a; line-height: 1.7; } + +.upload-status { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 10px; +} + +.upload-status > div { + min-height: 70px; + display: grid; + gap: 6px; + align-content: center; + padding: 12px; + border: 1px solid var(--line); + border-radius: 8px; + background: var(--panel-soft); +} + +.upload-status strong { + word-break: break-word; +} diff --git a/app/assets/admin-app.js b/app/assets/admin-app.js index 1efe5f1..cd34596 100644 --- a/app/assets/admin-app.js +++ b/app/assets/admin-app.js @@ -25,8 +25,18 @@ courses: [], files: [], inquiries: [], + siteConfig: null, + homeSections: [], + competitions: [], + competitionSchedules: [], + uploadPolicy: null, + evaluation: null, editingWork: null, editingCourse: null, + editingHomeSection: null, + editingCompetition: null, + editingSchedule: null, + editingEvaluation: null, filters: { worksKeyword: "", worksStatus: "", @@ -78,7 +88,11 @@ } async function request(path, options) { - var response = await fetch(state.apiBase + path, Object.assign({}, options || {}, { headers: getHeaders(options && options.headers) })); + var requestOptions = Object.assign({}, options || {}); + var isFormData = typeof FormData !== "undefined" && requestOptions.body instanceof FormData; + var headers = getHeaders(options && options.headers); + if (isFormData) delete headers["Content-Type"]; + var response = await fetch(state.apiBase + path, Object.assign(requestOptions, { headers: headers })); var body = await response.json().catch(function () { return {}; }); @@ -96,37 +110,46 @@ return Object.fromEntries(new FormData(form).entries()); } + var fieldIdSeed = 0; + + function nextFieldId(name) { + fieldIdSeed += 1; + return "field-" + name + "-" + fieldIdSeed; + } + function field(name, label, value, type) { + var inputId = nextFieldId(name); return ( '