Initial Commit

This commit is contained in:
2017-10-01 17:02:27 +02:00
commit 27032ed489
15 changed files with 834 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
package viewmodel
import (
"fmt"
"git.aiterp.net/AiteRP/aitestory/server"
"git.aiterp.net/gisle/wrouter/auth"
)
// Base is the basic information used to render the page
type Base struct {
UserName string
UserRole string
UserLoggedIn bool
ViewTitle string
}
// InitBase initializes the base of the viewmodel
func (base *Base) InitBase(user *auth.User, viewTitle string) {
if user != nil {
base.UserName = user.ID
base.UserRole = user.Data["role"]
base.UserLoggedIn = false
}
base.ViewTitle = fmt.Sprintf("%s - %s", viewTitle, server.Main.Config.View.Title)
}