73 lines
3.2 KiB
Plaintext
Raw Normal View History

2018-11-12 06:05:46 +00:00
component ActivityFeed(entries []arn.Activity, nextIndex int, user *arn.User)
h1.page-title Activity
.tabs
Tab("Global", "globe", "/activity")
Tab("Followed", "user-plus", "/activity/followed")
2018-10-31 05:27:48 +00:00
2018-11-12 06:05:46 +00:00
if len(entries) == 0
p.no-data.mountable No activity here.
else
#load-more-target.activities
ActivitiesScrollable(entries, user)
if nextIndex != -1
.buttons
LoadMore(nextIndex)
#load-new-activities(data-count="0")
.buttons
button.page-main-action.action(data-action="reloadContent", data-trigger="click")
Icon("refresh")
span#load-new-activities-text 0 new activities
2018-10-31 05:27:48 +00:00
2018-11-12 06:05:46 +00:00
component ActivitiesScrollable(entries []arn.Activity, user *arn.User)
each entry in entries
Activity(entry, user)
2018-11-12 01:41:46 +00:00
component Activity(activity arn.Activity, user *arn.User)
.activity.post-parent.mountable(id=fmt.Sprintf("activity-%s", activity.GetID()))
2018-11-12 01:41:46 +00:00
.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
2018-11-12 05:52:02 +00:00
if user != nil && user.ID == activity.GetCreatedBy() && activity.Type() == "ActivityConsumeAnime"
2018-11-12 06:05:46 +00:00
button.activity-action.tip.action(data-action="deleteObject", data-trigger="click", aria-label="Delete", data-return-path="/activity", data-confirm-type="activity", data-api=fmt.Sprintf("/api/%s/%s", strings.ToLower(activity.Type()), activity.GetID()))
2018-11-12 05:52:02 +00:00
RawIcon("trash")
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.actvity-text-consume-anime= fmt.Sprintf("%s watched episodes %d - %d", activity.Creator().Nick, activity.FromEpisode, activity.ToEpisode)
2018-11-12 02:40:46 +00:00
else
em.actvity-text-consume-anime= fmt.Sprintf("%s watched episode %d", activity.Creator().Nick, 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)
else if activity.ObjectType == "AMV" || activity.ObjectType == "SoundTrack" || activity.ObjectType == "Quote"
a(href=activity.Object().(arn.PostParent).Link())= activity.Object().(arn.PostParent).TitleByUser(user)
2018-11-12 01:41:46 +00:00
component ActivityCreateText(activity *arn.ActivityCreate, user *arn.User)
if activity.ObjectType == "Post" || activity.ObjectType == "Thread"
div!= activity.Postable().HTML()
else
em.actvity-text-create= "new " + strings.ToLower(activity.ObjectType)