From 9d1751a331500a577e158ad73b3972130475bdf7 Mon Sep 17 00:00:00 2001 From: Kris Date: Sun, 31 Jan 2021 21:45:44 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9Fixed=20and=20improved=20timepicker?= =?UTF-8?q?=20form=20on=20stationboard=20(#196)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixed and improved timepicker form on stationboard * Formatting * Fixed invalid HTML * Update HelperMethodTest.php --- resources/js/appControls.js | 4 - resources/js/components/timepicker.js | 32 --- resources/views/layouts/app.blade.php | 324 ++++++++++++++----------- resources/views/stationboard.blade.php | 162 +++++++------ tests/Unit/HelperMethodTest.php | 3 +- 5 files changed, 265 insertions(+), 260 deletions(-) diff --git a/resources/js/appControls.js b/resources/js/appControls.js index 1a271ff99..da74f4238 100644 --- a/resources/js/appControls.js +++ b/resources/js/appControls.js @@ -144,7 +144,3 @@ $(document).on("click", ".disconnect", function (event) { } }); }); - -$(document).on("click", "#timepicker-button", function (event) { - event.preventDefault(); -}); diff --git a/resources/js/components/timepicker.js b/resources/js/components/timepicker.js index f1066cc2a..6bd02081b 100644 --- a/resources/js/components/timepicker.js +++ b/resources/js/components/timepicker.js @@ -23,37 +23,5 @@ if (document.getElementById("timepicker-reveal")) { reveal.add("opacity-null"); }, 1000); } - - document - .getElementById("timepicker-button") - .addEventListener("click", e => { - e.preventDefault(); - changeTime(); - }); - input.addEventListener("keyup", function(event) { - if (event.keyCode === 13) { - event.preventDefault(); - changeTime(); - } - }); - - const changeTime = () => { - input.classList.remove("is-invalid"); - - //This is so completely ugly. Mabe we should reconsider this with moment.js? - let splitDateTime = input.value.split("T"); - let splitDate = splitDateTime[0].split('-'); - let splitTime = splitDateTime[1].split(':'); - - let utcDate = Date.UTC(splitDate[0], splitDate[1]-1, splitDate[2], splitTime[0], splitTime[1], 0); - let offset = new Date(utcDate).getTimezoneOffset(); - let unixTimestamp = Math.floor((utcDate/1000)+(offset*60)); - - window.location = window.changeTimeLink - .replace("&", "&") - .replace("&", "&") - .replace("&", "&") - .replace("REPLACEME", unixTimestamp); - }; }); } diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 6810ec14f..43cf8ec95 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -10,7 +10,7 @@ @yield('title') - {{ config('app.name', 'Träwelling') }} - + @@ -41,174 +41,202 @@ -@yield('metadata') + @yield('metadata') -