1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00
cowyo/templates/index.tmpl

214 lines
12 KiB
Cheetah
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" sizes="57x57" href=/static/img/cowyo/apple-icon-57x57.png>
<link rel="apple-touch-icon" sizes="60x60" href=/static/img/cowyo/img/cowyo/apple-icon-60x60.png>
<link rel="apple-touch-icon" sizes="72x72" href=/static/img/cowyo/apple-icon-72x72.png>
<link rel="apple-touch-icon" sizes="76x76" href=/static/img/cowyo/apple-icon-76x76.png>
<link rel="apple-touch-icon" sizes="114x114" href=/static/img/cowyo/apple-icon-114x114.png>
<link rel="apple-touch-icon" sizes="120x120" href=/static/img/cowyo/apple-icon-120x120.png>
<link rel="apple-touch-icon" sizes="144x144" href=/static/img/cowyo/apple-icon-144x144.png>
<link rel="apple-touch-icon" sizes="152x152" href=/static/img/cowyo/apple-icon-152x152.png>
<link rel="apple-touch-icon" sizes="180x180" href=/static/img/cowyo/apple-icon-180x180.png>
<link rel="icon" type="image/png" sizes="192x192" href=/static/img/cowyo/android-icon-192x192.png>
<link rel="icon" type="image/png" sizes="32x32" href=/static/img/cowyo/favicon-32x32.png>
<link rel="icon" type="image/png" sizes="96x96" href=/static/img/cowyo/favicon-96x96.png>
<link rel="icon" type="image/png" sizes="16x16" href=/static/img/cowyo/favicon-16x16.png>
<link rel="manifest" href=/static/img/cowyo/manifest.json>
<meta name="msapplication-TileColor" content="#fff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#fff">
{{ if and .CustomCSS .ReadPage }}
<link rel="stylesheet" type="text/css" href="/static/css/custom.css">
{{ else }}
<link rel="stylesheet" type="text/css" href="/static/css/github-markdown.css">
<link rel="stylesheet" type="text/css" href="/static/css/menus-min.css">
<link rel="stylesheet" type="text/css" href="/static/css/base-min.css">
2018-02-18 22:50:02 +03:00
<link rel="stylesheet" type="text/css" href="/static/css/highlight.css">
<link rel="stylesheet" type="text/css" href="/static/css/default.css">
<script type="text/javascript" src="/static/js/jquery-1.8.3.js"></script>
<script src="/static/js/highlight.min.js"></script>
<script type="text/javascript" src="/static/js/highlight.pack.js"></script>
{{ end }}
2017-09-11 17:38:20 +03:00
<title>{{ .Page }}</title>
<script type='text/javascript'>
hljs.initHighlightingOnLoad();
window.cowyo = {
debounceMS: {{ .Debounce }},
lastFetch: {{ .UnixTime }},
pageName: "{{ .Page }}",
}
</script>
<script type="text/javascript" src="/static/js/cowyo.js"></script>
</head>
<body id="pad" class="
{{ if .EditPage }} EditPage {{ end }}
{{ if .ViewPage }} ViewPage {{ end }}
{{ if .ListPage }} ListPage {{ end }}
{{ if .HistoryPage }} HistoryPage {{ end }}
{{ if .ReadPage }} ReadPage {{ end }}
{{ if .DontKnowPage }} DontKnowPage {{ end }}
{{ if .DirectoryPage }} DirectoryPage {{ end }}
{{ if .HasDotInName }} HasDotInName {{ end }}
">
<article class="markdown-body">
2017-11-02 15:27:39 +03:00
2018-01-29 14:33:11 +03:00
{{ if .ReadPage }}
<!-- No menu for read page -->
{{ else }}
<div class="pure-menu pure-menu-horizontal" id="menu">
<ul class="pure-menu-list">
<li></li>
<!-- Required to keep them level? -->
<li class="pure-menu-item pure-menu-has-children pure-menu-allow-hover">
<a href="#" id="menuLink1" class="pure-menu-link">{{ .Page }}</a>
<ul class="pure-menu-children">
{{ if .DiaryMode }}
<li class="pure-menu-item"><a href="/{{ .Date }}/edit" class="pure-menu-link">New</a></li>
{{ else }}
<li class="pure-menu-item"><a href="/" class="pure-menu-link">New</a></li>
{{ end }}
<li class="pure-menu-item"><a href="https://github.com/schollz/cowyo" class="pure-menu-link">Source</a></li>
{{ if .EditPage }}
<li class="pure-menu-item"><a href="#" class="pure-menu-link" id="publishPage">
{{- if .IsPublished -}}
Unpublish
{{- else -}}
Publish
{{- end -}}
</a></li>
{{ end }}
<hr>
{{ if (or (.IsLocked) (.IsEncrypted) )}}
{{ else }}
<li class="pure-menu-item"><a href="#" class="pure-menu-link" id="encryptPage">{{ if .IsEncrypted }}Decrypt{{ else }}Encrypt{{end}}</a></li>
<li class="pure-menu-item"><a href="#" class="pure-menu-link" id="lockPage">{{ if .IsLocked }}Unlock{{ else }}Lock{{end}}</a></li>
<li class="pure-menu-item"><a href="/{{ .Page }}/history" class="pure-menu-link">History</a></li>
<hr>
<li class="pure-menu-item"><a href="#" class="pure-menu-link" id="selfDestructPage">Self-destruct</a></li>
<li class="pure-menu-item"><a href="#" class="pure-menu-link" id="erasePage">Erase</a></li>
{{ end }}
</ul>
2017-09-29 15:48:32 +03:00
</li>
2018-01-29 14:33:11 +03:00
<li class="pure-menu-item pure-menu-has-children pure-menu-allow-hover {{ with .ViewPage }}pure-menu-selected{{ end }}">
<a href="/{{ .Page }}/view" class="pure-menu-link">View</a>
<ul class="pure-menu-children">
<li class="pure-menu-item">
<a href="/{{ .Page }}/read" class="pure-menu-link">Current</a>
</li>
{{ range .RecentlyEdited}}
<li class="pure-menu-item"><a class="pure-menu-link" href="/{{.}}/read">{{.}}</a></li>
{{ end }}
</ul>
</li>
2017-09-29 15:48:32 +03:00
2018-01-29 14:33:11 +03:00
{{ if (or (.IsLocked) (.IsEncrypted) )}}
{{ if .IsLocked }}
<li class="pure-menu-item"><a href="#" class="pure-menu-link" id="lockPage">{{ if .IsLocked }}Unlock{{ else }}Lock{{end}}</a></li>
<li class="pure-menu-item" class="pure-menu-link"><a href="#"><span id="saveEditButton"></span></a></li>
{{ else }}
<li class="pure-menu-item"><a href="#" class="pure-menu-link" id="encryptPage">{{ if .IsEncrypted }}Decrypt{{ else }}Encrypt{{end}}</a></li>
<li class="pure-menu-item" class="pure-menu-link"><a href="#"><span id="saveEditButton"></span></a></li>
{{ end }}
{{else}}
{{ if .ListPage }}
<li class="pure-menu-item {{ with .ListPage }}pure-menu-selected{{ end }}"><a href="#" class="pure-menu-link" id="clearOld">Clear done</a></li>
{{ else }}
<li class="pure-menu-item {{ with .ListPage }}pure-menu-selected{{ end }}"><a href="/{{ .Page }}/list" class="pure-menu-link">List</a></li>
{{ end }}
<li class="pure-menu-item {{ with .EditPage }}pure-menu-selected{{ end }}"><a href="/{{ .Page }}/edit" class="pure-menu-link"><span id="saveEditButton">Edit</span></a></li>
{{end}}
</ul>
</div>
{{ end }}
<div id="wrap">
2018-01-29 14:33:11 +03:00
{{ if .EditPage }}
<div id="pad">
<textarea
autofocus
placeholder="Use markdown to write your note! New: you can publish your note when you are done ({{ .Page }} -> Publish)."
id="userInput"
>{{ .RawPage }}</textarea>
</div>
2017-10-13 02:08:38 +03:00
{{ end }}
2018-01-29 14:33:11 +03:00
<div id="rendered">
{{ if .DontKnowPage }}
<strong>
<center>
{{ .Route }} not understood!
</center>
</strong>
{{ end }}
2018-01-29 14:33:11 +03:00
{{ if .ViewPage }}
{{ .RenderedPage }}
{{ end }}
2018-01-29 14:33:11 +03:00
{{ if .ReadPage }}
{{ .RenderedPage }}
{{ end }}
2018-01-29 14:33:11 +03:00
{{ if .HistoryPage }}
<h1>History</h1>
<ul>
{{range $i, $e := .Versions}}
<li style="list-style: none;">
<a href="/{{ $.Page }}/view?version={{$e}}">View</a>
&nbsp;&nbsp;
<a href="/{{ $.Page }}/list?version={{$e}}">List</a>
&nbsp;&nbsp;
<a href="/{{ $.Page }}/raw?version={{$e}}">Raw</a>
&nbsp;&nbsp;
{{index $.VersionsText $i}}&nbsp;({{if lt (index $.VersionsChangeSums $i) 0}}<span style="color:red">{{else}}<span style="color:green">+{{end}}{{index $.VersionsChangeSums $i}}</span>)</li>
{{end}}
</ul>
{{ end }}
2018-01-29 14:33:11 +03:00
{{ if .ListPage }}
{{ range $index, $element := .ListItems }}
{{ $element }}
{{ end }}
{{ end }}
2018-01-29 14:33:11 +03:00
{{ if .DirectoryPage }}
<table style="width:100%">
<tr>
<th>Document</th>
<th>Current size</th>
<th>Num Edits</th>
<th>Last Edited</th>
</tr>
{{range .DirectoryEntries}}
<tr>
<td><a href="/{{ .Name }}/view">{{ .Name }}</a></td>
<td>{{.Length}}</td>
<td>{{.Numchanges}}</td>
<td>{{.LastEditTime}}</td>
</tr>
{{ end }}
</table>
{{ end }}
2018-01-29 14:33:11 +03:00
</div>
2018-01-31 05:53:37 +03:00
{{ if .ChildPageNames }}
<section class="ChildPageNames">
<h2>See also</h2>
<ul>
{{ range .ChildPageNames }}
<li><a href="/{{ . }}/view">{{ . }}</a></li>
{{ end }}
</ul>
</section>
{{ end }}
2018-01-29 14:33:11 +03:00
</div>
</article>
</body>
</html>