From c83f66c38d369de0df8f611c14eb3b6cd20b6113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Sat, 18 May 2024 19:57:20 +0300 Subject: [PATCH] =?UTF-8?q?K=C3=A4ytt=C3=B6liittym=C3=A4=20luokkien=20lis?= =?UTF-8?q?=C3=A4=C3=A4miselle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 4 ++++ käyttöliittymä.js | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/index.html b/index.html index 10dcd6a..9f4305e 100644 --- a/index.html +++ b/index.html @@ -10,6 +10,10 @@
Luokat +
+ + +
diff --git a/käyttöliittymä.js b/käyttöliittymä.js index 454075f..3ef9713 100644 --- a/käyttöliittymä.js +++ b/käyttöliittymä.js @@ -4,6 +4,15 @@ document.getElementById('kumoa').addEventListener('click', () => { suorita(_tietokanta.kumoa()); }); +document.getElementById('luokat-uusi').addEventListener('submit', (e) => { + e.preventDefault(); + suorita(_tietokanta.transaktio((t) => { + const luokanNimi = document.getElementById('luokat-uusi-nimi').value; + t.lisää(taulut.luokat, luokanNimi) + document.getElementById('luokat-uusi-nimi').value = ''; + })); +}); + function suorita([tietokanta, muutokset]) { for (const muutos of muutokset) { suoritaMuutos(tietokanta, muutos);