mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
link_to_reported_thing, link_to_noted_thing
This commit is contained in:
parent
e69f1bf3fa
commit
c506ef884e
8 changed files with 20 additions and 20 deletions
|
@ -10,7 +10,7 @@ table.table
|
||||||
= for {body, note} <- @mod_notes do
|
= for {body, note} <- @mod_notes do
|
||||||
tr
|
tr
|
||||||
td
|
td
|
||||||
= link_to_noted_thing(@conn, note.notable)
|
= link_to_noted_thing(note.notable)
|
||||||
|
|
||||||
td
|
td
|
||||||
= body
|
= body
|
||||||
|
|
|
@ -12,7 +12,7 @@ table.table
|
||||||
tr
|
tr
|
||||||
td
|
td
|
||||||
=> reported_image @conn, report.reportable
|
=> reported_image @conn, report.reportable
|
||||||
= link_to_reported_thing @conn, report.reportable
|
= link_to_reported_thing report.reportable
|
||||||
td
|
td
|
||||||
span title=report.reason
|
span title=report.reason
|
||||||
= truncate(report.reason)
|
= truncate(report.reason)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
h1 Showing Report
|
h1 Showing Report
|
||||||
p
|
p
|
||||||
= link_to_reported_thing @conn, @report.reportable
|
= link_to_reported_thing @report.reportable
|
||||||
|
|
||||||
article.block.communication
|
article.block.communication
|
||||||
.block__content.flex.flex--no-wrap
|
.block__content.flex.flex--no-wrap
|
||||||
|
|
|
@ -18,6 +18,6 @@ h1 Your Reports
|
||||||
tr
|
tr
|
||||||
td class=report_row_class(r)
|
td class=report_row_class(r)
|
||||||
= pretty_state(r)
|
= pretty_state(r)
|
||||||
td = link_to_reported_thing(@conn, r.reportable)
|
td = link_to_reported_thing(r.reportable)
|
||||||
td = r.reason
|
td = r.reason
|
||||||
td = pretty_time(r.created_at)
|
td = pretty_time(r.created_at)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
h2 Submit a report
|
h2 Submit a report
|
||||||
p
|
p
|
||||||
strong
|
strong
|
||||||
= link_to_reported_thing(@conn, @reportable)
|
= link_to_reported_thing(@reportable)
|
||||||
|
|
||||||
.image-other
|
.image-other
|
||||||
.dnp-warning
|
.dnp-warning
|
||||||
|
|
|
@ -5,20 +5,20 @@ defmodule PhilomenaWeb.Admin.ModNoteView do
|
||||||
alias Philomena.Reports.Report
|
alias Philomena.Reports.Report
|
||||||
alias Philomena.DnpEntries.DnpEntry
|
alias Philomena.DnpEntries.DnpEntry
|
||||||
|
|
||||||
def link_to_noted_thing(conn, %DnpEntry{tag: tag} = dnp_entry),
|
def link_to_noted_thing(%DnpEntry{tag: tag} = dnp_entry),
|
||||||
do: link("DNP entry for #{tag.name}", to: ~p"/dnp/#{dnp_entry}")
|
do: link("DNP entry for #{tag.name}", to: ~p"/dnp/#{dnp_entry}")
|
||||||
|
|
||||||
def link_to_noted_thing(conn, %Report{user: nil} = report),
|
def link_to_noted_thing(%Report{user: nil} = report),
|
||||||
do: link("Report #{report.id}", to: ~p"/admin/reports/#{report}")
|
do: link("Report #{report.id}", to: ~p"/admin/reports/#{report}")
|
||||||
|
|
||||||
def link_to_noted_thing(conn, %Report{user: user} = report),
|
def link_to_noted_thing(%Report{user: user} = report),
|
||||||
do:
|
do:
|
||||||
link("Report #{report.id} by #{user.name}",
|
link("Report #{report.id} by #{user.name}",
|
||||||
to: ~p"/admin/reports/#{report}"
|
to: ~p"/admin/reports/#{report}"
|
||||||
)
|
)
|
||||||
|
|
||||||
def link_to_noted_thing(conn, %User{} = user),
|
def link_to_noted_thing(%User{} = user),
|
||||||
do: link("User #{user.name}", to: ~p"/profiles/#{user}")
|
do: link("User #{user.name}", to: ~p"/profiles/#{user}")
|
||||||
|
|
||||||
def link_to_noted_thing(_conn, _notable), do: "Item permanently deleted"
|
def link_to_noted_thing(_notable), do: "Item permanently deleted"
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,8 +7,8 @@ defmodule PhilomenaWeb.Admin.ReportView do
|
||||||
alias PhilomenaWeb.ReportView
|
alias PhilomenaWeb.ReportView
|
||||||
alias PhilomenaWeb.ProfileView
|
alias PhilomenaWeb.ProfileView
|
||||||
|
|
||||||
defp link_to_reported_thing(conn, reportable),
|
defp link_to_reported_thing(reportable),
|
||||||
do: ReportView.link_to_reported_thing(conn, reportable)
|
do: ReportView.link_to_reported_thing(reportable)
|
||||||
|
|
||||||
defp report_row_class(report),
|
defp report_row_class(report),
|
||||||
do: ReportView.report_row_class(report)
|
do: ReportView.report_row_class(report)
|
||||||
|
|
|
@ -41,31 +41,31 @@ defmodule PhilomenaWeb.ReportView do
|
||||||
def pretty_state(%{state: "claimed"}), do: "Claimed"
|
def pretty_state(%{state: "claimed"}), do: "Claimed"
|
||||||
def pretty_state(_report), do: "Open"
|
def pretty_state(_report), do: "Open"
|
||||||
|
|
||||||
def link_to_reported_thing(conn, %Image{} = r),
|
def link_to_reported_thing(%Image{} = r),
|
||||||
do: link("Image >>#{r.id}", to: ~p"/images/#{r}")
|
do: link("Image >>#{r.id}", to: ~p"/images/#{r}")
|
||||||
|
|
||||||
def link_to_reported_thing(conn, %Comment{} = r),
|
def link_to_reported_thing(%Comment{} = r),
|
||||||
do:
|
do:
|
||||||
link("Comment on image >>#{r.image.id}",
|
link("Comment on image >>#{r.image.id}",
|
||||||
to: ~p"/images/#{r.image}" <> "#comment_#{r.id}"
|
to: ~p"/images/#{r.image}" <> "#comment_#{r.id}"
|
||||||
)
|
)
|
||||||
|
|
||||||
def link_to_reported_thing(conn, %Conversation{} = r),
|
def link_to_reported_thing(%Conversation{} = r),
|
||||||
do:
|
do:
|
||||||
link("Conversation between #{r.from.name} and #{r.to.name}",
|
link("Conversation between #{r.from.name} and #{r.to.name}",
|
||||||
to: ~p"/conversations/#{r}"
|
to: ~p"/conversations/#{r}"
|
||||||
)
|
)
|
||||||
|
|
||||||
def link_to_reported_thing(conn, %Commission{} = r),
|
def link_to_reported_thing(%Commission{} = r),
|
||||||
do:
|
do:
|
||||||
link("#{r.user.name}'s commission page",
|
link("#{r.user.name}'s commission page",
|
||||||
to: ~p"/profiles/#{r.user}/commission"
|
to: ~p"/profiles/#{r.user}/commission"
|
||||||
)
|
)
|
||||||
|
|
||||||
def link_to_reported_thing(conn, %Gallery{} = r),
|
def link_to_reported_thing(%Gallery{} = r),
|
||||||
do: link("Gallery '#{r.title}' by #{r.creator.name}", to: ~p"/galleries/#{r}")
|
do: link("Gallery '#{r.title}' by #{r.creator.name}", to: ~p"/galleries/#{r}")
|
||||||
|
|
||||||
def link_to_reported_thing(conn, %Post{} = r),
|
def link_to_reported_thing(%Post{} = r),
|
||||||
do:
|
do:
|
||||||
link("Post in #{r.topic.title}",
|
link("Post in #{r.topic.title}",
|
||||||
to:
|
to:
|
||||||
|
@ -73,10 +73,10 @@ defmodule PhilomenaWeb.ReportView do
|
||||||
"#post_#{r.id}"
|
"#post_#{r.id}"
|
||||||
)
|
)
|
||||||
|
|
||||||
def link_to_reported_thing(conn, %User{} = r),
|
def link_to_reported_thing(%User{} = r),
|
||||||
do: link("User '#{r.name}'", to: ~p"/profiles/#{r}")
|
do: link("User '#{r.name}'", to: ~p"/profiles/#{r}")
|
||||||
|
|
||||||
def link_to_reported_thing(_conn, _reportable) do
|
def link_to_reported_thing(_reportable) do
|
||||||
"Reported item permanently destroyed."
|
"Reported item permanently destroyed."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue