Added activity feed
This commit is contained in:
parent
8e1578f2cb
commit
97c8f99499
@ -31,9 +31,9 @@ component Sidebar(user *arn.User)
|
||||
else
|
||||
SidebarButton("Home", "/", "home")
|
||||
|
||||
SidebarButton("Activity", "/activity", "rss")
|
||||
SidebarButton("Forum", "/forum", "comment")
|
||||
SidebarButton("Explore", "/explore", "th")
|
||||
SidebarButton("Calendar", "/calendar", "calendar")
|
||||
SidebarButton("AMVs", "/amvs", "video-camera")
|
||||
SidebarButton("Soundtracks", "/soundtracks", "headphones")
|
||||
SidebarButton("Quotes", "/quotes", "quote-left")
|
||||
|
@ -5,7 +5,7 @@ component Comments(parent arn.PostParent, user *arn.User)
|
||||
p.no-data.mountable No comments have been written yet.
|
||||
else
|
||||
each post in parent.Posts()
|
||||
Postable(post.ToPostable(), user, "")
|
||||
Postable(post.ToPostable(), user, "", "")
|
||||
|
||||
if user != nil
|
||||
if parent.IsLocked()
|
||||
|
@ -1,12 +1,12 @@
|
||||
component Postable(post arn.Postable, user *arn.User, highlightAuthorID string)
|
||||
component Postable(post arn.Postable, user *arn.User, headerContent string, highlightAuthorID string)
|
||||
.post.mountable(id=strings.ToLower(post.Type()) + "-" + fmt.Sprint(post.ID()), data-highlight=post.Creator().ID == highlightAuthorID, data-pro=post.Creator().IsPro(), data-api="/api/" + strings.ToLower(post.Type()) + "/" + post.ID())
|
||||
.post-author
|
||||
Avatar(post.Creator())
|
||||
|
||||
//- if post.recipient && post.recipient.ID !== post.author.ID
|
||||
//- a.user.post-recipient(href="/+" + post.recipient.nick, title=post.recipient.nick)
|
||||
//- img.user-image(src=post.recipient.avatar ? (post.recipient.avatar + "?s=100&r=x&d=mm") : "/images/elements/no-gravatar.svg", alt=post.recipient.nick)
|
||||
.post-content
|
||||
if headerContent != ""
|
||||
div!= headerContent
|
||||
|
||||
div(id="render-" + post.ID())!= post.HTML()
|
||||
|
||||
if user != nil && user.ID == post.Creator().ID
|
||||
|
@ -2,4 +2,4 @@ component PostableList(postables []arn.Postable, user *arn.User)
|
||||
.thread
|
||||
.posts
|
||||
each post in postables
|
||||
Postable(post, user, "")
|
||||
Postable(post, user, "", "")
|
||||
|
34
pages/activity/activity.go
Normal file
34
pages/activity/activity.go
Normal file
@ -0,0 +1,34 @@
|
||||
package activity
|
||||
|
||||
import (
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
const maxActivitiesPerPage = 40
|
||||
|
||||
// Get activity page.
|
||||
func Get(ctx *aero.Context) string {
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
// posts := arn.AllPosts()
|
||||
// arn.SortPostsLatestFirst(posts)
|
||||
|
||||
// posts := arn.FilterPosts(func(post *arn.Post) bool {
|
||||
// return post.
|
||||
// })
|
||||
|
||||
entries := arn.FilterEditLogEntries(func(entry *arn.EditLogEntry) bool {
|
||||
return entry.Action == "create" && entry.ObjectType == "Post" && entry.Object() != nil
|
||||
})
|
||||
|
||||
arn.SortEditLogEntriesLatestFirst(entries)
|
||||
|
||||
if len(entries) > maxActivitiesPerPage {
|
||||
entries = entries[:maxActivitiesPerPage]
|
||||
}
|
||||
|
||||
return ctx.HTML(components.ActivityFeed(entries, user))
|
||||
}
|
@ -1,2 +1,16 @@
|
||||
component ActivityFeed
|
||||
h1 Hello
|
||||
component ActivityFeed(entries []*arn.EditLogEntry, user *arn.User)
|
||||
h1 Activity
|
||||
|
||||
.activities
|
||||
each entry in entries
|
||||
if entry.ObjectType == "Post"
|
||||
.activity
|
||||
ActivityPost(entry.Object().(*arn.Post), user)
|
||||
|
||||
component ActivityPost(post *arn.Post, user *arn.User)
|
||||
//- .activity-header.mountable
|
||||
//- a(href=post.Creator().Link())= post.Creator().Nick
|
||||
//- span commented on
|
||||
//- a(href=post.Parent().Link())= post.Parent().TitleByUser(user)
|
||||
|
||||
Postable(post.ToPostable(), user, fmt.Sprintf(`<p class="activity-header"><a href="%s">%s</a></p>`, post.Parent().Link(), post.Parent().TitleByUser(user)), "")
|
11
pages/activity/activity.scarlet
Normal file
11
pages/activity/activity.scarlet
Normal file
@ -0,0 +1,11 @@
|
||||
.activities
|
||||
vertical
|
||||
width 100%
|
||||
max-width forum-width
|
||||
margin 0 auto
|
||||
|
||||
// .activity
|
||||
// margin-bottom 1rem
|
||||
|
||||
.activity-header
|
||||
font-size 0.9rem
|
@ -7,6 +7,9 @@ component ExploreAnime(animes []*arn.Anime, year string, season string, status s
|
||||
button.action(data-trigger="click", data-action="toggleHideAddedAnime", title="Hide anime in my collection")
|
||||
RawIcon("eye-slash")
|
||||
|
||||
a.button(href="/calendar", title="Calendar")
|
||||
RawIcon("calendar")
|
||||
|
||||
a.button(href="/halloffame", title="Hall of Fame")
|
||||
RawIcon("trophy")
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
component HallOfFame(entries []*utils.HallOfFameEntry, user *arn.User)
|
||||
h1.hall-of-fame-page-title Hall of Fame
|
||||
.footer Best TV series for each year.
|
||||
.footer Most popular TV series for each year.
|
||||
|
||||
.hall-of-fame
|
||||
each entry in entries
|
||||
|
@ -2,6 +2,7 @@ package coreroutes
|
||||
|
||||
import (
|
||||
"github.com/aerogo/layout"
|
||||
"github.com/animenotifier/notify.moe/pages/activity"
|
||||
"github.com/animenotifier/notify.moe/pages/calendar"
|
||||
"github.com/animenotifier/notify.moe/pages/embed"
|
||||
"github.com/animenotifier/notify.moe/pages/home"
|
||||
@ -18,6 +19,9 @@ func Register(l *layout.Layout) {
|
||||
// Login
|
||||
l.Page("/login", login.Get)
|
||||
|
||||
// Activity
|
||||
l.Page("/activity", activity.Get)
|
||||
|
||||
// Calendar
|
||||
l.Page("/calendar", calendar.Get)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
component Post(post *arn.Post, user *arn.User)
|
||||
.thread
|
||||
.posts
|
||||
Postable(post.ToPostable(), user, "")
|
||||
Postable(post.ToPostable(), user, "", "")
|
||||
|
||||
.side-note.mountable
|
||||
a(href=post.Parent().Link())= post.Parent().TitleByUser(user)
|
||||
.side-note-container.mountable
|
||||
a.side-note(href=post.Parent().Link())= post.Parent().TitleByUser(user)
|
||||
|
@ -1,3 +1,6 @@
|
||||
.side-note-container
|
||||
horizontal
|
||||
justify-content flex-end
|
||||
|
||||
.side-note
|
||||
font-size 0.9rem
|
||||
text-align right !important
|
@ -79,7 +79,7 @@ component ProfileHead(viewUser *arn.User, user *arn.User, uri string)
|
||||
//- span= viewUser.Accounts.FinalFantasyXIV.Class
|
||||
|
||||
if viewUser.Registered != ""
|
||||
.profile-tag.tip.mountable.never-unmount(aria-label="Member since", data-mountable-type="header")
|
||||
.profile-tag.mountable.never-unmount(title="Member since", data-mountable-type="header")
|
||||
Icon("calendar")
|
||||
span= viewUser.RegisteredTime().Format("Jan 2006")
|
||||
|
||||
@ -93,6 +93,11 @@ component ProfileHead(viewUser *arn.User, user *arn.User, uri string)
|
||||
Icon("rocket")
|
||||
span= stringutils.Capitalize(viewUser.Role)
|
||||
|
||||
if !viewUser.IsActive()
|
||||
.profile-tag.mountable.never-unmount(title="Hasn't been online for the past 2 weeks", data-mountable-type="header")
|
||||
Icon("bed")
|
||||
span Inactive
|
||||
|
||||
//- if user != nil && user.ID != viewUser.ID
|
||||
//- a.button.profile-action(href="/compare/animelist/" + user.Nick + "/" + viewUser.Nick)
|
||||
//- Icon("exchange")
|
||||
|
@ -3,10 +3,10 @@ component Thread(thread *arn.Thread, posts []*arn.Post, user *arn.User)
|
||||
|
||||
#thread.thread(data-id=thread.ID)
|
||||
.posts
|
||||
Postable(thread.ToPostable(), user, thread.Creator().ID)
|
||||
Postable(thread.ToPostable(), user, "", thread.Creator().ID)
|
||||
|
||||
each post in posts
|
||||
Postable(post.ToPostable(), user, thread.Creator().ID)
|
||||
Postable(post.ToPostable(), user, "", thread.Creator().ID)
|
||||
|
||||
//- Reply
|
||||
if user != nil
|
||||
|
Loading…
Reference in New Issue
Block a user