Compare commits
2 Commits
c3b570dd24
...
ae0008d2ca
| Author | SHA1 | Date | |
|---|---|---|---|
| ae0008d2ca | |||
| 673fe6cd69 |
@ -107,6 +107,35 @@ func home(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
func news(w http.ResponseWriter, r *http.Request) {
|
||||
id := authenticatedUser(w, r)
|
||||
account, _ := users.GetAccount(id)
|
||||
|
||||
active_subscription := subscriptions.HasActiveSubscription(id)
|
||||
|
||||
text, err := template.ParseFiles("ui/html/base.html", "ui/html/news.html")
|
||||
if err != nil {
|
||||
http.Error(w, "Internal Server Error", 500)
|
||||
log.Println(err)
|
||||
}
|
||||
|
||||
switch r.Method {
|
||||
case http.MethodGet:
|
||||
err := text.Execute(w, TemplateData{AuthenticatedUser: id, Account: account, ActiveSubscription: active_subscription})
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
http.Error(w, "Internal Server Error", 500)
|
||||
}
|
||||
|
||||
case http.MethodPost:
|
||||
err := text.Execute(w, TemplateData{})
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
http.Error(w, "Internal Server Error", 500)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func login(w http.ResponseWriter, r *http.Request) {
|
||||
text, err := template.ParseFiles("ui/html/base.html", "ui/html/login.html")
|
||||
if err != nil {
|
||||
|
||||
@ -71,6 +71,7 @@ func main() {
|
||||
mux.HandleFunc("/favicon.ico", favicon)
|
||||
|
||||
mux.HandleFunc("/", home)
|
||||
mux.HandleFunc("/news", news)
|
||||
mux.HandleFunc("/login", login)
|
||||
mux.HandleFunc("/logout", logout)
|
||||
mux.HandleFunc("/register", register)
|
||||
|
||||
@ -22,17 +22,18 @@
|
||||
<nav>
|
||||
<a href="/"><h1 class="maintitle">Alfheim</h1></a>
|
||||
<div class="navbuttons">
|
||||
{{if not .ActiveSubscription}}
|
||||
<a href="/subscribe"><div class="loginbutton"><strong>Subscribe</strong></div></a>
|
||||
{{end}}
|
||||
<a href="/news"><div class="alfheimbutton"><strong>News</strong></div></a>
|
||||
{{if not .ActiveSubscription}}
|
||||
<a href="/subscribe"><div class="alfheimbutton"><strong>Subscribe</strong></div></a>
|
||||
{{end}}
|
||||
|
||||
{{if .AuthenticatedUser}}
|
||||
<a href="/account"><div class="loginbutton"><strong>Account</strong></div></a>
|
||||
<a href="/logout"><div class="loginbutton"><strong>Log out</strong></div></a>
|
||||
{{else}}
|
||||
<a href="/login"><div class="loginbutton"><strong>Log in</strong><img src="/static/login_24dp_FILL0_wght400_GRAD0_opsz24.svg" alt=""/></div></a>
|
||||
<a href="/register"><div class="loginbutton"><strong>Register</strong></div></a>
|
||||
{{end}}
|
||||
{{if .AuthenticatedUser}}
|
||||
<a href="/account"><div class="alfheimbutton"><strong>Account</strong></div></a>
|
||||
<a href="/logout"><div class="alfheimbutton"><strong>Log out</strong></div></a>
|
||||
{{else}}
|
||||
<a href="/login"><div class="alfheimbutton"><strong>Log in</strong><img src="/static/login_24dp_FILL0_wght400_GRAD0_opsz24.svg" alt=""/></div></a>
|
||||
<a href="/register"><div class="alfheimbutton"><strong>Register</strong></div></a>
|
||||
{{end}}
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
3
ui/html/news.html
Normal file
3
ui/html/news.html
Normal file
@ -0,0 +1,3 @@
|
||||
{{define "body"}}
|
||||
<p>NEWS!!</p>
|
||||
{{end}}
|
||||
@ -22,9 +22,9 @@ body {
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
header {
|
||||
/* header {
|
||||
|
||||
}
|
||||
} */
|
||||
|
||||
nav {
|
||||
padding-left: 8px;
|
||||
@ -50,7 +50,7 @@ nav {
|
||||
}
|
||||
}
|
||||
|
||||
.loginbutton {
|
||||
.alfheimbutton {
|
||||
align-self: center;
|
||||
display: flex;
|
||||
border: 12px solid;
|
||||
@ -90,9 +90,10 @@ p {
|
||||
border-radius: 15px;
|
||||
padding: 30px 40px;
|
||||
font-size: 1.5rem;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
/* .wrapper {
|
||||
display: inline-block;
|
||||
background: transparent;
|
||||
border: 2px solid white;
|
||||
@ -102,6 +103,27 @@ p {
|
||||
padding: 30px 40px;
|
||||
width: 80%;
|
||||
text-align: center;
|
||||
margin: 10px;
|
||||
} */
|
||||
|
||||
.wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 20px;
|
||||
background: transparent;
|
||||
border: 2px solid white;
|
||||
backdrop-filter: blur(20px);
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
|
||||
border-radius: 15px;
|
||||
padding: 30px 40px;
|
||||
width: 80%;
|
||||
text-align: center;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.wrapper form {
|
||||
width: 100%; /* make each form stretch full width */
|
||||
}
|
||||
|
||||
.wrapper h1 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user