Fix front-end, allow events to be created by a group, allow to get sessions from an event

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2018-01-16 19:45:09 +01:00
parent 7a98674e59
commit 67ef32432e
29 changed files with 278 additions and 82 deletions

View File

@@ -3,22 +3,39 @@ defmodule EventosWeb.GroupView do
View for Groups
"""
use EventosWeb, :view
alias EventosWeb.GroupView
alias EventosWeb.{GroupView, AccountView}
def render("index.json", %{groups: groups}) do
%{data: render_many(groups, GroupView, "group.json")}
%{data: render_many(groups, GroupView, "group_simple.json")}
end
def render("show.json", %{group: group}) do
%{data: render_one(group, GroupView, "group.json")}
end
def render("show_simple.json", %{group: group}) do
%{data: render_one(group, GroupView, "group_simple.json")}
end
def render("group_simple.json", %{group: group}) do
%{id: group.id,
title: group.title,
description: group.description,
suspended: group.suspended,
url: group.url,
uri: group.uri
}
end
def render("group.json", %{group: group}) do
%{id: group.id,
title: group.title,
description: group.description,
suspended: group.suspended,
url: group.url,
uri: group.uri}
uri: group.uri,
members: render_many(group.members, AccountView, "acccount_basic.json"),
events: render_many(group.organized_events, EventView, "event_simple.json")
}
end
end