Implemented groups
This commit is contained in:
32
pages/group/edit.go
Normal file
32
pages/group/edit.go
Normal file
@ -0,0 +1,32 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
"github.com/animenotifier/notify.moe/utils/editform"
|
||||
)
|
||||
|
||||
// Edit ...
|
||||
func Edit(ctx *aero.Context) string {
|
||||
id := ctx.Get("id")
|
||||
group, err := arn.GetGroup(id)
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(http.StatusNotFound, "Track not found", err)
|
||||
}
|
||||
|
||||
ctx.Data = &arn.OpenGraph{
|
||||
Tags: map[string]string{
|
||||
"og:title": group.Name,
|
||||
"og:url": "https://" + ctx.App.Config.Domain + group.Link(),
|
||||
"og:site_name": "notify.moe",
|
||||
},
|
||||
}
|
||||
|
||||
return ctx.HTML(components.GroupTabs(group) + editform.Render(group, "Edit group", user))
|
||||
}
|
29
pages/group/group.go
Normal file
29
pages/group/group.go
Normal file
@ -0,0 +1,29 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
)
|
||||
|
||||
// Get ...
|
||||
func Get(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)
|
||||
}
|
||||
|
||||
ctx.Data = &arn.OpenGraph{
|
||||
Tags: map[string]string{
|
||||
"og:title": group.Name,
|
||||
"og:url": "https://" + ctx.App.Config.Domain + group.Link(),
|
||||
"og:site_name": "notify.moe",
|
||||
},
|
||||
}
|
||||
|
||||
return ctx.HTML(components.Group(group))
|
||||
}
|
15
pages/group/group.pixy
Normal file
15
pages/group/group.pixy
Normal file
@ -0,0 +1,15 @@
|
||||
component Group(group *arn.Group)
|
||||
GroupTabs(group)
|
||||
|
||||
if group.Name != ""
|
||||
h1= group.Name
|
||||
else
|
||||
h1 untitled
|
||||
|
||||
p= len(group.Members)
|
||||
p= group.CreatedBy
|
||||
|
||||
component GroupTabs(group *arn.Group)
|
||||
.tabs
|
||||
Tab("Group", "users", group.Link())
|
||||
Tab("Edit", "pencil", group.Link() + "/edit")
|
Reference in New Issue
Block a user