Avatar struct patch

This commit is contained in:
Eduard Urbach 2017-07-17 19:49:52 +02:00
parent 98519b7b02
commit 98c4b90e9f
5 changed files with 44 additions and 3 deletions

View File

@ -2,7 +2,7 @@ component ProfileHeader(viewUser *arn.User, user *arn.User, uri string)
.profile
img.profile-cover(src=viewUser.CoverImageURL(), alt="Cover image")
.image-container.mountable.never-unmount
.profile-image-container.mountable.never-unmount
ProfileImage(viewUser)
.intro-container.mountable.never-unmount

View File

@ -68,7 +68,7 @@ profile-boot-duration = 2s
width 100%
height auto
.image-container
.profile-image-container
flex 1
max-width 280px
max-height 280px

View File

@ -106,6 +106,20 @@ component Settings(user *arn.User)
a.button(href="https://www.youtube.com/watch?v=opyt4cw0ep8", target="_blank", rel="noopener")
Icon("android")
span Get the Android App
.widget.mountable
h3.widget-title
Icon("picture-o")
span Avatar
.widget-input
label(for="AvatarSource") Source:
select.widget-element.action(id="AvatarSource", data-field="AvatarSource", value="Gravatar", data-action="save", data-trigger="change")
option(value="Gravatar") Gravatar
if "Gravatar" == "Gravatar"
.profile-image-container.avatar-preview
img.profile-image(src=user.Gravatar(), alt="Gravatar")
//- .widget.mountable(data-api="/api/settings/" + user.ID)
//- h3.widget-title

View File

@ -1,4 +1,7 @@
.widget-input
button,
.button
margin-bottom 1rem
margin-bottom 1rem
.avatar-preview
margin 0 auto

View File

@ -0,0 +1,24 @@
package main
import (
"github.com/animenotifier/arn"
"github.com/fatih/color"
"github.com/jinzhu/copier"
)
func main() {
color.Yellow("Updating user struct")
// Iterate over the stream
for user := range arn.MustStreamUsers() {
newUser := &arn.UserNew{}
copier.Copy(newUser, user)
newUser.Avatar.Extension = user.Avatar
// Save in DB
arn.PanicOnError(arn.DB.Set("User", user.ID, newUser))
}
color.Green("Finished.")
}