Forum activity shown in user profiles

This commit is contained in:
2017-06-08 14:46:38 +02:00
parent 4a6e4378ce
commit 4f7ef694c8
13 changed files with 100 additions and 44 deletions

View File

@ -4,16 +4,28 @@ import (
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
)
const maxPosts = 5
// Get ...
func Get(ctx *aero.Context) string {
nick := ctx.Get("nick")
user, err := arn.GetUserByNick(nick)
viewUser, err := arn.GetUserByNick(nick)
user := utils.GetUser(ctx)
if err != nil {
return ctx.Error(404, "User not found", err)
}
return ctx.HTML(components.Profile(user, nil))
threads := viewUser.Threads()
arn.SortThreadsByDate(threads)
if len(threads) > maxPosts {
threads = threads[:maxPosts]
}
return ctx.HTML(components.Profile(viewUser, user, threads))
}

View File

@ -1,4 +1,4 @@
component Profile(viewUser *arn.User, user *arn.User)
component Profile(viewUser *arn.User, user *arn.User, threads []*arn.Thread)
.profile
img.profile-cover(src=viewUser.CoverImageURL())
@ -22,10 +22,10 @@ component Profile(viewUser *arn.User, user *arn.User)
//- Icon("home")
//- a(href=viewUser.website.startsWith('http') ? viewUser.website : 'http://' + viewUser.website, target='_blank', rel='nofollow')= viewUser.website.replace('http://', '').replace('https://', '')
//- if user != nil && (user.osu || user.osuDetails) && viewUser.osuDetails && viewUser.osuDetails.pp >= 1000
//- p.profile-field.osu(title='osu! performance points')
//- i.fa.fa-trophy
//- span= parseInt(viewUser.osuDetails.pp) + ' pp'
if viewUser.Accounts.Osu.Nick != "" && viewUser.Accounts.Osu.PP >= 1000
p.profile-field.osu(title="osu! performance points")
Icon("trophy")
span= toString(int(viewUser.Accounts.Osu.PP)) + " pp"
//- if viewUser.dataEditCount
//- p.profile-field.editor-contribution(title="Anime data modifications")
@ -44,20 +44,17 @@ component Profile(viewUser *arn.User, user *arn.User)
Icon("rocket")
span= arn.Capitalize(viewUser.Role)
//- .a
//- h3 Category
//- .a
//- h3 Category
//- .a
//- h3 Category
//- .a
//- h3 Category
//- .a
//- h3 Category
//- .a
//- h3 Category
//- nav.light-button-group
//- a.light-button(href="#") Bio
//- a.light-button(href="#") Anime
//- a.light-button(href="#") Forum
.profile-category
h3 Forum
each thread in threads
ThreadLink(thread)
.side-note
a.ajax(href="/+" + viewUser.Nick + "/threads") View all threads

View File

@ -17,6 +17,19 @@ profile-boot-duration = 2s
overflow hidden
.profile-field
text-align center
< 600px
.profile
vertical
align-items center
.intro-container
align-items center
margin-top calc(content-padding * 1.5)
padding-left content-padding
animation appear
0%
transform rotateX(90deg)
@ -48,17 +61,23 @@ animation cover-animation
.profile-image
border-radius 3px
width 320px !important
height 320px !important
object-fit cover
width 100%
height auto
.image-container
// ...
flex 1
max-width 320px
.intro-container
vertical
align-items flex-start
padding content-padding
padding-top 0
padding-left content-padding * 2
max-width 900px
padding-left calc(content-padding * 2)
max-width 900px
// Categories
.profile-category
// padding content-padding