summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Robinson <joe@lc8n.com>2019-02-17 02:26:06 +0000
committerJoe Robinson <joe@lc8n.com>2019-02-17 02:26:06 +0000
commitb1391deafa2f12aeac771c46788e152b0c0ea9b5 (patch)
tree6de2787b0bf92e6d7b8b860b2a65ab6b70760a71
parent1ca5df34ed0cc6705f7fe3fc697c5b10734808ef (diff)
Add template
-rw-r--r--scarecrow.rb10
-rw-r--r--views/index.erb15
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>