From 3e1f51fa8c99b4d205e4fd5bb87f9ce013b887f6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 29 May 2016 21:00:15 +0200 Subject: [PATCH] Show optional columns --- .../rhynodge/webpages/weather/WeatherTrigger.kt | 62 +++++++++++++++------- .../webpages/weather/WeatherTriggerTest.kt | 45 ++++++++++++++++ 2 files changed, 89 insertions(+), 18 deletions(-) diff --git a/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/WeatherTrigger.kt b/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/WeatherTrigger.kt index 4bc46d4..0522b02 100644 --- a/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/WeatherTrigger.kt +++ b/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/WeatherTrigger.kt @@ -50,33 +50,59 @@ class WeatherTrigger : Trigger { head { style("text/css") { unsafe { - +".hour-state { display: table-row; } " - +".hour-state > div { display: table-cell; padding-right: 1em; } " + +".weather-states { display: table; } " + +".hour-state, .header { display: table-row; } " + +".hour-state > div { display: table-cell; padding: 0em 0.5em; text-align: center; } " + +".header > div { display: table-cell; padding: 0em 0.5em; font-weight: bold; text-align: center; } " } } } body { val startTime = state.dateTime.toInstant() h1 { +"The Weather (according to wetter.de) on %s".format(dateFormatter.format(startTime.toEpochMilli())) } + val showFeltTemperature = state.any { it.feltTemperature != null } + val showGustSpeed = state.any { it.gustSpeed != null } + val showHumidity = state.any { it.humidity != null } state.forEach { - div("hour-state") { - div("time") { +"%tH:%