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
|
|
|
|
|
2024-06-06 22:28:35 +02:00
|
|
|
def link_to_noted_thing(%DnpEntry{tag: tag} = dnp_entry),
|
|
|
|
do: link("DNP entry for #{tag.name}", to: ~p"/dnp/#{dnp_entry}")
|
2019-12-15 23:52:51 +01:00
|
|
|
|
2024-06-06 22:28:35 +02:00
|
|
|
def link_to_noted_thing(%Report{user: nil} = report),
|
|
|
|
do: link("Report #{report.id}", to: ~p"/admin/reports/#{report}")
|
2019-12-15 23:52:51 +01:00
|
|
|
|
2024-06-06 22:28:35 +02:00
|
|
|
def link_to_noted_thing(%Report{user: user} = report),
|
2020-01-11 05:20:19 +01:00
|
|
|
do:
|
|
|
|
link("Report #{report.id} by #{user.name}",
|
2024-06-06 22:28:35 +02:00
|
|
|
to: ~p"/admin/reports/#{report}"
|
2020-01-11 05:20:19 +01:00
|
|
|
)
|
2019-12-15 23:52:51 +01:00
|
|
|
|
2024-06-06 22:28:35 +02:00
|
|
|
def link_to_noted_thing(%User{} = user),
|
|
|
|
do: link("User #{user.name}", to: ~p"/profiles/#{user}")
|
2019-12-15 23:52:51 +01:00
|
|
|
|
2024-06-06 22:28:35 +02:00
|
|
|
def link_to_noted_thing(_notable), do: "Item permanently deleted"
|
2019-12-15 23:52:51 +01:00
|
|
|
end
|