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

@ -107,6 +107,20 @@ component Settings(user *arn.User)
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
//- Icon("cogs")

View File

@ -2,3 +2,6 @@
button,
.button
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.")
}