~aleteoryx/webjrnl

e374155fe7d3b4451ef381a174d68e5294ae2da3 — Aleteoryx 22 days ago ccb2c90
even OLDER html style
M README.md => README.md +2 -3
@@ 143,7 143,7 @@ needs testing:
- netpositive
- kaios
- wii browser channel
- 


works, no notes:



@@ 153,7 153,7 @@ works, no notes:
- MSIE 6
- k-meleon
- eww (thanks d6!)
- epiphany (GNOME web)
- epiphany

works with caveats:



@@ 168,7 168,6 @@ works with caveats:
  this
- dillo: some weird caching behavior that requires manual reloads at
  times, ignores content-disposition on /save
- 


doesn't work:

M template/base.html => template/base.html +1 -1
@@ 21,7 21,7 @@
{{end}}

{{define "foot"}}
<p class="footer"><em>powered by <a href="https://git.amehut.dev/~aleteoryx/webjrnl">jrnl v0</a></em></p>
<p class="footer"><em>powered by <a href="//git.amehut.dev/~aleteoryx/webjrnl">jrnl v0</a></em></p>
</body>
</html>
{{end}}

M template/dash.html => template/dash.html +3 -3
@@ 9,13 9,13 @@
		{{if not $hasToday}}
		<td><form method="POST" action="jrnl/{{ .Today.Year }}">
			<input type="hidden" name="text" value="&gt; {{ .Today }}&#10;" />
			<button type="submit">Start today's entry!</button>
			<input type="submit" value="Start today's entry!" />
		</form></td>
		{{end}}
		{{if not $hasYesterday}}
		<td><form method="POST" action="jrnl/{{ .Yesterday.Year }}">
			<input type="hidden" name="text" value="&gt; {{ .Yesterday }} &#10;" />
			<button type="submit">Start yesterday's entry!</button>
			<input type="submit" value="Start yesterday's entry!" />
		</form></td>
		{{end}}
	</tr></table>


@@ 25,7 25,7 @@
	<p>
		{{range $i, $year := .Jrnl.ListYears}}
		{{if ne $i 0}} • {{end}}
		<a href="jrnl/{{ $year }}">{{ $year }}</a>
		<a href="./jrnl/{{ $year }}">{{ $year }}</a>
		{{end}}
	</p>
{{template "foot" .}}

M template/init.html => template/init.html +1 -1
@@ 3,7 3,7 @@
	<form method="POST">
		<textarea name="text" cols="72" rows="24"></textarea>
		<br/>
		<button type="submit">Import!</button>
		<input type="submit" value="Import!" />
	</form>
{{template "foot" .}}


M template/jrnl.html => template/jrnl.html +2 -2
@@ 8,7 8,7 @@
	<form method="POST">
		<textarea name="text" cols="72" rows="24">{{$text}}</textarea>
		<br/>
		<button type="submit">Update!</button>
		<input type="submit" value="Update!" />
	</form>
	{{if not (eq $text "")}}
	<br>


@@ 22,7 22,7 @@
			{{end}}
		</select>
		&nbsp;
		<button type="submit">Go To</button>
		<input type="submit" value="Go To" />
	</form>
	{{end}}
{{template "foot" .}}

M template/ntries.html => template/ntries.html +1 -1
@@ 5,7 5,7 @@
	<ul>
		{{range $i, $e := .Ntries}}
		<li>
			<a href="{{ $pfx }}ntry/{{ $e.Entry.Date.URL }}">{{ $e.Entry.Date }}</a>
			<a href="./{{ $pfx }}ntry/{{ $e.Entry.Date.URL }}">{{ $e.Entry.Date }}</a>
			v{{ $e.Id }}
		</li>
		{{end}}

M template/ntry.html => template/ntry.html +2 -2
@@ 13,7 13,7 @@
	<form method="POST">
		<textarea name="text" cols="72" rows="24">{{ $latest.Body }}</textarea>
		<br/>
		<button type="submit">Update!</button>
		<input type="submit" value="Update!" />
	</form>
	<br>
	{{if ne $latest.Id 0}}


@@ 26,7 26,7 @@
			<pre>{{ .Body }}</pre>
			<form method="POST">
				<input type="hidden" name="text" value="{{ .Body }}" />
				<button type="submit">Revert</button>
				<input type="submit" value="Revert" />
			</form>
		</li>
		{{end}}

M template/save.html => template/save.html +1 -1
@@ 2,6 2,6 @@
	<p>This is a full backup of your jrnl, including every version of every entry.
	   Modification dates are not preserved.</p>
	<textarea name="text" cols="72" rows="24">{{ .Jrnl.GetBackup }}</textarea>
	<form method="GET"><button name="download" type="submit">Download!</button></form>
	<form method="GET"><input type="submit" name="download" value="Download!" /></form>
{{template "foot" .}}


M web.go => web.go +7 -3
@@ 14,9 14,9 @@ import "time"

const dashLinks =
	template.HTML(
		"<p><a href=\"ntry\">entries</a> • " +
		"<a href=\"init\">import</a> • " +
		"<a href=\"save\">export</a></p>" )
		"<p><a href=\"./ntry\">entries</a> • " +
		"<a href=\"./init\">import</a> • " +
		"<a href=\"./save\">export</a></p>" )

//go:embed template/*
var templateFS embed.FS


@@ 189,6 189,10 @@ func BuildLinks(r *http.Request, jrnl *Jrnl) template.HTML {
	}

	pfx := strings.Repeat("../", strings.Count(r.URL.Path, "/") - 1)
	if pfx == "" {
		pfx = "./"
	}

	links := fmt.Sprintf("<a href=\"%sdash\">dash</a>", pfx)

	years, _ := jrnl.ListYears()