Tweak frontend
This commit is contained in:
@ -9,24 +9,47 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/static/styles.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header class="navbar">
|
||||
<div class="container">
|
||||
<nav class="main navbar navbar-expand-lg">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="/">
|
||||
<img src="/static/example.png" alt="">
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
|
||||
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a href="/" class='nav-link {{ if .activePage == "index" }}active{{ end }}'>
|
||||
Frontpage
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="/users" class='nav-link {{ if .activePage == "users" }}active{{ end }}'>
|
||||
Users
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="/about" class='nav-link {{ if .activePage == "about" }}active{{ end }}'>
|
||||
About
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="container mt-3">
|
||||
<h1>{{ title }}</h1>
|
||||
|
||||
<ul class="nav">
|
||||
<li class="nav-item">
|
||||
<a href="/" class="nav-link">Frontpage</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="/users" class="nav-link">Users</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="/about" class="nav-link">About</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<main>
|
||||
{{ yield mainContent() }}
|
||||
</main>
|
||||
|
||||
@ -4,27 +4,21 @@
|
||||
|
||||
{{ block mainContent() }}
|
||||
|
||||
<div class="row mt-5">
|
||||
<div class="col">
|
||||
<form method="post" action="/">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Email address</label>
|
||||
<input type="email" name="email" class="form-control" value="edkirin@gmail.com">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Password</label>
|
||||
<input type="text" name="password" class="form-control" value="tralala">
|
||||
</div>
|
||||
<div class="row mt-5 mb-5">
|
||||
<form class="col-6" method="post" action="/">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Email address</label>
|
||||
<input type="email" name="email" class="form-control" value="edkirin@gmail.com">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Password</label>
|
||||
<input type="text" name="password" class="form-control" value="tralala">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-success">
|
||||
Submit
|
||||
</button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<div class="col">
|
||||
<img src="/static/sample.jpg" class="img-fluid" alt="">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success">
|
||||
Submit
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,6 @@
|
||||
|
||||
<h3>Users</h3>
|
||||
|
||||
{{ yield usersTable(users=users) }}
|
||||
{{ yield usersTable(users=.users) }}
|
||||
|
||||
{{ end }}
|
||||
@ -3,7 +3,11 @@ package views
|
||||
import "github.com/kataras/iris/v12"
|
||||
|
||||
func GetAboutPage(ctx iris.Context) {
|
||||
if err := ctx.View("pages/about.jet"); err != nil {
|
||||
vars := iris.Map{
|
||||
"activePage": "about",
|
||||
}
|
||||
|
||||
if err := ctx.View("pages/about.jet", vars); err != nil {
|
||||
showError(ctx, err)
|
||||
return
|
||||
}
|
||||
|
||||
@ -7,7 +7,11 @@ import (
|
||||
)
|
||||
|
||||
func GetIndexPage(ctx iris.Context) {
|
||||
if err := ctx.View("pages/index.jet"); err != nil {
|
||||
vars := iris.Map{
|
||||
"activePage": "index",
|
||||
}
|
||||
|
||||
if err := ctx.View("pages/index.jet", vars); err != nil {
|
||||
showError(ctx, err)
|
||||
return
|
||||
}
|
||||
|
||||
@ -27,9 +27,12 @@ func GetUsersPage(ctx iris.Context) {
|
||||
isActive := true
|
||||
users := userRepository.List(&repository.UserFilter{IsActive: &isActive}, &pagination, &ordering)
|
||||
|
||||
ctx.ViewData("users", users)
|
||||
vars := iris.Map{
|
||||
"activePage": "users",
|
||||
"users": users,
|
||||
}
|
||||
|
||||
if err := ctx.View("pages/users.jet"); err != nil {
|
||||
if err := ctx.View("pages/users.jet", vars); err != nil {
|
||||
showError(ctx, err)
|
||||
return
|
||||
}
|
||||
@ -43,6 +46,7 @@ func EditUserPage(ctx iris.Context) {
|
||||
user := userRepository.Get(&filter)
|
||||
|
||||
vars := iris.Map{
|
||||
"activePage": "users",
|
||||
"user": user,
|
||||
"currentPath": ctx.Path(),
|
||||
"backlink": "/users",
|
||||
|
||||
BIN
static/example.png
Normal file
BIN
static/example.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 33 KiB |
6
static/styles.css
Normal file
6
static/styles.css
Normal file
@ -0,0 +1,6 @@
|
||||
header.navbar {
|
||||
background-color: #e0e0e0;
|
||||
}
|
||||
header.navbar .navbar-brand img {
|
||||
max-height: 80px;
|
||||
}/*# sourceMappingURL=styles.css.map */
|
||||
1
static/styles.css.map
Normal file
1
static/styles.css.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["styles.scss","styles.css"],"names":[],"mappings":"AAAA;EACI,yBAAA;ACCJ;ADAI;EACI,gBAAA;ACER","file":"styles.css"}
|
||||
6
static/styles.scss
Normal file
6
static/styles.scss
Normal file
@ -0,0 +1,6 @@
|
||||
header.navbar {
|
||||
background-color: #e0e0e0;
|
||||
.navbar-brand img {
|
||||
max-height: 80px;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user