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.

template.go 1.0KB

1234567891011121314151617181920212223242526272829
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package dev
  5. import (
  6. "net/http"
  7. "code.gitea.io/gitea/models"
  8. "code.gitea.io/gitea/modules/base"
  9. "code.gitea.io/gitea/modules/context"
  10. "code.gitea.io/gitea/modules/setting"
  11. "code.gitea.io/gitea/modules/timeutil"
  12. )
  13. // TemplatePreview render for previewing the indicated template
  14. func TemplatePreview(ctx *context.Context) {
  15. ctx.Data["User"] = models.User{Name: "Unknown"}
  16. ctx.Data["AppName"] = setting.AppName
  17. ctx.Data["AppVer"] = setting.AppVer
  18. ctx.Data["AppUrl"] = setting.AppURL
  19. ctx.Data["Code"] = "2014031910370000009fff6782aadb2162b4a997acb69d4400888e0b9274657374"
  20. ctx.Data["ActiveCodeLives"] = timeutil.MinutesToFriendly(setting.Service.ActiveCodeLives, ctx.Locale.Language())
  21. ctx.Data["ResetPwdCodeLives"] = timeutil.MinutesToFriendly(setting.Service.ResetPwdCodeLives, ctx.Locale.Language())
  22. ctx.Data["CurDbValue"] = ""
  23. ctx.HTML(http.StatusOK, base.TplName(ctx.Params("*")))
  24. }