Compare commits
No commits in common. "a66e26477c2d52332099c0ecba26ea31520aeeaf" and "6e1095019fb7c0f07096cdddf046292759b03d88" have entirely different histories.
a66e26477c
...
6e1095019f
6 changed files with 11 additions and 13 deletions
|
@ -1,10 +1,11 @@
|
||||||
{{define "header"}}
|
{{define "header"}}
|
||||||
<header>
|
<header>
|
||||||
<h1>🌺 Hibiscus.txt</h1>
|
<h1>🌺 Hibiscus.txt</h1>
|
||||||
<p>Today is <span id="today-date">a place</span></p>
|
<p id="status">Today is <span id="today-date">a place</span></p>
|
||||||
</header>
|
</header>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
|
||||||
{{define "base"}}
|
{{define "base"}}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
@ -22,7 +23,10 @@
|
||||||
{{template "main" .}}
|
{{template "main" .}}
|
||||||
</main>
|
</main>
|
||||||
{{template "footer" .}}
|
{{template "footer" .}}
|
||||||
<script defer>updateDate();beginDateUpdater()</script>
|
<script defer>
|
||||||
|
updateDate()
|
||||||
|
beginDateUpdater()
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{{define "main"}}
|
{{define "main"}}
|
||||||
<h2><label for="day">{{ .Date }}</label> | <a href="/day">Go back</a></h2>
|
<h2 style="margin-bottom:0;"><label for="day">Viewing {{ .Date }}</label> | <a href="/day">Go back</a></h2>
|
||||||
<textarea id="day" cols="40" rows="15" readonly>{{ .Day }}</textarea>
|
<textarea id="day" cols="40" rows="15" readonly>{{ .Day }}</textarea>
|
||||||
{{end}}
|
{{end}}
|
|
@ -1,6 +1,6 @@
|
||||||
{{define "main"}}
|
{{define "main"}}
|
||||||
<h2>{{.Title}}</h2>
|
<h2>{{.Title}}</h2>
|
||||||
<ul>
|
<ul id="days">
|
||||||
{{range .Entries}}
|
{{range .Entries}}
|
||||||
<li><a href="/day/{{.Link}}">{{.Name}}</a></li>
|
<li><a href="/day/{{.Link}}">{{.Name}}</a></li>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{{define "main"}}
|
{{define "main"}}
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
<h2><label for="day">Your day so far:</label></h2>
|
<h2 style="margin-bottom:0;"><label for="day">Your day so far:</label></h2>
|
||||||
<textarea id="day" cols="40" rows="15" name="day">{{ .Day }}</textarea>
|
<textarea id="day" cols="40" rows="15" name="day">{{ .Day }}</textarea>
|
||||||
<button type="submit">Save</button>
|
<button type="submit">Save</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -12,7 +12,8 @@ body {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
h2 { margin-bottom:12px; }
|
|
||||||
|
/* Red links! */
|
||||||
a, a:visited { color: #f85552; }
|
a, a:visited { color: #f85552; }
|
||||||
a:hover, a:visited:hover { color: #e66868; }
|
a:hover, a:visited:hover { color: #e66868; }
|
||||||
|
|
||||||
|
|
|
@ -89,9 +89,6 @@ func GetDays(w http.ResponseWriter, r *http.Request) {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
dayString = t.Format("02 Jan 2006")
|
dayString = t.Format("02 Jan 2006")
|
||||||
}
|
}
|
||||||
if v == time.Now().Format(time.DateOnly) {
|
|
||||||
dayString = "Today"
|
|
||||||
}
|
|
||||||
daysFormatted = append(daysFormatted, ListEntry{Name: dayString, Link: v})
|
daysFormatted = append(daysFormatted, ListEntry{Name: dayString, Link: v})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,10 +116,6 @@ func GetDay(w http.ResponseWriter, r *http.Request) {
|
||||||
HandleWrite(w.Write([]byte("day not specified")))
|
HandleWrite(w.Write([]byte("day not specified")))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if dayString == time.Now().Format(time.DateOnly) { // today can still be edited
|
|
||||||
http.Redirect(w, r, "/", 302)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
day, err := ReadFile("day/" + dayString)
|
day, err := ReadFile("day/" + dayString)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error("error reading day's file", "error", err, "day", dayString)
|
slog.Error("error reading day's file", "error", err, "day", dayString)
|
||||||
|
|
Loading…
Reference in a new issue