From cc4930c1209bbcc0baafd2053d67f319e768dcb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=20Mar=C3=ADa=20Mart=C3=ADnez=20G=C3=B3mez?= Date: Wed, 21 Dec 2016 10:55:56 +0100 Subject: [PATCH] Avoid a Javascript error when @tag is null As it was pointed out in https://github.com/openSUSE/osem/pull/1142 if @tag is null there is an error in the Console when trying to take the user to the current day and time. --- app/views/schedules/events.html.haml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/schedules/events.html.haml b/app/views/schedules/events.html.haml index 24092ec2..8680d3c3 100644 --- a/app/views/schedules/events.html.haml +++ b/app/views/schedules/events.html.haml @@ -61,5 +61,8 @@ // Go to current date and time $(document).ready(function(){ - document.getElementById("#{ @tag }").scrollIntoView(); + tag = "#{ @tag }"; + if(tag !== ""){ + document.getElementById(tag).scrollIntoView(); + } });