Compare commits
2 Commits
b20bbb232c
...
895860baa6
| Author | SHA1 | Date | |
|---|---|---|---|
| 895860baa6 | |||
| 5319785855 |
@ -67,7 +67,28 @@ implement to_param protocol (no more needed for Outlook.Translations.Translation
|
||||
end
|
||||
|
||||
def get_autor!(id) do
|
||||
Repo.get!(Author, id)
|
||||
|> Repo.preload([articles: [:translations]])
|
||||
q = from au in Author,
|
||||
select: %Autor{
|
||||
name: au.name,
|
||||
description: au.description,
|
||||
homepage_name: au.homepage_name,
|
||||
homepage_url: au.homepage_url,
|
||||
},
|
||||
where: au.id == ^id
|
||||
autor = Repo.one(q)
|
||||
|
||||
q2 = from a in Article,
|
||||
join: t in Translation, on: t.article_id == a.id,
|
||||
select: %Artikel{
|
||||
title: t.title,
|
||||
date: t.date,
|
||||
teaser: t.teaser,
|
||||
id: t.id,
|
||||
date_org: a.date
|
||||
},
|
||||
where: a.author_id == ^id and t.public == true
|
||||
artikel = Repo.all(q2)
|
||||
|
||||
%Autor{autor | artikel: artikel}
|
||||
end
|
||||
end
|
||||
|
||||
@ -4,10 +4,6 @@
|
||||
<:subtitle><.link href={@autor.homepage_url}><%= @autor.homepage_name %></.link></:subtitle>
|
||||
</.header>
|
||||
|
||||
|
||||
|
||||
<%= for article <- @autor.articles do %>
|
||||
<.artikel :for={translation <- article.translations} artikel={translation} show_autor={false} />
|
||||
<% end %>
|
||||
<.artikel :for={artikel <- @autor.artikel} artikel={artikel} show_autor={false} />
|
||||
|
||||
<.back navigate={~p"/autoren"}>Back to autoren</.back>
|
||||
|
||||
@ -187,6 +187,7 @@ defmodule OutlookWeb.TranslationLive.FormComponent do
|
||||
|
||||
defp continue_edit(socket, :edit, %{"continue_edit" => "true"}) do
|
||||
socket
|
||||
|> assign(:translation, Translations.get_translation!(socket.assigns.translation.id))
|
||||
end
|
||||
defp continue_edit(socket, :new, %{"continue_edit" => "true"} = params) do
|
||||
socket |> push_patch(to: ~p(/translations/#{params["id"]}/edit))
|
||||
|
||||
Reference in New Issue
Block a user