draft shits

This commit is contained in:
2026-02-01 11:55:16 +01:00
parent d17ed8c650
commit e27aadc603
22 changed files with 1341 additions and 0 deletions

View File

@ -0,0 +1,12 @@
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<title>Donnie Marko</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/static/css/main.css" type="text/css">
</head>
<body>
{{ template "content" . }}
</body>
</html>

View File

@ -0,0 +1,8 @@
{{ define "content" }}
{{/* List of notes and searching utilities */}}
{{ template "noteList" . }}
{{/* Markdown notes rendering area */}}
<main>
{{ .Note }}
</main>
{{ end }}

View File

@ -0,0 +1,55 @@
{{ define "noteList" }}
<aside>
<header>
<h1 class="main-logo"><a href="/">Donnie Marko</a></h1>
<form method="GET" action="/" class="search-form">
<input type="text" name="search" class="search-bar" placeholder="Search... (empty query to clear)">
<input type="submit" value="ok"/>
</form>
<form method="GET" action="/">
<select name="sort" value="sort" class="sort-dropdown">
<option value="" disabled {{ if eq "" .SortBy }}selected{{ end }}>Sort by</option>
<option value="recent" {{ if eq "recent" .SortBy }}selected{{ end }}>Recent</option>
<option value="oldest" {{ if eq "oldest" .SortBy }}selected{{ end }}>Oldest</option>
<option value="alpha" {{ if eq "alpha" .SortBy }}selected{{ end }}>Alphabetical</option>
<option value="ralpha" {{ if eq "ralpha" .SortBy }}selected{{ end }}>Reverse Alphabetical</option>
</select>
<input type="submit" value="sort" />
</form>
</header>
{{ template "renderSearch" . }}
</aside>
{{ end }}
{{ define "renderSearch" }}
{{ if ne .SearchTerm "" }}<h2>Matching results for query '{{ .SearchTerm }}'</h2>{{ end }}
<ul class="search-results">
{{ range .Nodes }}
{{ if .IsEnd }}
<li {{ if eq .Hash $.LastActive }}class="active-note"{{ end }}>
<input type="checkbox"/>
<a href="/notes/{{ .Hash }}" data-hash="{{ .Hash }}">{{ .Title }}</a>
<span class="last-modified">{{ .LastModified }}</span>
</li>
{{ end }}
{{ end }}
</ul>
{{ end }}
{{/* not used for now, the opposition between flat list from hashmap and tree structure is confusing */}}
{{ define "renderTree" }}
<ul>
{{ range . }}
{{ if .IsEnd }}
<li><input type="checkbox"/><a href="/notes/{{ .Hash }}" data-hash="{{ .Hash }}">{{ .Title }}</a><span class="last-modified">{{ .LastModified }}</span></li>
{{ else }}
{{ if .Children }}
<li><div class="folder"><input type="checkbox"/><span class="folder">{{ .Path }}</span></folder>
{{ template "renderTree" .Children }}
</li>
{{ end }}
{{ end }}
{{ end }}
</ul>
{{ end }}