From 47aa8c15c112b9968a0c5e839bf4317899a669f2 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 29 Aug 2026 11:47:18 +0000 Subject: [PATCH] Wire up the "Add a second version" button MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #btnAddForm existed in the markup, its label updated dynamically by renderForms() ("+ Add version C", etc.), and its supporting helpers (nextFormLetter, unusedCode, the remove-version button) were all in place — but nothing ever attached a click handler to it. Clicking "+ Add a second version" did nothing. Wires it the same way btnAddWritten is wired: push a new form (next letter, next unused code, empty key) into editing.forms and re-render. Rebuilt QuickGrade.html and sw.js via `python build.py` to keep the single-file build in sync. --- QuickGrade.html | 5 +++++ js/app.js | 5 +++++ sw.js | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/QuickGrade.html b/QuickGrade.html index 9e468cc..de92e88 100644 --- a/QuickGrade.html +++ b/QuickGrade.html @@ -27429,6 +27429,11 @@

Grading scale

editing.written.push({ label: '', max: 5, kind: 'short', expected: '' }); renderWrittenList(); }); + on($('#btnAddForm'), 'click', function () { + editing.forms = editing.forms || []; + editing.forms.push({ id: nextFormLetter(), code: unusedCode(), key: [], rules: {} }); + renderForms(); + }); ['#f_mcCount', '#f_choices'].forEach(function (sel) { on($(sel), 'change', function () { editing.mc.count = Q.clamp(parseInt($('#f_mcCount').value, 10) || 0, 0, 300); diff --git a/js/app.js b/js/app.js index 1dc8a4f..92cb198 100644 --- a/js/app.js +++ b/js/app.js @@ -3484,6 +3484,11 @@ function wireUI() { editing.written.push({ label: '', max: 5, kind: 'short', expected: '' }); renderWrittenList(); }); + on($('#btnAddForm'), 'click', function () { + editing.forms = editing.forms || []; + editing.forms.push({ id: nextFormLetter(), code: unusedCode(), key: [], rules: {} }); + renderForms(); + }); ['#f_mcCount', '#f_choices'].forEach(function (sel) { on($(sel), 'change', function () { editing.mc.count = Q.clamp(parseInt($('#f_mcCount').value, 10) || 0, 0, 300); diff --git a/sw.js b/sw.js index 5c8e797..b308459 100644 --- a/sw.js +++ b/sw.js @@ -15,7 +15,7 @@ * a stale name ships an update nobody receives, and a stale list leaves a * file the app needs simply missing when offline. */ -var CACHE = 'quickgrade-c996e665524d'; +var CACHE = 'quickgrade-462da285317f'; var SHELL = [ './', './index.html',