From d72543b31edf277eaafeb52254c5c72992bd9bd0 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Wed, 18 Oct 2017 23:17:54 +0200 Subject: [PATCH] Minor changes --- main.go | 1 + pages/group/forum.go | 21 +++++++++++++++++++++ pages/group/forum.pixy | 4 ++++ pages/group/group.pixy | 1 + utils/editform/editform.go | 2 +- 5 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 pages/group/forum.go create mode 100644 pages/group/forum.pixy diff --git a/main.go b/main.go index ad60a955..a2a9dcf8 100644 --- a/main.go +++ b/main.go @@ -107,6 +107,7 @@ func configure(app *aero.Application) *aero.Application { app.Ajax("/groups", groups.Get) app.Ajax("/group/:id", group.Get) app.Ajax("/group/:id/edit", group.Edit) + app.Ajax("/group/:id/forum", group.Forum) // User profiles app.Ajax("/user", user.Get) diff --git a/pages/group/forum.go b/pages/group/forum.go new file mode 100644 index 00000000..4db63468 --- /dev/null +++ b/pages/group/forum.go @@ -0,0 +1,21 @@ +package group + +import ( + "net/http" + + "github.com/aerogo/aero" + "github.com/animenotifier/arn" + "github.com/animenotifier/notify.moe/components" +) + +// Forum ... +func Forum(ctx *aero.Context) string { + id := ctx.Get("id") + group, err := arn.GetGroup(id) + + if err != nil { + return ctx.Error(http.StatusNotFound, "Group not found", err) + } + + return ctx.HTML(components.GroupForum(group)) +} diff --git a/pages/group/forum.pixy b/pages/group/forum.pixy new file mode 100644 index 00000000..5253aa94 --- /dev/null +++ b/pages/group/forum.pixy @@ -0,0 +1,4 @@ +component GroupForum(group *arn.Group) + GroupTabs(group) + + h1 Forum \ No newline at end of file diff --git a/pages/group/group.pixy b/pages/group/group.pixy index 434f3913..41c8aecd 100644 --- a/pages/group/group.pixy +++ b/pages/group/group.pixy @@ -30,4 +30,5 @@ component Group(group *arn.Group) component GroupTabs(group *arn.Group) .tabs Tab("Group", "users", group.Link()) + Tab("Forum", "comment", group.Link() + "/forum") Tab("Edit", "pencil", group.Link() + "/edit") \ No newline at end of file diff --git a/utils/editform/editform.go b/utils/editform/editform.go index 37ad9931..96bd36dc 100644 --- a/utils/editform/editform.go +++ b/utils/editform/editform.go @@ -34,7 +34,7 @@ func Render(obj interface{}, title string, user *arn.User) string { if user != nil && (user.Role == "editor" || user.Role == "admin") { b.WriteString(`
`) b.WriteString(`
`) - b.WriteString(``) + b.WriteString(``) b.WriteString(`
`) }