From 999323f8508ae140539d97d2961c0cadd82bc11f Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Wed, 7 Mar 2018 01:08:47 +0100 Subject: [PATCH] Improved group interface --- mixins/NewPostArea.pixy | 6 ++++++ pages/group/group.pixy | 15 ++++++++++----- pages/group/group.scarlet | 7 ++++--- pages/threads/threads.pixy | 11 +++-------- scripts/Actions/Forum.ts | 5 +++++ 5 files changed, 28 insertions(+), 16 deletions(-) create mode 100644 mixins/NewPostArea.pixy diff --git a/mixins/NewPostArea.pixy b/mixins/NewPostArea.pixy new file mode 100644 index 00000000..43d3212a --- /dev/null +++ b/mixins/NewPostArea.pixy @@ -0,0 +1,6 @@ +component NewPostArea(user *arn.User, placeholder string) + .post.mountable + .post-author + Avatar(user) + + textarea#new-reply.post-content(placeholder=placeholder + "...", aria-label=placeholder) \ No newline at end of file diff --git a/pages/group/group.pixy b/pages/group/group.pixy index deb4aae5..c555ca61 100644 --- a/pages/group/group.pixy +++ b/pages/group/group.pixy @@ -25,11 +25,16 @@ component Group(group *arn.Group, user *arn.User) Avatar(member.User()) .group-feed.mountable - if len(group.Posts()) == 0 - p.text-center.mountable No posts in this group yet. - else - each post in group.Posts() - p!= post.HTML() + if user != nil + NewPostArea(user, "Content") + + .buttons + button.action(data-action="newGroupPost", data-trigger="click") + Icon("check") + span Publish + + each post in group.Posts() + p!= post.HTML() component GroupTabs(group *arn.Group, user *arn.User) .tabs diff --git a/pages/group/group.scarlet b/pages/group/group.scarlet index 16415b6c..940b35a6 100644 --- a/pages/group/group.scarlet +++ b/pages/group/group.scarlet @@ -1,19 +1,20 @@ .group-view horizontal-wrap width 100% - max-width 1200px + max-width 900px margin 0 auto + border 1px solid red < 1100px .group-view vertical .group-feed - flex 0.75 + flex 1 padding 1rem .group-sidebar - flex 0.25 + flex-basis 300px .group-sidebar-section ui-element diff --git a/pages/threads/threads.pixy b/pages/threads/threads.pixy index d56b6ef8..5a7f4ff2 100644 --- a/pages/threads/threads.pixy +++ b/pages/threads/threads.pixy @@ -10,19 +10,14 @@ component Thread(thread *arn.Thread, posts []*arn.Post, user *arn.User) // Reply if user != nil - .post.mountable - .post-author - Avatar(user) - - .post-content - textarea#new-reply(placeholder="Reply...", aria-label="Reply") + NewPostArea(user, "Reply") .buttons button.action(data-action="forumReply", data-trigger="click") Icon("mail-reply") span Reply + if user.Role == "admin" || user.Role == "editor" button.action(data-action="deleteObject", data-trigger="click", data-return-path="/forum", data-confirm-type="thread", data-api="/api/thread/" + thread.ID) Icon("trash") - span Delete - \ No newline at end of file + span Delete \ No newline at end of file diff --git a/scripts/Actions/Forum.ts b/scripts/Actions/Forum.ts index f4f52f1f..abf73888 100644 --- a/scripts/Actions/Forum.ts +++ b/scripts/Actions/Forum.ts @@ -73,6 +73,11 @@ export function forumReply(arn: AnimeNotifier) { .catch(err => arn.statusMessage.showError(err)) } +// Group post +export function newGroupPost(arn: AnimeNotifier) { + // TODO: ... +} + // Create thread export function createThread(arn: AnimeNotifier) { let title = arn.app.find("title") as HTMLInputElement