diff options
-rw-r--r-- | scarecrow.rb | 10 | ||||
-rw-r--r-- | views/index.erb | 15 |
2 files changed, 20 insertions, 5 deletions
diff --git a/scarecrow.rb b/scarecrow.rb index defc135..b1043fe 100644 --- a/scarecrow.rb +++ b/scarecrow.rb @@ -67,13 +67,13 @@ end get '/' do # send_file File.join(settings.public_folder, 'index.html') - temp_val = Temperature.last[:value] - humidity_val = Humidity.last[:value] + @temp_val = Temperature.last[:value] + @humidity_val = Humidity.last[:value] temp_time = Temperature.last[:timestamp] humidity_time = Humidity.last[:timestamp] - time_formatted = temp_time.strftime("%A, %d %b %Y %l:%M %p") - - return "#{temp_val}°C and #{humidity_val}% humidity at #{time_formatted}" + @time_formatted = temp_time.strftime("%A, %d %b %Y %l:%M %p") + erb :index + # return "#{temp_val}°C and #{humidity_val}% humidity at #{time_formatted}" end get '/temperature' do diff --git a/views/index.erb b/views/index.erb new file mode 100644 index 0000000..8449835 --- /dev/null +++ b/views/index.erb @@ -0,0 +1,15 @@ +<html> + <head> + <title> + The Scarecrow Watches Over The Garden + </title> + </head> + <body> + <h1>thebluegarden</h1> + + <p><%= @temp_val %>°C and <%= @humidity_val %>% humidity at <%= @time_formatted %></p> + <p> + <img src="photos/current.png"> + </p> + </body> +</html> |