adding the news, man
This commit is contained in:
parent
c3b570dd24
commit
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) {
|
func login(w http.ResponseWriter, r *http.Request) {
|
||||||
text, err := template.ParseFiles("ui/html/base.html", "ui/html/login.html")
|
text, err := template.ParseFiles("ui/html/base.html", "ui/html/login.html")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -71,6 +71,7 @@ func main() {
|
|||||||
mux.HandleFunc("/favicon.ico", favicon)
|
mux.HandleFunc("/favicon.ico", favicon)
|
||||||
|
|
||||||
mux.HandleFunc("/", home)
|
mux.HandleFunc("/", home)
|
||||||
|
mux.HandleFunc("/news", news)
|
||||||
mux.HandleFunc("/login", login)
|
mux.HandleFunc("/login", login)
|
||||||
mux.HandleFunc("/logout", logout)
|
mux.HandleFunc("/logout", logout)
|
||||||
mux.HandleFunc("/register", register)
|
mux.HandleFunc("/register", register)
|
||||||
|
|||||||
@ -22,17 +22,18 @@
|
|||||||
<nav>
|
<nav>
|
||||||
<a href="/"><h1 class="maintitle">Alfheim</h1></a>
|
<a href="/"><h1 class="maintitle">Alfheim</h1></a>
|
||||||
<div class="navbuttons">
|
<div class="navbuttons">
|
||||||
{{if not .ActiveSubscription}}
|
<a href="/news"><div class="alfheimbutton"><strong>News</strong></div></a>
|
||||||
<a href="/subscribe"><div class="loginbutton"><strong>Subscribe</strong></div></a>
|
{{if not .ActiveSubscription}}
|
||||||
{{end}}
|
<a href="/subscribe"><div class="alfheimbutton"><strong>Subscribe</strong></div></a>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
{{if .AuthenticatedUser}}
|
{{if .AuthenticatedUser}}
|
||||||
<a href="/account"><div class="loginbutton"><strong>Account</strong></div></a>
|
<a href="/account"><div class="alfheimbutton"><strong>Account</strong></div></a>
|
||||||
<a href="/logout"><div class="loginbutton"><strong>Log out</strong></div></a>
|
<a href="/logout"><div class="alfheimbutton"><strong>Log out</strong></div></a>
|
||||||
{{else}}
|
{{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="/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="loginbutton"><strong>Register</strong></div></a>
|
<a href="/register"><div class="alfheimbutton"><strong>Register</strong></div></a>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
|||||||
@ -22,9 +22,9 @@ body {
|
|||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
header {
|
/* header {
|
||||||
|
|
||||||
}
|
} */
|
||||||
|
|
||||||
nav {
|
nav {
|
||||||
padding-left: 8px;
|
padding-left: 8px;
|
||||||
@ -50,7 +50,7 @@ nav {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.loginbutton {
|
.alfheimbutton {
|
||||||
align-self: center;
|
align-self: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
border: 12px solid;
|
border: 12px solid;
|
||||||
@ -90,9 +90,10 @@ p {
|
|||||||
border-radius: 15px;
|
border-radius: 15px;
|
||||||
padding: 30px 40px;
|
padding: 30px 40px;
|
||||||
font-size: 1.5rem;
|
font-size: 1.5rem;
|
||||||
|
margin: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wrapper {
|
/* .wrapper {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
border: 2px solid white;
|
border: 2px solid white;
|
||||||
@ -102,6 +103,27 @@ p {
|
|||||||
padding: 30px 40px;
|
padding: 30px 40px;
|
||||||
width: 80%;
|
width: 80%;
|
||||||
text-align: center;
|
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 {
|
.wrapper h1 {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user