Removed avatar source settings

This commit is contained in:
Eduard Urbach 2018-03-03 18:38:21 +01:00
parent 58b54fe908
commit 97120c13f5
2 changed files with 34 additions and 31 deletions

View File

@ -27,30 +27,31 @@ component SettingsPersonal(user *arn.User)
Icon("picture-o")
span Avatar
.widget-section
label(for="Avatar.Source") Source:
select.widget-ui-element.action(id="Avatar.Source", data-field="Avatar.Source", value=user.Settings().Avatar.Source, data-action="save", data-trigger="change")
option(value="") Automatic
option(value="Gravatar") Gravatar
option(value="URL") Link
option(value="FileSystem") Upload
//- .widget-section
//- label(for="Avatar.Source") Source:
//- select.widget-ui-element.action(id="Avatar.Source", data-field="Avatar.Source", value=user.Settings().Avatar.Source, data-action="save", data-trigger="change")
//- option(value="") Automatic
//- option(value="Gravatar") Gravatar
//- option(value="URL") Link
//- option(value="FileSystem") Upload
//- URL input
if user.Settings().Avatar.Source == "URL"
InputText("Avatar.SourceURL", user.Settings().Avatar.SourceURL, "Link", "Post the link to the image here")
//- //- URL input
//- if user.Settings().Avatar.Source == "URL"
//- InputText("Avatar.SourceURL", user.Settings().Avatar.SourceURL, "Link", "Post the link to the image here")
//- Gravatar preview image
if user.Settings().Avatar.Source == "Gravatar" || (user.Settings().Avatar.Source == "" && user.Avatar.Source == "Gravatar")
.profile-image-container.avatar-preview
img.profile-image.mountable(src=user.Gravatar(), alt="Gravatar (" + user.Email + ")", title="Gravatar (" + user.Email + ")")
//- //- Gravatar preview image
//- if user.Settings().Avatar.Source == "Gravatar" || (user.Settings().Avatar.Source == "" && user.Avatar.Source == "Gravatar")
//- .profile-image-container.avatar-preview
//- img.profile-image.mountable(src=user.Gravatar(), alt="Gravatar (" + user.Email + ")", title="Gravatar (" + user.Email + ")")
//- URL preview image
if user.Settings().Avatar.Source == "URL" && user.Settings().Avatar.SourceURL != ""
.profile-image-container.avatar-preview
img.profile-image.mountable(src=strings.Replace(user.Settings().Avatar.SourceURL, "http://", "https://", 1), alt="Avatar preview")
//- //- URL preview image
//- if user.Settings().Avatar.Source == "URL" && user.Settings().Avatar.SourceURL != ""
//- .profile-image-container.avatar-preview
//- img.profile-image.mountable(src=strings.Replace(user.Settings().Avatar.SourceURL, "http://", "https://", 1), alt="Avatar preview")
//- //- File upload
//- if user.Settings().Avatar.Source == "FileSystem"
//- File upload
if user.Settings().Avatar.Source == "FileSystem"
InputImage("avatar-input", "File")
.profile-image-container.avatar-preview

View File

@ -9,6 +9,10 @@ export function selectFile(arn: AnimeNotifier, button: HTMLButtonElement) {
input.onchange = () => {
let file = input.files[0]
if(!file) {
return
}
previewImage(file, preview)
uploadFile(file, "/api/upload/avatar", arn)
}
@ -31,9 +35,7 @@ function previewImage(file: File, preview: HTMLImageElement) {
preview.src = reader.result
}
if(file) {
reader.readAsDataURL(file)
}
}
// Upload file