Refactor get_artikel*() functions/sql

This commit is contained in:
Thelonius Kort
2023-02-28 21:42:05 +01:00
parent fc0818678c
commit b87b54ec71
3 changed files with 27 additions and 12 deletions

View File

@ -13,7 +13,8 @@ defmodule OutlookWeb.ArtikelController do
{:ok, artikel} -> render(conn, :show, artikel: artikel, page_title: artikel.title)
{:error, message} -> conn
|> put_status(404)
|> render(OutlookWeb.ErrorHTML, "404.html")
|> put_view(OutlookWeb.ErrorHTML)
|> render("404.html")
|> halt()
end
end

View File

@ -1,10 +1,10 @@
<header class="mb-6">
<h1 class="text-lg font-semibold leading-tight text-stone-800 dark:text-stone-200"><%= @artikel.title %></h1>
<p class="my-2"><.link href={"/autoren/#{@artikel.article.author.id}"}><%= @artikel.article.author.name %></.link>
&nbsp;&nbsp;&nbsp; — &nbsp;&nbsp;&nbsp;<%= Calendar.strftime(@artikel.article.date, "%d.%m.%Y") %></p>
<p class="my-2"><.link href={~p"/autoren/#{@artikel.author_id}"}><%= @artikel.author %></.link>
&nbsp;&nbsp;&nbsp; — &nbsp;&nbsp;&nbsp;<%= Calendar.strftime(@artikel.date_org, "%d.%m.%Y") %></p>
<div>Original Artikel:
<.link class="hover:text-sky-700" href={@artikel.article.url} >
<%= @artikel.article.title %>
<.link class="hover:text-sky-700" href={@artikel.url_org} >
<%= @artikel.title_org %>
</.link><br>
</div>
<div class="my-2">
@ -14,4 +14,4 @@
<div class="article w-full mx-auto max-w-xs"><%= @artikel.public_content |> raw %></div>
<.back navigate={~p"/autoren/#{@artikel.article.author}"}>Back to Autor</.back>
<.back navigate={~p"/autoren/#{@artikel.author_id}"}>Back to Autor</.back>