60 lines
1.6 KiB
Plaintext
60 lines
1.6 KiB
Plaintext
package base
|
|
|
|
import (
|
|
"github.com/zhang2092/go-url-shortener/internal/templ/css"
|
|
"github.com/zhang2092/go-url-shortener/internal/templ/funcs"
|
|
"github.com/zhang2092/go-url-shortener/internal/templ/js"
|
|
)
|
|
|
|
templ Base(page string) {
|
|
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="utf-8"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
|
|
<link rel="shortcut icon" href="/assets/favicon.ico" type="image/x-icon"/>
|
|
<link rel="stylesheet" href="/assets/css/bootstrap.min.css"/>
|
|
<link rel="stylesheet" href="/assets/css/index.css"/>
|
|
switch page {
|
|
case "home":
|
|
@css.HomeCSS()
|
|
}
|
|
<title>URL段地址服务</title>
|
|
</head>
|
|
<body>
|
|
<div class="wrapper">
|
|
<nav class="navbar navbar-light bg-light navbar-wh">
|
|
<a class="navbar-brand navbar-brand-fs" href="/">
|
|
URL段地址服务
|
|
</a>
|
|
<ul class="flex oauth">
|
|
{{ auth := funcs.GetAuthorize(ctx) }}
|
|
if auth != nil {
|
|
<li style="font-size: 12px;">
|
|
欢迎您: { auth.Name }
|
|
</li>
|
|
<li style="font-size: 12px;">
|
|
<a href="/logout" class="btn btn-primary btn-sm">退出</a>
|
|
</li>
|
|
} else {
|
|
<li>
|
|
<a href="/login" class="btn btn-outline-primary btn-sm">登录</a>
|
|
</li>
|
|
<li>
|
|
<a href="/register" class="btn btn-primary btn-sm">注册</a>
|
|
</li>
|
|
}
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
{ children... }
|
|
<script src="/assets/js/jquery.min.js"></script>
|
|
<script src="/assets/js/bootstrap.bundle.min.js"></script>
|
|
switch page {
|
|
case "home":
|
|
@js.HomeJS()
|
|
}
|
|
</body>
|
|
</html>
|
|
}
|