The backend for the AiteStory website
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
590 B

7 years ago
  1. package viewmodel
  2. import (
  3. "fmt"
  4. "git.aiterp.net/AiteRP/aitestory/server"
  5. "git.aiterp.net/gisle/wrouter/auth"
  6. )
  7. // Base is the basic information used to render the page
  8. type Base struct {
  9. UserName string
  10. UserRole string
  11. UserLoggedIn bool
  12. ViewTitle string
  13. }
  14. // InitBase initializes the base of the viewmodel
  15. func (base *Base) InitBase(user *auth.User, viewTitle string) {
  16. if user != nil {
  17. base.UserName = user.ID
  18. base.UserRole = user.Data["role"]
  19. base.UserLoggedIn = false
  20. }
  21. base.ViewTitle = fmt.Sprintf("%s - %s", viewTitle, server.Main.Config.View.Title)
  22. }