Update design of public pages
This commit is contained in:
@ -89,6 +89,7 @@ defmodule OutlookWeb do
|
|||||||
import OutlookWeb.HtmlTreeComponent
|
import OutlookWeb.HtmlTreeComponent
|
||||||
import OutlookWeb.HtmlDocComponent
|
import OutlookWeb.HtmlDocComponent
|
||||||
import OutlookWeb.TunitEditorComponent
|
import OutlookWeb.TunitEditorComponent
|
||||||
|
import OutlookWeb.PublicComponents
|
||||||
import OutlookWeb.Gettext
|
import OutlookWeb.Gettext
|
||||||
|
|
||||||
# Shortcut for generating JS commands
|
# Shortcut for generating JS commands
|
||||||
|
|||||||
38
lib/outlook_web/components/public_components.ex
Normal file
38
lib/outlook_web/components/public_components.ex
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
defmodule OutlookWeb.PublicComponents do
|
||||||
|
@moduledoc """
|
||||||
|
Provides components for showing and listing artikel and autoren.
|
||||||
|
"""
|
||||||
|
use Phoenix.Component
|
||||||
|
import Phoenix.HTML
|
||||||
|
|
||||||
|
alias Phoenix.LiveView.JS
|
||||||
|
|
||||||
|
attr :autor, :any, required: true
|
||||||
|
|
||||||
|
def autor(assigns) do
|
||||||
|
~H"""
|
||||||
|
<a href={"/autoren/#{@autor.id}"}>
|
||||||
|
<div class="p-4 my-2 border rounded-lg border-slate-400 text-slate-800">
|
||||||
|
<div class="font-bold"><%= @autor.name %></div>
|
||||||
|
<div class=""><%= @autor.description %></div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
"""
|
||||||
|
end
|
||||||
|
|
||||||
|
attr :artikel, :any, required: true
|
||||||
|
attr :show_author, :boolean, default: true
|
||||||
|
|
||||||
|
def artikel(assigns) do
|
||||||
|
~H"""
|
||||||
|
<.link navigate={"/artikel/#{@artikel.id}"}>
|
||||||
|
<div class="my-2 px-2 rounded border-2 border-solid border-gray-300">
|
||||||
|
<h4 class="font-bold py-2"><%= @artikel.title %></h4>
|
||||||
|
<div :if={@show_author}><small><%= @artikel.article.author.name %></small></div>
|
||||||
|
<div><small><%= @artikel.date |> Calendar.strftime("%d.%m.%Y") %></small></div>
|
||||||
|
<div><%= @artikel.teaser |> raw %></div>
|
||||||
|
</div>
|
||||||
|
</.link>
|
||||||
|
"""
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -1,19 +1,2 @@
|
|||||||
<.header>
|
|
||||||
Listing Artikel
|
|
||||||
<:actions>
|
|
||||||
</:actions>
|
|
||||||
</.header>
|
|
||||||
|
|
||||||
<.table id="artikel" rows={@artikel} row_click={&JS.navigate(~p"/artikel/#{&1}")}>
|
<.artikel :for={artikel <- @artikel} artikel={artikel} />
|
||||||
<:col :let={artikel} label="Title"><%= artikel.title %></:col>
|
|
||||||
<:col :let={artikel} label="Teaser"><%= artikel.teaser %></:col>
|
|
||||||
<%!-- <:col :let={artikel} label="Translator"><%= artikel.translator %></:col> --%>
|
|
||||||
<:col :let={artikel} label="Unauthorized"><%= artikel.unauthorized %></:col>
|
|
||||||
<:col :let={artikel} label="Public content"><%= artikel.public_content %></:col>
|
|
||||||
<:col :let={artikel} label="Date"><%= Calendar.strftime(artikel.date, "%d.%m.%Y") %></:col>
|
|
||||||
<:action :let={artikel}>
|
|
||||||
<div class="sr-only">
|
|
||||||
<.link navigate={~p"/artikel/#{artikel}"}>Show</.link>
|
|
||||||
</div>
|
|
||||||
</:action>
|
|
||||||
</.table>
|
|
||||||
|
|||||||
@ -1,19 +1,17 @@
|
|||||||
<.header>
|
<header class="mb-20">
|
||||||
<%= @artikel.title %>
|
<h1 class="text-lg font-semibold leading-8 text-zinc-800"><%= @artikel.title %></h1>
|
||||||
<:subtitle><%= @artikel.article.author.name %></:subtitle>
|
<p class="my-2"><.link href={"/autoren/#{@artikel.article.author.id}"}><%= @artikel.article.author.name %></.link>
|
||||||
<:actions>
|
— <%= Calendar.strftime(@artikel.article.date, "%d.%m.%Y") %></p>
|
||||||
|
<div>Original
|
||||||
<.link href={@artikel.article.url} >
|
<.link href={@artikel.article.url} >
|
||||||
<%= @artikel.article.title %>
|
<%= @artikel.article.title %>
|
||||||
</.link> <%= Calendar.strftime(@artikel.article.date, "%d.%m.%Y") %>
|
</.link><br>
|
||||||
</:actions>
|
</div>
|
||||||
</.header>
|
<div class="my-2">
|
||||||
|
Übersetzung <%= Calendar.strftime(@artikel.date, "%d.%m.%Y") %>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
<.list>
|
<div class="article w-full"><%= @artikel.public_content |> raw %></div>
|
||||||
<:item title="Title"><%= @artikel.title %></:item>
|
|
||||||
<%!-- <:item title="Translator"><%= @artikel.translator %></:item> --%>
|
|
||||||
<:item title="Unauthorized"><%= @artikel.unauthorized %></:item>
|
|
||||||
<:item title="Date"><%= Calendar.strftime(@artikel.date, "%d.%m.%Y") %></:item>
|
|
||||||
</.list>
|
|
||||||
<div class="article"><%= @artikel.public_content |> raw %></div>
|
|
||||||
|
|
||||||
<.back navigate={~p"/autoren/#{@artikel.article.author}"}>Back to Autor</.back>
|
<.back navigate={~p"/autoren/#{@artikel.article.author}"}>Back to Autor</.back>
|
||||||
|
|||||||
@ -1,20 +1,5 @@
|
|||||||
<.header>
|
<.header>
|
||||||
Listing Autoren
|
Autoren
|
||||||
<:actions>
|
|
||||||
<.link href={~p"/autoren/new"}>
|
|
||||||
<.button>New Autor</.button>
|
|
||||||
</.link>
|
|
||||||
</:actions>
|
|
||||||
</.header>
|
</.header>
|
||||||
|
|
||||||
<.table id="autoren" rows={@autoren} row_click={&JS.navigate(~p"/autoren/#{&1}")}>
|
<.autor :for={autor <- @autoren} autor={autor} />
|
||||||
<:col :let={autor} label="Name"><%= autor.name %></:col>
|
|
||||||
<:col :let={autor} label="Description"><%= autor.description %></:col>
|
|
||||||
<:col :let={autor} label="Homepage name"><%= autor.homepage_name %></:col>
|
|
||||||
<:col :let={autor} label="Homepage url"><%= autor.homepage_url %></:col>
|
|
||||||
<:action :let={autor}>
|
|
||||||
<div class="sr-only">
|
|
||||||
<.link navigate={~p"/autoren/#{autor}"}>Show</.link>
|
|
||||||
</div>
|
|
||||||
</:action>
|
|
||||||
</.table>
|
|
||||||
|
|||||||
@ -7,10 +7,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<%= for article <- @autor.articles do %>
|
<%= for article <- @autor.articles do %>
|
||||||
<div :for={translation <- article.translations} class="my-2 px-2 rounded border-2 border-solid border-gray-300">
|
<.artikel :for={translation <- article.translations} artikel={translation} show_author={false} />
|
||||||
<.link navigate={~p"/artikel/#{translation}"}><h4 class="font-bold py-2"><%= translation.title %></h4></.link>
|
|
||||||
<div><%= translation.teaser %></div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<.back navigate={~p"/autoren"}>Back to autoren</.back>
|
<.back navigate={~p"/autoren"}>Back to autoren</.back>
|
||||||
|
|||||||
Reference in New Issue
Block a user