Add long urls for Artikel

This commit is contained in:
Thelonius Kort
2023-02-12 18:43:30 +01:00
parent 239177db50
commit b0267ef752
7 changed files with 54 additions and 10 deletions

View File

@ -3,6 +3,12 @@ defmodule OutlookWeb.PublicComponents do
Provides components for showing and listing artikel and autoren.
"""
use Phoenix.Component
import OutlookWeb.ViewHelpers
use Phoenix.VerifiedRoutes,
endpoint: OutlookWeb.Endpoint,
router: OutlookWeb.Router,
statics: OutlookWeb.static_paths()
import Phoenix.HTML
alias Phoenix.LiveView.JS
@ -25,7 +31,7 @@ defmodule OutlookWeb.PublicComponents do
def artikel(assigns) do
~H"""
<.link navigate={"/artikel/#{@artikel.id}"}>
<.link navigate={~p"/artikel/#{@artikel}"}>
<div class="my-2 px-2 rounded border-2 border-solid border-gray-300 dark:border-stone-800">
<h4 class="font-bold text-stone-800 dark:text-stone-300 py-2"><%= @artikel.title %></h4>
<div :if={@show_author}><small><%= @artikel.article.author.name %></small></div>

View File

@ -16,7 +16,7 @@
</:actions>
</.header>
<.table id="translations" rows={@article.translations} row_click={&JS.navigate(~p"/translations/#{&1}")}>
<.table id="translations" rows={@article.translations} row_click={&JS.navigate(~p"/translations/#{(&1).id}")}>
<:col :let={translation} label="Language"><%= translation.language %></:col>
<:col :let={translation} label="Title"><%= translation.title %></:col>
<:col :let={translation} label="Teaser"><%= translation.teaser %></:col>
@ -24,9 +24,9 @@
<:col :let={translation} label="Public"><%= translation.public %></:col>
<:action :let={translation}>
<div class="sr-only">
<.link navigate={~p"/translations/#{translation}"}>Show</.link>
<.link navigate={~p"/translations/#{translation.id}"}>Show</.link>
</div>
<.link navigate={~p"/translations/#{translation}/edit"}>Edit</.link>
<.link navigate={~p"/translations/#{translation.id}/edit"}>Edit</.link>
</:action>
<%!-- <:action :let={translation}>
<.link phx-click={JS.push("delete", value: %{id: translation.id})} data-confirm="Are you sure?">

View File

@ -2,7 +2,7 @@
Listing Translations
</.header>
<.table id="translations" rows={@translations} row_click={&JS.navigate(~p"/translations/#{&1}")}>
<.table id="translations" rows={@translations} row_click={&JS.navigate(~p(/translations/#{(&1).id}))}>
<:col :let={translation} label="Language"><%= translation.language %></:col>
<:col :let={translation} label="Title"><%= translation.title %></:col>
<:col :let={translation} label="Teaser"><%= translation.teaser %></:col>
@ -12,9 +12,9 @@
<:col :let={translation} label="Unauthorized"><%= translation.unauthorized %></:col>
<:action :let={translation}>
<div class="sr-only">
<.link navigate={~p"/translations/#{translation}"}>Show</.link>
<.link navigate={~p"/translations/#{translation.id}"}>Show</.link>
</div>
<.link navigate={~p"/translations/#{translation}/edit"}>Edit</.link>
<.link navigate={~p"/translations/#{translation.id}/edit"}>Edit</.link>
</:action>
<:action :let={translation}>
<.link phx-click={JS.push("delete", value: %{id: translation.id})} data-confirm="Are you sure?">

View File

@ -2,7 +2,7 @@
Translation <%= @translation.id %>
<:subtitle>This is a translation record from your database.</:subtitle>
<:actions>
<.link navigate={~p"/translations/#{@translation}/edit"} phx-click={JS.push_focus()}>
<.link navigate={~p"/translations/#{@translation.id}/edit"} phx-click={JS.push_focus()}>
<.button>Edit translation</.button>
</.link>
</:actions>

View File

@ -34,7 +34,7 @@ defmodule OutlookWeb.Router do
get "/", ArtikelController, :index
resources "/autoren", AutorController, only: [:index, :show]
resources "/artikel", ArtikelController, only: [:index, :show]
resources "/artikel", ArtikelController, only: [:index, :show], param: "tid"
end
# Other scopes may use custom stacks.