Added cover image support for the beta

This commit is contained in:
2016-11-20 19:26:11 +09:00
parent c89add3967
commit 614ff87246
16 changed files with 316 additions and 23 deletions

View File

@ -12,7 +12,7 @@ func Get(ctx *aero.Context) string {
anime, err := arn.GetAnime(id)
if err != nil {
return ctx.Text("Anime not found")
return ctx.Error(404, "Anime not found")
}
return ctx.HTML(components.Anime(anime))

View File

@ -13,6 +13,11 @@ func Get(ctx *aero.Context) string {
var genres []*arn.Genre
for _, genreName := range arn.Genres {
// Skip this genre because it doesn't get processed in the background jobs
if genreName == "Hentai" {
continue
}
genre, err := arn.GetGenre(arn.GetGenreIDByName(genreName))
if err == nil {

19
pages/profile/profile.go Normal file
View File

@ -0,0 +1,19 @@
package profile
import (
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
)
// Get ...
func Get(ctx *aero.Context) string {
nick := ctx.Get("nick")
user, err := arn.GetUserByNick(nick)
if err != nil {
return ctx.Error(404, "User not found")
}
return ctx.HTML(components.Profile(user, nil))
}

View File

@ -0,0 +1,63 @@
component Profile(viewUser *arn.User, user *arn.User)
.profile
.profile-cover(style=viewUser.CoverImageStyle())
.image-container
ProfileImage(viewUser)
.intro-container
h2#nick= viewUser.Nick
if viewUser.Tagline != ""
p.profile-field.tagline
Icon("comment")
span.tagline= viewUser.Tagline
else
p.profile-field.tagline
Icon("comment")
span.tagline No tagline yet.
//- if user != nil && viewUser.website
//- p.profile-field.website
//- 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.dataEditCount
//- p.profile-field.editor-contribution(title="Anime data modifications")
//- Icon("edit")
//- span= viewUser.dataEditCount
if viewUser.Registered != ""
p.profile-field.registration-date(title="Member since")
Icon("calendar")
//- span= time.Parse(time.RFC3339, viewUser.Registered)
span= viewUser.Registered[:4]
//- span= monthNames[joined.getMonth()] + ' ' + joined.getFullYear()
if viewUser.Role != ""
p.profile-field.role
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

165
pages/profile/profile.styl Normal file
View File

@ -0,0 +1,165 @@
.profile
position relative
left contentPadding * -1
top contentPadding * -1
min-width 100%
padding contentPadding
box-sizing content-box
color white
text-shadow 0px 0px 1px rgba(0, 0, 0, 0.1)
transition all transitionSpeed ease
animation-name appear
animation-duration transitionSpeed
&:hover
.profile-cover
filter brightness(28%)
.profile-cover
position absolute
left 0
top 0
width 100%
height 100%
z-index -1
background-size cover
filter brightness(35%)
transition filter transitionSpeed ease
@keyframes appear
0%
transform rotateX(90deg)
filter opacity(0) saturate(0) blur(10px)
100%
transform rotateX(0)
filter opacity(1) saturate(1) blur(0)
.profile-image
border-radius 3px
width 320px
height 320px !important
margin contentPadding
object-fit cover
#anime-list-container
flex 1.5
.image-container
float left
width auto
.intro-container
float left
width auto
display flex
flex-flow column
align-items center
padding 1.5em
max-width 900px
.user-actions
float right
display flex
flex-flow row
justify-content center
.user-action
max-width 250px
#nick
text-align left
margin-top 0
margin-bottom 0
.profile-field
margin-bottom 0.2em
.location
// ...
.role
opacity 0.6
.list-provider-username
margin-top 0
margin-bottom 0
font-size 0.9em
.main
// ...
.alternative
opacity 0.4
.report-bug-hint
//
.loading-message
margin 0 auto
text-align center
opacity 0.4
#embedded-footer
position fixed
bottom 4em
right calc(16px + 1em)
text-align right
z-index 1
font-size 0.9em
display flex
flex-flow row
.user
display inline-block
width auto
height auto
margin-right 1em
.embedded-footer-info
display flex
flex-flow column
.embedded-footer-nick
text-align left
opacity 0.5
.embedded-footer-separator
opacity 0.2
.appear
animation-name appear-animation
animation-duration 1s
@keyframes appear-animation
0%
opacity 0
100%
opacity 1
@media only screen and (max-width: 900px)
.intro-container
margin 1em 0
padding 0
width 100%
text-align center !important
#anime-list-container
.image-container
.user-actions
width 100%
#nick
.profile-field
width 100%
text-align center
@media only screen and (min-width: 900px)
#posts
margin-left 0.5em
@media only screen and (max-width: 800px)
.airing-date-prefix
display none

View File

@ -14,7 +14,7 @@ func Get(ctx *aero.Context) string {
thread, err := arn.GetThread(id)
if err != nil {
return ctx.Text("Thread not found")
return ctx.Error(404, "Thread not found")
}
thread.Author, _ = arn.GetUser(thread.AuthorID)
@ -26,7 +26,7 @@ func Get(ctx *aero.Context) string {
sort.Sort(replies)
if filterErr != nil {
return ctx.Text("Error fetching thread replies")
return ctx.Error(500, "Error fetching thread replies")
}
return ctx.HTML(components.Thread(thread, replies))