Problem: mobile view is read/write
All checks were successful
continuous-integration/drone/push Build is passing

Solution: make a read only version for mobile
This commit is contained in:
Peter Stuifzand 2022-01-15 01:46:10 +01:00
parent 39a3a9d270
commit 1115fa14ff
3 changed files with 86 additions and 8 deletions

View File

@ -232,7 +232,7 @@ func (*authHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if r.Method == http.MethodGet { if r.Method == http.MethodGet {
if r.URL.Path == "/auth/login" { if r.URL.Path == "/auth/login" {
templates := baseTemplate templates := []string{"templates/layout_no_sidebar.html"}
templates = append(templates, "templates/login.html") templates = append(templates, "templates/login.html")
t, err := template.ParseFiles(templates...) t, err := template.ParseFiles(templates...)
if err != nil { if err != nil {
@ -895,7 +895,7 @@ func (h *indexHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
ShowGraph: page != "Daily_Notes", ShowGraph: page != "Daily_Notes",
TodayPage: "Today", TodayPage: "Today",
} }
templates := baseTemplate templates := []string{"templates/layout_no_sidebar.html"}
templates = append(templates, "templates/view.html") templates = append(templates, "templates/view.html")
t, err := template.ParseFiles(templates...) t, err := template.ParseFiles(templates...)
if err != nil { if err != nil {
@ -1118,6 +1118,7 @@ func main() {
return return
} }
// FIXME: loads the whole page to save one new block
page := mp.Get(id) page := mp.Get(id)
log.Println(page.Content) log.Println(page.Content)
var listItems []ListItem var listItems []ListItem

View File

@ -0,0 +1,83 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="redirect_uri" href="{{ .RedirectURI }}" />
<link rel="stylesheet" href="/public/main.css" />
<link rel="stylesheet" href="/public/styles.css" />
<!-- <link rel="stylesheet" href="https://unpkg.com/prismjs@1.20.0/themes/prism-tomorrow.css"> -->
<!-- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"/> -->
<title>{{ .Title }} - Wiki</title>
{{ block "content_head" . }} {{ end }}
<style>
</style>
<style>
</style>
</head>
<body data-base-url="{{ .BaseURL }}">
<div>
<nav class="navbar" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href="/">
Wiki
</a>
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false"
data-target="navbarBasicExample">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
<div id="navbarBasicExample" class="navbar-menu">
<div class="navbar-start">
{{ block "navbar" . }}{{ end }}
</div>
</div>
</nav>
<div class="searchbar">
<div class="field">
<p class="control">
<input class="search input" id="search-input" type="text" placeholder="Find a page">
</p>
<div id="autocomplete" class="hide keyboard-list" tabindex="0"></div>
</div>
</div>
<div style="padding:0 32px;">
<section class="section">
{{ template "content" . }}
</section>
</div>
<div class="footer">
<div class="h-app">
<a href="/" class="u-url p-name">Wiki</a>
&mdash; created by <a href="https://peterstuifzand.nl/">Peter Stuifzand</a>
</div>
</div>
</div>
<div id="link-complete" class="hide keyboard-list"></div>
{{ block "footer_scripts" . }}
{{ end }}
<div id="result-template" class="hide">
<ul>
[[#results]]
<li><a href="/edit/[[ref]]">[[title]] <div>[[&amp; text]]</div></a></li>
[[/results]]
[[^results]]
<li>No results</li>
[[/results]]
<li><a href="/edit/[[page]]">Create a page</a></li>
</ul>
</div>
<script async src="/public/vendors.js"></script>
<script async src="/public/main.js"></script>
</body>
</html>

View File

@ -22,12 +22,6 @@
</ul> </ul>
</div> </div>
</div> </div>
<div class="column">
{{ if .ShowGraph }}
<div class="graph-network" data-name="{{ .Name }}" style="height:80vh; top:0; position: sticky"></div>
{{ end }}
</div>
</div> </div>
{{ end }} {{ end }}