From a7c8e63b1101892a9df9ea3a242b2a340045be9c Mon Sep 17 00:00:00 2001 From: Hubert Van De Walle Date: Mon, 28 Sep 2020 18:29:07 +0200 Subject: [PATCH] Add radio input in order to select the export format --- app/src/main/kotlin/views/SettingView.kt | 27 +++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/app/src/main/kotlin/views/SettingView.kt b/app/src/main/kotlin/views/SettingView.kt index b39fc7d..530fda7 100644 --- a/app/src/main/kotlin/views/SettingView.kt +++ b/app/src/main/kotlin/views/SettingView.kt @@ -26,14 +26,31 @@ class SettingView(staticFileResolver: StaticFileResolver) : View(staticFileResol } } - section("m-4 p-4 bg-gray-800 rounded") { - p(classes = "mb-4") { - +"Export all my data" + section("m-4 p-4 bg-gray-800 rounded flex justify-around") { + + form(method = FormMethod.post, action = "/export") { + button(name = "display", + classes = "inline btn btn-teal block", + type = submit) { +"Display my data" } } form(method = FormMethod.post, action = "/export") { - button(name = "display", classes = "inline btn btn-teal block", type = submit) { +"Display my data" } - button(name = "download", classes = "inline btn btn-green block ml-2 mt-2", type = submit) { + + listOf("json", "zip").forEach { format -> + div { + radioInput(name = "format") { + id = format + attributes["value"] = format + if(format == "json") attributes["checked"] = "" + } + label(classes = "ml-2") { + attributes["for"] = format + +format + } + } + } + + button(name = "download", classes = "inline btn btn-green block mt-2", type = submit) { +"Download my data" } }