diff --git a/mixins/Comments.pixy b/mixins/Comments.pixy index e0fe43ad..1e72f16d 100644 --- a/mixins/Comments.pixy +++ b/mixins/Comments.pixy @@ -11,4 +11,4 @@ component Comments(parent arn.PostParent, user *arn.User) //- p.no-data.mountable No comments have been written yet. //- else each post in parent.PostsRelevantFirst(5) - Postable(post, user, true, "") \ No newline at end of file + Postable(post, user, true, false, "") \ No newline at end of file diff --git a/mixins/Postable.pixy b/mixins/Postable.pixy index 8e919c33..9e79ffd3 100644 --- a/mixins/Postable.pixy +++ b/mixins/Postable.pixy @@ -1,5 +1,5 @@ -component Postable(post arn.Postable, user *arn.User, includeReplies bool, highlightAuthorID string) - .post.mountable(id=strings.ToLower(post.TypeName()) + "-" + fmt.Sprint(post.GetID()), data-pro=post.Creator().IsPro(), data-api="/api/" + strings.ToLower(post.TypeName()) + "/" + post.GetID()) +component Postable(post arn.Postable, user *arn.User, includeReplies bool, showParent bool, highlightAuthorID string) + .post.mountable(id=fmt.Sprintf("%s-%s", strings.ToLower(post.TypeName()), post.GetID()), data-pro=post.Creator().IsPro(), data-api=fmt.Sprintf("/api/%s/%s", strings.ToLower(post.TypeName()), post.GetID())) .post-parent .post-author Avatar(post.Creator()) @@ -8,6 +8,15 @@ component Postable(post arn.Postable, user *arn.User, includeReplies bool, highl .post-header .post-creator a(href=post.Creator().Link())= post.Creator().Nick + + if showParent + if post.GetParentType() == "User" + if post.GetParentID() != post.Creator().ID + span to + a(href=post.Parent().Link())= post.Parent().TitleByUser(user) + else if post.GetParentType() != "" + span in + a(href=post.Parent().Link())= post.Parent().TitleByUser(user) if user == nil || user.ID == post.Creator().ID //- Don't display a like icon. @@ -57,4 +66,4 @@ component Postable(post arn.Postable, user *arn.User, includeReplies bool, highl .replies(id="replies-" + post.GetID()) if includeReplies each reply in post.Posts() - Postable(reply, user, true, highlightAuthorID) + Postable(reply, user, true, false, highlightAuthorID) diff --git a/mixins/PostableList.pixy b/mixins/PostableList.pixy index 7ca47a46..d43b3f5b 100644 --- a/mixins/PostableList.pixy +++ b/mixins/PostableList.pixy @@ -2,4 +2,4 @@ component PostableList(postables []arn.Postable, user *arn.User) .thread .posts each post in postables - Postable(post, user, false, "") + Postable(post, user, false, false, "") diff --git a/pages/activity/activity.pixy b/pages/activity/activity.pixy index 42a21c78..86a95a83 100644 --- a/pages/activity/activity.pixy +++ b/pages/activity/activity.pixy @@ -26,35 +26,43 @@ component ActivitiesScrollable(entries []arn.Activity, user *arn.User) Activity(entry, user) component Activity(activity arn.Activity, user *arn.User) - .activity.post-parent.mountable(id=fmt.Sprintf("activity-%s", activity.GetID()), data-api=utils.ActivityAPILink(activity)) - .post-author - Avatar(activity.Creator()) - .post-content - .post-header - .post-creator - a(href=activity.Creator().Link())= activity.Creator().Nick + if activity.TypeName() == "ActivityCreate" + ActivityCreate(activity.(*arn.ActivityCreate), user) + else if activity.TypeName() == "ActivityConsumeAnime" + ActivityConsumeAnime(activity.(*arn.ActivityConsumeAnime), user) - if activity.TypeName() == "ActivityCreate" - ActivityCreateMeta(activity.(*arn.ActivityCreate), user) + //- .activity.post-parent.mountable(id=fmt.Sprintf("activity-%s", activity.GetID()), data-api=utils.ActivityAPILink(activity)) + //- .post-author + //- Avatar(activity.Creator()) + //- .post-content + //- .post-header + //- .post-creator + //- a(href=activity.Creator().Link())= activity.Creator().Nick + + //- if activity.TypeName() == "ActivityCreate" + //- ActivityCreateMeta(activity.(*arn.ActivityCreate), user) - if user != nil - //- button.post-action.tip.action(data-action="like", data-trigger="click", aria-label="Like") - //- Icon("heart") - //- if activity.TypeName() == "ActivityCreate" - //- span= activity.(*arn.ActivityCreate).Object().CountLikes() - //- else - //- span= len(activity.(*arn.ActivityConsumeAnime).Likes) + //- if user != nil + //- //- button.post-action.tip.action(data-action="like", data-trigger="click", aria-label="Like") + //- //- Icon("heart") + //- //- if activity.TypeName() == "ActivityCreate" + //- //- span= activity.(*arn.ActivityCreate).Object().CountLikes() + //- //- else + //- //- span= len(activity.(*arn.ActivityConsumeAnime).Likes) - if user.ID == activity.GetCreatedBy() && activity.TypeName() == "ActivityConsumeAnime" - button.post-action.tip.action(data-action="deleteObject", data-trigger="click", aria-label="Delete", data-return-path="/activity", data-confirm-type="activity") - RawIcon("trash") + //- if user.ID == activity.GetCreatedBy() && activity.TypeName() == "ActivityConsumeAnime" + //- button.post-action.tip.action(data-action="deleteObject", data-trigger="click", aria-label="Delete", data-return-path="/activity", data-confirm-type="activity") + //- RawIcon("trash") - .post-date.utc-date(data-date=activity.GetCreated()) + //- .post-date.utc-date(data-date=activity.GetCreated()) - if activity.TypeName() == "ActivityCreate" - ActivityCreateText(activity.(*arn.ActivityCreate), user) - else if activity.TypeName() == "ActivityConsumeAnime" - ActivityConsumeAnimeText(activity.(*arn.ActivityConsumeAnime), user) + //- if activity.TypeName() == "ActivityCreate" + //- ActivityCreateText(activity.(*arn.ActivityCreate), user) + //- else if activity.TypeName() == "ActivityConsumeAnime" + //- ActivityConsumeAnimeText(activity.(*arn.ActivityConsumeAnime), user) + +component ActivityConsumeAnime(activity *arn.ActivityConsumeAnime, user *arn.User) + h1 TODO component ActivityConsumeAnimeText(activity *arn.ActivityConsumeAnime, user *arn.User) span watched @@ -65,6 +73,9 @@ component ActivityConsumeAnimeText(activity *arn.ActivityConsumeAnime, user *arn else span= fmt.Sprintf(" episode %d.", activity.ToEpisode) +component ActivityCreate(activity *arn.ActivityCreate, user *arn.User) + Postable(activity.Postable(), user, false, true, "") + component ActivityCreateMeta(activity *arn.ActivityCreate, user *arn.User) if activity.ObjectType == "Post" if activity.Postable().GetParentType() != "User" diff --git a/pages/post/post.pixy b/pages/post/post.pixy index f34e89e4..079fff25 100644 --- a/pages/post/post.pixy +++ b/pages/post/post.pixy @@ -1,11 +1,9 @@ component Post(post *arn.Post, user *arn.User) .thread .posts - Postable(post, user, true, "") + Postable(post, user, true, true, "") - .side-note-container.mountable - if user != nil && user.Role == "admin" + if user != nil && user.Role == "admin" + .side-note-container.mountable a.side-note.tip(href=post.Link() + "/edit", aria-label="Admin Edit") Icon("edit") - - a.side-note(href=post.Parent().Link())= post.Parent().TitleByUser(user) diff --git a/pages/thread/thread.pixy b/pages/thread/thread.pixy index b2ae51c8..a40985c7 100644 --- a/pages/thread/thread.pixy +++ b/pages/thread/thread.pixy @@ -3,7 +3,7 @@ component Thread(thread *arn.Thread, user *arn.User) #thread.thread(data-id=thread.ID) .posts - Postable(thread, user, true, thread.Creator().ID) + Postable(thread, user, true, false, thread.Creator().ID) //- Reply if user != nil