summaryrefslogtreecommitdiff
path: root/lib/lsg_web/templates/alcoolog/index.html.eex
diff options
context:
space:
mode:
authorhref <href@random.sh>2020-07-07 21:39:10 +0200
committerhref <href@random.sh>2020-07-07 21:39:51 +0200
commitd6ee134a5957e299c3ad59011df320b3c41e6e61 (patch)
tree29567e6635466f8a3415a935b3cc8a777019f5bc /lib/lsg_web/templates/alcoolog/index.html.eex
parentbleh (diff)
pouet
Diffstat (limited to 'lib/lsg_web/templates/alcoolog/index.html.eex')
-rw-r--r--lib/lsg_web/templates/alcoolog/index.html.eex61
1 files changed, 32 insertions, 29 deletions
diff --git a/lib/lsg_web/templates/alcoolog/index.html.eex b/lib/lsg_web/templates/alcoolog/index.html.eex
index 507be71..e656e64 100644
--- a/lib/lsg_web/templates/alcoolog/index.html.eex
+++ b/lib/lsg_web/templates/alcoolog/index.html.eex
@@ -1,16 +1,12 @@
<style type="text/css">
-h1 small {
- font-size: 14px;
-}
ol li {
margin-bottom: 5px
}
</style>
-<h1>
- <small><a href="/irc"><%= Keyword.get(Application.get_env(:lsg, :irc), :name, "ircbot") %></a> &rsaquo; </small><br/>
- alcoolog <%= @channel %>
-</h1>
+<%= if @stats == [] do %>
+ </strong><i>:o personne ne boit</i></strong>
+<% end %>
<ul>
<%= for {nick, status} <- @stats do %>
@@ -28,28 +24,35 @@ ol li {
<% end %>
</ul>
-<p>
- top consommateur par volume, les 7 derniers jours: <%= Enum.intersperse(for({nick, count} <- @top, do: "#{nick}: #{Float.round(count,4)}"), ", ") %>
-</p>
+<%= if @stats == %{} do %>
+ <strong><i>... et personne n'a bu :o :o :o</i></strong>
+<% else %>
+ <p>
+ top consommateur par volume, les 7 derniers jours: <%= Enum.intersperse(for({nick, count} <- @top, do: "#{nick}: #{Float.round(count,4)}"), ", ") %>
+ </p>
-<table class="table">
- <thead>
- <tr>
- <th scope="col">date</th>
- <th scope="col">nick</th>
- <th scope="col">points</th>
- <th scope="col">nom</th>
- </tr>
- </thead>
- <tbody>
- <%= for {{nick, date}, points, _, nom, comment} <- @drinks do %>
- <% date = DateTime.from_unix!(date, :millisecond) %>
- <th scope="row"><%= LSGWeb.LayoutView.format_time(date, false) %></th>
- <td><%= nick %></td>
- <td><%= Float.round(points+0.0, 5) %></td>
- <td><%= nom||"" %> <%= comment||"" %></td>
+ <table class="table">
+ <thead>
+ <tr>
+ <th scope="col">date</th>
+ <th scope="col">nick</th>
+ <th scope="col">points</th>
+ <th scope="col">nom</th>
</tr>
- <% end %>
- </tbody>
-</table>
+ </thead>
+ <tbody>
+ <%= for {{{account, date}, points, _, nom, comment}, nick} <- @drinks do %>
+ <% date = DateTime.from_unix!(date, :millisecond) %>
+ <th scope="row"><%= LSGWeb.LayoutView.format_time(date, false) %></th>
+ <td><%= nick %></td>
+ <td><%= Float.round(points+0.0, 5) %></td>
+ <td><%= nom||"" %> <%= comment||"" %></td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+<% end %>
+<%= if @conn.assigns.account && (@network || @channel) do %>
+ <%= link("alcoolog global", to: alcoolog_path(@conn, :index)) %>
+<% end %>