debianize-mobilizon/lib/eventos_web/views/comment_view.ex
Thomas Citharel e14007bac5
WIP
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2018-06-06 18:12:21 +02:00

19 lines
470 B
Elixir

defmodule EventosWeb.CommentView do
use EventosWeb, :view
alias EventosWeb.CommentView
def render("index.json", %{comments: comments}) do
%{data: render_many(comments, CommentView, "comment.json")}
end
def render("show.json", %{comment: comment}) do
%{data: render_one(comment, CommentView, "comment.json")}
end
def render("comment.json", %{comment: comment}) do
%{id: comment.id,
url: comment.url,
text: comment.text}
end
end