57 lines
2.4 KiB
Plaintext
Raw Normal View History

2018-11-12 01:41:46 +00:00
component ActivityFeed(entries []arn.Activity, user *arn.User)
2018-10-31 05:27:48 +00:00
h1 Activity
.activities
each entry in entries
2018-11-11 22:48:16 +00:00
Activity(entry, user)
2018-10-31 05:27:48 +00:00
2018-11-12 01:41:46 +00:00
component Activity(activity arn.Activity, user *arn.User)
.activity.post-parent(id=fmt.Sprintf("activity-%s", activity.GetID()))
.post-author
Avatar(activity.Creator())
.post-content
.activity-header
.activity-parent
if activity.Type() == "ActivityCreate"
ActivityCreateTitle(activity.(*arn.ActivityCreate), user)
2018-11-12 02:40:46 +00:00
else if activity.Type() == "ActivityConsumeAnime"
ActivityConsumeAnimeTitle(activity.(*arn.ActivityConsumeAnime), user)
2018-11-12 01:41:46 +00:00
.activity-date.utc-date(data-date=activity.GetCreated())
if activity.Type() == "ActivityCreate"
ActivityCreateText(activity.(*arn.ActivityCreate), user)
2018-11-12 02:40:46 +00:00
else if activity.Type() == "ActivityConsumeAnime"
ActivityConsumeAnimeText(activity.(*arn.ActivityConsumeAnime), user)
component ActivityConsumeAnimeTitle(activity *arn.ActivityConsumeAnime, user *arn.User)
a(href=activity.Anime().Link())= activity.Anime().TitleByUser(user)
component ActivityConsumeAnimeText(activity *arn.ActivityConsumeAnime, user *arn.User)
if activity.ToEpisode > activity.FromEpisode
em= fmt.Sprintf("watched episodes %d - %d", activity.FromEpisode, activity.ToEpisode)
else
em= fmt.Sprintf("watched episode %d", activity.ToEpisode)
2018-11-12 01:41:46 +00:00
component ActivityCreateTitle(activity *arn.ActivityCreate, user *arn.User)
if activity.ObjectType == "Post"
a(href=activity.Postable().Parent().Link())= activity.Postable().Parent().TitleByUser(user)
else if activity.ObjectType == "Thread"
a(href=activity.Postable().Link())= activity.Postable().TitleByUser(user)
component ActivityCreateText(activity *arn.ActivityCreate, user *arn.User)
if activity.ObjectType == "Post" || activity.ObjectType == "Thread"
div!= activity.Postable().HTML()
2018-11-11 22:48:16 +00:00
//- component ActivityFeed(entries []*arn.EditLogEntry, user *arn.User)
//- h1 Activity
//- .activities
//- each entry in entries
//- ActivityPost(entry.Object().(arn.Postable), user)
//- component ActivityPost(post arn.Postable, user *arn.User)
//- if post.Parent() != nil
//- Postable(post, user, false, fmt.Sprintf(`<p class="activity-header"><a href="%s">%s</a></p>`, post.Parent().Link(), html.EscapeString(post.Parent().TitleByUser(user))), "")
//- else
//- Postable(post, user, false, fmt.Sprintf(`<p class="activity-header"><a href="%s">%s</a></p>`, post.Link(), html.EscapeString(post.TitleByUser(user))), "")