mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 20:37:59 +01:00
1a6c3731e0
* Adds full DNP info to tags * Add dnp view * Changed DNP to Dnp
24 lines
629 B
Elixir
Executable file
24 lines
629 B
Elixir
Executable file
defmodule PhilomenaWeb.Api.Json.DnpView do
|
|
use PhilomenaWeb, :view
|
|
|
|
def render("index.json", %{dnps: dnp, total: total} = assigns) do
|
|
%{
|
|
dnps: render_many(dnp, PhilomenaWeb.Api.Json.DnpView, "dnp.json", assigns),
|
|
total: total
|
|
}
|
|
end
|
|
|
|
def render("show.json", %{dnp: dnp} = assigns) do
|
|
%{dnp: render_one(dnp, PhilomenaWeb.Api.Json.DnpView, "dnp.json", assigns)}
|
|
end
|
|
|
|
def render("dnp.json", %{dnp: dnp}) do
|
|
%{
|
|
id: dnp.id,
|
|
dnp_type: dnp.dnp_type,
|
|
conditions: dnp.conditions,
|
|
reason: if(!dnp.hide_reason, do: dnp.reason),
|
|
created_at: dnp.created_at
|
|
}
|
|
end
|
|
end
|