From 50c6a09ff64cb081b27a0c30790b86873449d172 Mon Sep 17 00:00:00 2001 From: href Date: Sat, 17 Feb 2018 21:21:42 +0100 Subject: :) --- lib/lsg_web/controllers/irc_controller.ex | 11 ++++++++--- lib/lsg_web/templates/irc/index.html.eex | 15 +++++++++++++-- lib/lsg_web/templates/irc/txt.html.eex | 2 +- lib/lsg_web/templates/irc/txts.html.eex | 18 +++++++++++++++++- lib/lsg_web/templates/layout/app.html.eex | 1 + 5 files changed, 40 insertions(+), 7 deletions(-) (limited to 'lib/lsg_web') diff --git a/lib/lsg_web/controllers/irc_controller.ex b/lib/lsg_web/controllers/irc_controller.ex index a5a68f7..bff5476 100644 --- a/lib/lsg_web/controllers/irc_controller.ex +++ b/lib/lsg_web/controllers/irc_controller.ex @@ -2,9 +2,11 @@ defmodule LSGWeb.IrcController do use LSGWeb, :controller def index(conn, _) do + doc = LSG.IRC.TxtHandler.irc_doc() commands = for mod <- Application.get_env(:lsg, :irc)[:handlers] do mod.irc_doc() end + |> Enum.reject(fn(i) -> i == nil end) render conn, "index.html", commands: commands end @@ -12,13 +14,16 @@ defmodule LSGWeb.IrcController do def txt(conn, _), do: do_txt(conn, nil) defp do_txt(conn, nil) do - render conn, "txts.html", data: data() + doc = LSG.IRC.TxtHandler.irc_doc() + data = data() + lines = Enum.reduce(data, 0, fn({_, lines}, acc) -> acc + Enum.count(lines) end) + render conn, "txts.html", data: data, doc: doc, files: Enum.count(data), lines: lines end defp do_txt(conn, txt) do data = data() if Map.has_key?(data, txt) do - render(conn, "txt.html", name: txt, data: data[txt]) + render(conn, "txt.html", name: txt, data: data[txt], doc: nil) else conn |> put_status(404) @@ -26,7 +31,7 @@ defmodule LSGWeb.IrcController do end defp data() do - dir = Application.get_env(:lsg, LSG.IRC.TxtHandler)[:directory] + dir = Application.get_env(:lsg, :data_path) <> "/irc.txt/" Path.wildcard(dir <> "/*.txt") |> Enum.reduce(%{}, fn(path, m) -> path = String.split(path, "/") diff --git a/lib/lsg_web/templates/irc/index.html.eex b/lib/lsg_web/templates/irc/index.html.eex index 91873e6..c42d71f 100644 --- a/lib/lsg_web/templates/irc/index.html.eex +++ b/lib/lsg_web/templates/irc/index.html.eex @@ -1,7 +1,18 @@ -

bot `115ans

+ + +

+ 115ans.net
+irc 115ans

-Si vous cherchez l'IRC c'est par là. +Serveur IRC: irc.quakenet.org #lsg. + Matrix: #lsg:random.sh. +
+Webchat.
Statistiques.

diff --git a/lib/lsg_web/templates/irc/txt.html.eex b/lib/lsg_web/templates/irc/txt.html.eex index 4ffde50..e060e5f 100644 --- a/lib/lsg_web/templates/irc/txt.html.eex +++ b/lib/lsg_web/templates/irc/txt.html.eex @@ -8,7 +8,7 @@ ol li {

- irc.txt:
+ 115ans.netirctxt
<%= @name %>.txt

    diff --git a/lib/lsg_web/templates/irc/txts.html.eex b/lib/lsg_web/templates/irc/txts.html.eex index 7c96ed9..5039c29 100644 --- a/lib/lsg_web/templates/irc/txts.html.eex +++ b/lib/lsg_web/templates/irc/txts.html.eex @@ -1,4 +1,18 @@ -

    irc.txt

    + +

    115ans.netirc
    + txt

    + +

    <%= @lines %> lignes dans <%= @files %> fichiers.

    +
    <%= @doc |> Earmark.as_html! |> raw() %>
    + diff --git a/lib/lsg_web/templates/layout/app.html.eex b/lib/lsg_web/templates/layout/app.html.eex index 1c8f900..4c2ad44 100644 --- a/lib/lsg_web/templates/layout/app.html.eex +++ b/lib/lsg_web/templates/layout/app.html.eex @@ -2,6 +2,7 @@ + "> -- cgit v1.2.3