Added birthday and gender fields

This commit is contained in:
Eduard Urbach 2018-11-06 18:28:50 +09:00
parent 81764b981c
commit daaa4c609f
9 changed files with 89 additions and 65 deletions

View File

@ -12,7 +12,7 @@ func Register(l *layout.Layout) {
l.Page("/settings", settings.Get(components.SettingsPersonal))
l.Page("/settings/accounts", settings.Get(components.SettingsAccounts))
l.Page("/settings/notifications", settings.Get(components.SettingsNotifications))
l.Page("/settings/apps", settings.Get(components.SettingsApps))
l.Page("/settings/formatting", settings.Get(components.SettingsFormatting))
l.Page("/settings/info", settings.Get(components.SettingsInfo))
l.Page("/settings/style", settings.Get(components.SettingsStyle))
l.Page("/settings/extras", settings.Get(components.SettingsExtras))
}

View File

@ -1,34 +0,0 @@
component SettingsApps(user *arn.User)
SettingsTabs
h1.page-title App settings
.settings
.widget.mountable
h3.widget-title
Icon("puzzle-piece")
span Apps
.widget-section
label Chrome Extension:
button.action(data-action="installExtension", data-trigger="click")
Icon("chrome")
span Get the Chrome Extension
.widget-section
label Firefox Extension:
a.button(href="https://addons.mozilla.org/en-US/firefox/addon/anime-notifier/", target="_blank", rel="nofollow")
Icon("firefox")
span Get the Firefox Extension
.widget-section
label Android Web App:
a.button(href="https://www.youtube.com/watch?v=opyt4cw0ep8", target="_blank", rel="noopener")
Icon("android")
span Get the Android Web App
.widget-section
label Desktop Web App:
button.action(data-action="installApp", data-trigger="click")
Icon("desktop")
span Get the Desktop Web App

View File

@ -4,6 +4,55 @@ component SettingsExtras(user *arn.User)
h1.page-title Extra settings
.settings
//- Apps
.widget.mountable
h3.widget-title
Icon("puzzle-piece")
span Apps
.widget-section
label Chrome Extension:
a.button(href="https://chrome.google.com/webstore/detail/anime-notifier/hajchfikckiofgilinkpifobdbiajfch", target="_blank", rel="nofollow")
Icon("chrome")
span Get the Chrome Extension
.widget-section
label Firefox Extension:
a.button(href="https://addons.mozilla.org/en-US/firefox/addon/anime-notifier/", target="_blank", rel="nofollow")
Icon("firefox")
span Get the Firefox Extension
.widget-section
label Android Web App:
a.button(href="https://www.youtube.com/watch?v=opyt4cw0ep8", target="_blank", rel="noopener")
Icon("android")
span Get the Android Web App
.widget-section
label Desktop Web App:
button.action(data-action="installApp", data-trigger="click")
Icon("desktop")
span Get the Desktop Web App
//- Developer
.widget.mountable(data-api="/api/settings/" + user.ID)
h3.widget-title
Icon("code")
span Developer
.widget-section
label API:
a.button(href="/api")
Icon("code")
span API
.widget-section
label GitHub:
a.button(href="https://github.com/animenotifier/notify.moe")
Icon("github")
span GitHub
//- PRO
.widget.mountable(data-api="/api/settings/" + user.ID)
h3.widget-title
Icon("star")
@ -23,21 +72,4 @@ component SettingsExtras(user *arn.User)
label Would you like to make this website more awesome?
a.button(href="/support")
Icon("star")
span Go PRO
.widget.mountable(data-api="/api/settings/" + user.ID)
h3.widget-title
Icon("code")
span Developer
.widget-section
label API:
a.button(href="/api")
Icon("code")
span API
.widget-section
label GitHub:
a.button(href="https://github.com/animenotifier/notify.moe")
Icon("github")
span GitHub
span Go PRO

27
pages/settings/info.pixy Normal file
View File

@ -0,0 +1,27 @@
component SettingsInfo(user *arn.User)
SettingsTabs
h1.page-title Info settings
.settings
.widget.mountable(data-api="/api/user/" + user.ID)
h3.widget-title
Icon("user-circle")
span Info
InputSelection("Gender", user.Gender, "Gender", "Your gender", arn.DataLists["genders"])
InputText("BirthDay", user.BirthDay, "Birthday", "YYYY-MM-DD")
InputText("Website", user.Website, "Website", "Your homepage")
.widget.mountable(data-api="/api/settings/" + user.ID)
h3.widget-title
Icon("user-secret")
span Privacy
InputBool("Privacy.ShowGender", user.Settings().Privacy.ShowGender, "Show gender", "Shows your gender on the profile page")
InputBool("Privacy.ShowAge", user.Settings().Privacy.ShowAge, "Show age", "Shows your age on the profile page")
InputBool("Privacy.ShowLocation", user.Settings().Privacy.ShowLocation, "Show location", "Shows your location on the profile page")
.footer
p Can only be made visible to logged in members.

View File

@ -10,9 +10,8 @@ component SettingsPersonal(user *arn.User)
span Personal
InputText("Nick", user.Nick, "Username", "Your username on notify.moe")
InputText("Website", user.Website, "Website", "Your homepage")
InputTextArea("Introduction", user.Introduction, "Introduction", "Tell us about yourself (Markdown is allowed)")
InputTextArea("Introduction", user.Introduction, "Introduction", "Tell us about yourself")
.widget.mountable(data-api="/api/settings/" + user.ID)
h3.widget-title
Icon("camera")

View File

@ -1,13 +1,13 @@
component SettingsFormatting(user *arn.User)
component SettingsStyle(user *arn.User)
SettingsTabs
h1.page-title Formatting settings
h1.page-title Style settings
.settings
.widget.mountable(data-api="/api/settings/" + user.ID)
h3.widget-title
Icon("font")
span Formatting
span Style
.widget-section
label(for="Theme")= "Theme:"

View File

@ -1,8 +1,8 @@
component SettingsTabs
.tabs
Tab("Personal", "user", "/settings")
Tab("Info", "info-circle", "/settings/info")
Tab("Accounts", "cubes", "/settings/accounts")
Tab("Notifications", "bell", "/settings/notifications")
Tab("Apps", "puzzle-piece", "/settings/apps")
Tab("Formatting", "font", "/settings/formatting")
Tab("Style", "font", "/settings/style")
Tab("Extras", "star", "/settings/extras")

View File

@ -30,8 +30,8 @@ func main() {
user.IP = ""
user.Accounts.Facebook.ID = ""
user.Accounts.Google.ID = ""
user.AgeRange = arn.UserAgeRange{}
user.Location = &arn.Location{}
user.BirthDay = ""
user.PushSubscriptions().Items = []*arn.PushSubscription{}
user.PushSubscriptions().Save()

View File

@ -466,9 +466,9 @@ var routeTests = map[string][]string{
"/settings": nil,
"/settings/accounts": nil,
"/settings/notifications": nil,
"/settings/apps": nil,
"/settings/info": nil,
"/settings/avatar": nil,
"/settings/formatting": nil,
"/settings/style": nil,
"/settings/extras": nil,
"/shop": nil,
"/shop/history": nil,