mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 04:27:59 +01:00
723bfa213f
* AwardJson, LinkJson, UserJson to views * FilterJson -> view * ForumJson -> view * TopicJson -> view * PostJson -> view * TagJson -> view * CommentJson -> view * GalleryJson -> view
26 lines
780 B
Elixir
26 lines
780 B
Elixir
defmodule PhilomenaWeb.Api.Json.GalleryView do
|
|
use PhilomenaWeb, :view
|
|
|
|
def render("index.json", %{galleries: galleries, total: total} = assigns) do
|
|
%{
|
|
galleries: render_many(galleries, PhilomenaWeb.Api.Json.GalleryView, "gallery.json", assigns),
|
|
total: total
|
|
}
|
|
end
|
|
|
|
def render("show.json", %{gallery: gallery} = assigns) do
|
|
%{gallery: render_one(gallery, PhilomenaWeb.Api.Json.GalleryView, "gallery.json", assigns)}
|
|
end
|
|
|
|
def render("gallery.json", %{gallery: gallery}) do
|
|
%{
|
|
id: gallery.id,
|
|
title: gallery.title,
|
|
thumbnail_id: gallery.thumbnail_id,
|
|
spoiler_warning: gallery.spoiler_warning,
|
|
description: gallery.description,
|
|
user: gallery.creator.name,
|
|
user_id: gallery.creator_id
|
|
}
|
|
end
|
|
end
|