2019-12-15 23:52:51 +01:00
|
|
|
defmodule PhilomenaWeb.Admin.ModNoteView do
|
|
|
|
use PhilomenaWeb, :view
|
|
|
|
|
|
|
|
alias Philomena.Users.User
|
|
|
|
alias Philomena.Reports.Report
|
|
|
|
alias Philomena.DnpEntries.DnpEntry
|
|
|
|
|
2023-04-24 20:38:05 +02:00
|
|
|
def link_to_noted_thing(conn, %DnpEntry{tag: tag} = dnp_entry),
|
2024-04-29 02:55:27 +02:00
|
|
|
do: link("DNP entry for #{tag.name}", to: ~p"/dnp/#{dnp_entry}")
|
2019-12-15 23:52:51 +01:00
|
|
|
|
|
|
|
def link_to_noted_thing(conn, %Report{user: nil} = report),
|
2024-04-29 02:55:27 +02:00
|
|
|
do: link("Report #{report.id}", to: ~p"/admin/reports/#{report}")
|
2019-12-15 23:52:51 +01:00
|
|
|
|
|
|
|
def link_to_noted_thing(conn, %Report{user: user} = report),
|
2020-01-11 05:20:19 +01:00
|
|
|
do:
|
|
|
|
link("Report #{report.id} by #{user.name}",
|
2024-04-29 02:55:27 +02:00
|
|
|
to: ~p"/admin/reports/#{report}"
|
2020-01-11 05:20:19 +01:00
|
|
|
)
|
2019-12-15 23:52:51 +01:00
|
|
|
|
|
|
|
def link_to_noted_thing(conn, %User{} = user),
|
2024-04-29 02:55:27 +02:00
|
|
|
do: link("User #{user.name}", to: ~p"/profiles/#{user}")
|
2019-12-15 23:52:51 +01:00
|
|
|
|
2019-12-16 00:35:56 +01:00
|
|
|
def link_to_noted_thing(_conn, _notable), do: "Item permanently deleted"
|
2019-12-15 23:52:51 +01:00
|
|
|
end
|