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-04-29 03:08:00 +02:00
|
|
|
def link_to_noted_thing(%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
|
|
|
|
2024-04-29 03:08:00 +02:00
|
|
|
def link_to_noted_thing(%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
|
|
|
|
2024-04-29 03:08:00 +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-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
|
|
|
|
2024-04-29 03:08:00 +02:00
|
|
|
def link_to_noted_thing(%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
|
|
|
|
2024-04-29 03:08:00 +02:00
|
|
|
def link_to_noted_thing(_notable), do: "Item permanently deleted"
|
2019-12-15 23:52:51 +01:00
|
|
|
end
|