Improved groups

This commit is contained in:
Eduard Urbach 2018-03-07 00:36:04 +01:00
parent 4fd5cb76e2
commit 621155bfcc
9 changed files with 23 additions and 14 deletions

View File

@ -28,5 +28,5 @@ func Edit(ctx *aero.Context) string {
},
}
return ctx.HTML(components.GroupTabs(group) + editform.Render(group, "Edit group", user))
return ctx.HTML(components.GroupTabs(group, user) + editform.Render(group, "Edit group", user))
}

View File

@ -6,10 +6,12 @@ import (
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
)
// Forum ...
func Forum(ctx *aero.Context) string {
user := utils.GetUser(ctx)
id := ctx.Get("id")
group, err := arn.GetGroup(id)
@ -17,5 +19,5 @@ func Forum(ctx *aero.Context) string {
return ctx.Error(http.StatusNotFound, "Group not found", err)
}
return ctx.HTML(components.GroupForum(group))
return ctx.HTML(components.GroupForum(group, user))
}

View File

@ -1,4 +1,4 @@
component GroupForum(group *arn.Group)
GroupTabs(group)
component GroupForum(group *arn.Group, user *arn.User)
GroupTabs(group, user)
h1 Forum

View File

@ -6,10 +6,12 @@ import (
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
)
// Get ...
func Get(ctx *aero.Context) string {
user := utils.GetUser(ctx)
id := ctx.Get("id")
group, err := arn.GetGroup(id)
@ -25,5 +27,5 @@ func Get(ctx *aero.Context) string {
},
}
return ctx.HTML(components.Group(group))
return ctx.HTML(components.Group(group, user))
}

View File

@ -1,5 +1,5 @@
component Group(group *arn.Group)
GroupTabs(group)
component Group(group *arn.Group, user *arn.User)
GroupTabs(group, user)
if group.Name != ""
h1.mountable= group.Name
@ -31,8 +31,10 @@ component Group(group *arn.Group)
each post in group.Posts()
p!= post.HTML()
component GroupTabs(group *arn.Group)
component GroupTabs(group *arn.Group, user *arn.User)
.tabs
Tab("Group", "users", group.Link())
Tab("Forum", "comment", group.Link() + "/forum")
//- Tab("Forum", "comment", group.Link() + "/forum")
if user != nil && group.FindMember(user.ID) != nil && group.FindMember(user.ID).Role == "founder"
Tab("Edit", "pencil", group.Link() + "/edit")

View File

@ -1,6 +1,8 @@
.group-view
horizontal-wrap
width 100%
max-width 1200px
margin 0 auto
< 1100px
.group-view

View File

@ -4,7 +4,7 @@ component Groups(groups []*arn.Group, groupsPerPage int, user *arn.User)
h1.page-title Groups
.buttons
.corner-buttons
if user != nil
if user.DraftIndex().GroupID == ""
button.action(data-action="newObject", data-trigger="click", data-type="group")
@ -19,6 +19,7 @@ component Groups(groups []*arn.Group, groupsPerPage int, user *arn.User)
each group in groups
a.group.mountable.ajax(href=group.Link())
img.group-image.lazy(data-src=group.ImageURL(), alt=group.Name)
.group-info
h3.group-name= group.Name
.group-tagline= group.Tagline

View File

@ -665,7 +665,7 @@ export class AnimeNotifier {
this.loading(true)
// Delay by transition-speed
return delay(200).then(() => request)
return delay(150).then(() => request)
.then(html => Diff.innerHTML(this.app.content, html))
.then(() => this.app.emit("DOMContentLoaded"))
.then(() => this.loading(false))

View File

@ -95,6 +95,6 @@ content-line-height = 1.7em
typography-margin = 0.4rem
// Timings
fade-speed = 200ms
fade-speed = 150ms
transition-speed = 150ms
mountable-transition-speed = 200ms
mountable-transition-speed = 150ms