fix compilation error

This commit is contained in:
Ben Harris 2018-07-11 19:16:13 -04:00
parent a146455416
commit 3b89797dea
Signed by: ben
GPG Key ID: 4E0AF802FFF7960C
6 changed files with 10 additions and 9 deletions

View File

@ -5,6 +5,8 @@ defmodule Forum.Auth do
plug(Tesla.Middleware.FormUrlencoded) plug(Tesla.Middleware.FormUrlencoded)
def authenticate(user, pw) do def authenticate(user, pw) do
post("/", %{user: user, pw: pw}) {:ok , response} = post("/", %{user: user, pw: pw})
IO.inspect(response)
Jason.decode!(response.body)
end end
end end

View File

@ -49,7 +49,7 @@ defmodule Forum.Util do
def pp_time(time) do def pp_time(time) do
time time
|> Timex.local() |> Timex.local()
|> Timex.Format.DateTime.Formatter.format!("%a %b %e, %Y ~ %I:%M %P", :strftime) |> Timex.Format.DateTime.Formatter.format!("%b %e, %Y ~ %I:%M %P", :strftime)
|> String.downcase() |> String.downcase()
end end

View File

@ -10,9 +10,7 @@ defmodule ForumWeb.LoginController do
end end
def authenticate(conn, %{"username" => username, "password" => pw}) do def authenticate(conn, %{"username" => username, "password" => pw}) do
{:ok, response} = Auth.authenticate(username, pw) resp = Auth.authenticate(username, pw)
resp = Jason.decode!(response.body)
case resp["authenticated"] do case resp["authenticated"] do
false -> false ->

View File

@ -24,7 +24,6 @@ defmodule ForumWeb.ThreadController do
|> Repo.paginate(params) |> Repo.paginate(params)
{:ok, response} = Tesla.get("https://tilde.team/~ben/api/") {:ok, response} = Tesla.get("https://tilde.team/~ben/api/")
tagline = response.body
render( render(
conn, conn,
@ -32,7 +31,7 @@ defmodule ForumWeb.ThreadController do
stickies: stickies, stickies: stickies,
threads: threads, threads: threads,
kerosene: kerosene, kerosene: kerosene,
tagline: tagline tagline: response.body
) )
end end

View File

@ -75,7 +75,7 @@
<footer class="navbar-default navbar-fixed-bottom"> <footer class="navbar-default navbar-fixed-bottom">
<div class="container-fluid"> <div class="container-fluid">
<div class="text-center"> <div class="text-center">
<span><a href="https://tilde.team/">tilde.team</a> ~ <a href="https://github.com/tilde-team/forum">source on github</a></span> <span><a href="https://tilde.team/">tilde.team</a> ~ <a href="https://git.tilde.team/meta/forum">forum source</a></span>
</div> </div>
</div> </div>

View File

@ -5,7 +5,9 @@
<div class="panel-footer"> <div class="panel-footer">
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-8"> <div class="col-xs-12 col-md-8">
by: <a href="<%= user_path(@conn, :show, @thread.user.name) %>"><em>~<%= @thread.user.name %></em></a> // <small>created <%= @thread.inserted_at |> Util.pp_time %></small> by: <a href="<%= user_path(@conn, :show, @thread.user.name) %>"><em>~<%= @thread.user.name %></em></a>
// <small>created <%= @thread.inserted_at |> Util.pp_time %></small>
<!-- // <small>latest post by <%#= @thread.latest_post.user.name %> at <%#= @thread.latest_post.inserted_at |> Util.pp_time</small> %>-->
</div> </div>
<div class="col-xs-12 col-md-4 text-right"> <div class="col-xs-12 col-md-4 text-right">