gosora/client/main.go
Azareal 9075798128 Alerts are now rendered via a client side transpiled template rather than being hard-coded.
Tweaked some bits to make them more 32-bit friendly for GopherJS, but this might not be necessary now.
Added notice.html
Added an alerts package to fix the import cycles, more things may be moved here soon.
Saved a few lines of accumulator code in a few stores.
Moved the AccountEditCriticalSubmit, AccountEditAvatar, AccountEditAvatarSubmit, AccountEditUsername, and AccountEditUsernameSubmit routes into the routes package.
Added a QueryRow method to AccSelectBuilder.
Tweaked the indentation in the generated templates.
Simplified the template render in the AccountEditUsernameSubmit route into a redirect back to the previous page.

Run the update script / patcher to replace the route names in the viewchunks table.
2018-05-14 18:56:56 +10:00

31 lines
644 B
Go

package main
import (
"bytes"
"../common"
"../common/alerts"
"../tmpl_gen"
"github.com/gopherjs/gopherjs/js"
)
func main() {
js.Global.Set("weakPassword", func(password string, username string, email string) string {
err := common.WeakPassword(password, username, email)
if err != nil {
return err.Error()
}
return ""
})
js.Global.Set("renderAlert", func(asid int, path string, msg string, avatar string) string {
var buf bytes.Buffer
alertItem := alerts.AlertItem{asid, path, msg, avatar}
err := tmpl.Template_alert(alertItem, &buf)
if err != nil {
println(err.Error())
}
return string(buf.Bytes())
})
}