Skip to content

Commit

Permalink
show notificaiton when no devices are connected
Browse files Browse the repository at this point in the history
  • Loading branch information
bsamm committed Oct 11, 2020
1 parent 583c05a commit e1c38cb
Showing 1 changed file with 30 additions and 24 deletions.
54 changes: 30 additions & 24 deletions app/views/pages/home.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,37 @@
</section>
<section class="with-bumpers">
<div class="container">
<table class="table is-bordered">
<tr>
<th>Name</th>
<th>Last Heard</th>
<th>Led Status</th>
<th>Actions</th>
</tr>
<% @devices.each do |d| %>
<% if @devices.present? %>
<table class="table is-bordered">
<tr>
<td><%= d.attributes[:name] %></td>
<td><%= d.attributes[:last_heard] %></td>
<td>
<% if d.attributes[:led_status] == 1 %>
<span class="tag is-success">On</span>
<% else %>
<span class="tag is-danger">Off</span>
<% end %>
</td>
<td>
<div class="buttons">
<%= button_to 'Toggle Led', pages_toggle_led_path, method: :post, params: { device_name: d.attributes[:name] }, class: "button is-warning" %>
</div>
</td>
<th>Name</th>
<th>Last Heard</th>
<th>Led Status</th>
<th>Actions</th>
</tr>
<% end %>
</table>
<% @devices.each do |d| %>
<tr>
<td><%= d.attributes[:name] %></td>
<td><%= d.attributes[:last_heard] %></td>
<td>
<% if d.attributes[:led_status] == 1 %>
<span class="tag is-success">On</span>
<% else %>
<span class="tag is-danger">Off</span>
<% end %>
</td>
<td>
<div class="buttons">
<%= button_to 'Toggle Led', pages_toggle_led_path, method: :post, params: { device_name: d.attributes[:name] }, class: "button is-warning" %>
</div>
</td>
</tr>
<% end %>
</table>
<% else %>
<div class="notification">
There are no devices online at this time.
</div>
<% end %>
</div>
</section>

0 comments on commit e1c38cb

Please sign in to comment.