From 621155bfcc84ae36b3a644af11e1a965fe63e667 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Wed, 7 Mar 2018 00:36:04 +0100 Subject: [PATCH] Improved groups --- pages/group/edit.go | 2 +- pages/group/forum.go | 4 +++- pages/group/forum.pixy | 4 ++-- pages/group/group.go | 4 +++- pages/group/group.pixy | 12 +++++++----- pages/group/group.scarlet | 2 ++ pages/groups/groups.pixy | 3 ++- scripts/AnimeNotifier.ts | 2 +- styles/include/config.scarlet | 4 ++-- 9 files changed, 23 insertions(+), 14 deletions(-) diff --git a/pages/group/edit.go b/pages/group/edit.go index efaa21e0..e1cd2147 100644 --- a/pages/group/edit.go +++ b/pages/group/edit.go @@ -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)) } diff --git a/pages/group/forum.go b/pages/group/forum.go index 4db63468..26794a61 100644 --- a/pages/group/forum.go +++ b/pages/group/forum.go @@ -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)) } diff --git a/pages/group/forum.pixy b/pages/group/forum.pixy index 5253aa94..c36b1339 100644 --- a/pages/group/forum.pixy +++ b/pages/group/forum.pixy @@ -1,4 +1,4 @@ -component GroupForum(group *arn.Group) - GroupTabs(group) +component GroupForum(group *arn.Group, user *arn.User) + GroupTabs(group, user) h1 Forum \ No newline at end of file diff --git a/pages/group/group.go b/pages/group/group.go index 5946a495..2aa7a2e5 100644 --- a/pages/group/group.go +++ b/pages/group/group.go @@ -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)) } diff --git a/pages/group/group.pixy b/pages/group/group.pixy index 7e2a13bc..deb4aae5 100644 --- a/pages/group/group.pixy +++ b/pages/group/group.pixy @@ -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("Edit", "pencil", group.Link() + "/edit") \ No newline at end of file + //- 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") \ No newline at end of file diff --git a/pages/group/group.scarlet b/pages/group/group.scarlet index b273cb2e..16415b6c 100644 --- a/pages/group/group.scarlet +++ b/pages/group/group.scarlet @@ -1,6 +1,8 @@ .group-view horizontal-wrap width 100% + max-width 1200px + margin 0 auto < 1100px .group-view diff --git a/pages/groups/groups.pixy b/pages/groups/groups.pixy index de4c9e74..90604074 100644 --- a/pages/groups/groups.pixy +++ b/pages/groups/groups.pixy @@ -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 diff --git a/scripts/AnimeNotifier.ts b/scripts/AnimeNotifier.ts index fed0cda1..7f7cef27 100644 --- a/scripts/AnimeNotifier.ts +++ b/scripts/AnimeNotifier.ts @@ -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)) diff --git a/styles/include/config.scarlet b/styles/include/config.scarlet index 2853242b..1f8e22e5 100644 --- a/styles/include/config.scarlet +++ b/styles/include/config.scarlet @@ -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