Only send sources when there are sources to send

pull/453/head
Uku Taht 6 years ago
parent 49c3fa5650
commit 7f9525e805

@ -1,24 +1,26 @@
There are currently <%= @current_visitors %> visitors on <%= link(@site.domain, to: "https://" <> @site.domain) %>.
<br />
<br />
The top 3 sources for current visitors:<br />
<%= if Enum.count(@sources) > 0 do %>
The top 3 sources for current visitors:<br />
<table width="100%" cellpadding="0" cellspacing="0" style="max-width: 400px;">
<thead>
<tr>
<th scope="col"><b>Page</b></th>
<th scope="col"><b>Visitors</b></th>
</tr>
</thead>
<tbody>
<%= for %{"name" => source, "count" => visitors} <- @sources do %>
<table width="100%" cellpadding="0" cellspacing="0" style="max-width: 400px;">
<thead>
<tr>
<td valign="top"><%= source %></td>
<td valign="top"><%= visitors %></td>
<th scope="col"><b>Page</b></th>
<th scope="col"><b>Visitors</b></th>
</tr>
<% end %>
</tbody>
</table>
</thead>
<tbody>
<%= for %{"name" => source, "count" => visitors} <- @sources do %>
<tr>
<td valign="top"><%= source %></td>
<td valign="top"><%= visitors %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<%= if @link do %>
<br /><br />

Loading…
Cancel
Save