diff options
author | Jordan <me@jordan.im> | 2021-02-16 16:48:56 -0700 |
---|---|---|
committer | Jordan <me@jordan.im> | 2021-02-16 16:48:56 -0700 |
commit | baa10aeb413a5ac109e56db5fd7a8d62a4d5965f (patch) | |
tree | b063d3df79882cb454329e6469088b00d382113f /templates | |
download | crane-baa10aeb413a5ac109e56db5fd7a8d62a4d5965f.tar.gz crane-baa10aeb413a5ac109e56db5fd7a8d62a4d5965f.zip |
initial commit
Diffstat (limited to 'templates')
-rw-r--r-- | templates/admin-edit.html | 69 | ||||
-rw-r--r-- | templates/admin.html | 50 | ||||
-rw-r--r-- | templates/index.html | 16 | ||||
-rw-r--r-- | templates/layout.html | 296 | ||||
-rw-r--r-- | templates/list.html | 29 |
5 files changed, 460 insertions, 0 deletions
diff --git a/templates/admin-edit.html b/templates/admin-edit.html new file mode 100644 index 0000000..58d93f5 --- /dev/null +++ b/templates/admin-edit.html @@ -0,0 +1,69 @@ +{{ template "layout.html" . }} +{{ define "content" }} +<p>{{ .Status }}</p> +<table id='header'> + <tr> + {{ $categoryCount := len .Papers }} + {{ if gt $categoryCount 0 }} + <td class='inpt'> + <form method='post' action='/admin/edit/'> + <input type="text" id="rename-category" name="rename-to" placeholder="Mathematics"> + <select class="btn" name="rename-category" id="category"> + {{ range $category, $papers := .Papers }} + <option value="{{ $category }}">{{ $category }}</option> + {{ end }} + </select> + <input class='btn' type="submit" value="Rename Category"> + </form> + </td> + {{ end }} + </tr> +</table> +<table class='tabs'> + <tr> + <td><a class='active' href='/admin/'>Back</a></td> + </tr> +</table> +<div class='content'> +{{ if gt $categoryCount 0 }} +<form method='post' action='/admin/edit/'> + <select class="btn" name="action" id="Action"> + <optgroup label="Action"> + <option value="delete">Delete</option> + </optgroup> + <optgroup label="Move To"> + {{ range $category, $papers := .Papers }} + <option value="move-{{ $category }}">{{ $category }}</option> + {{ end }} + </optgroup> + </select> + <input class='btn' type="submit" value="Save" /> +<table summary='paper list' class='list nowrap'> +{{ range $category, $papers := .Papers }} + {{ $paperCount := len $papers }} + <tr class='nohover-highlight'> + <td colspan='4' class='papersection'> + <input type="checkbox" id="{{ $category }}" name="category" value="{{ $category }}"> + <label for="{{ $category }}">{{ $category }}</label> + </td> + </tr> + {{ range $path, $paper := $papers }} + <tr> + {{ if $paper.Meta.Title }} + <td class="sublevel-paper title"><input type="checkbox" id="{{ $path }}" name="paper" value="{{ $path }}"><label for="{{ $path }}"><a href='/download/{{ $path }}' title='{{ $paper.Meta.Title }}'>{{ $paper.Meta.Title }}</a></label></td> + {{ else }} + <td class="sublevel-paper title"><input type="checkbox" id="{{ $path }}" name="paper" value="{{ $path }}"><label for="{{ $path }}"><a href='/download/{{ $path }}' title='{{ $paper.PaperName }}'>{{ $paper.PaperName }}</a></label></td> + {{ end }} + </tr> + <tr> + {{ if $paper.Meta.Title }} + <td class="sub">author: {{ $contCount := len $paper.Meta.Contributors }} {{ if gt $contCount 0 }}{{ $author := index $paper.Meta.Contributors 0 }}<a href='/?a={{ $author.LastName }}'>{{ $author.LastName }}{{ if gt $contCount 1 }} et al.{{ end }}{{ end }}</a> yr: <a href="?y={{ $paper.Meta.PubYear }}">{{ $paper.Meta.PubYear }}</a> doi: <a href="https://doi.org/{{ $paper.Meta.DOI }}">{{ $paper.Meta.DOI }}</a> journal: <font color="black">{{ $paper.Meta.Journal }}</font></td> + {{ else }} + <td></td> + {{ end }} + </tr> + {{ end }} +{{ end }} +{{ end }} +</table></form></div> +{{ end }} diff --git a/templates/admin.html b/templates/admin.html new file mode 100644 index 0000000..8c5222c --- /dev/null +++ b/templates/admin.html @@ -0,0 +1,50 @@ +{{ template "layout.html" . }} +{{ define "content" }} +{{ if .LastPaperDL }} +<p>{{ .Status }} (<a style="text-decoration: underline;" href="/download/{{ .LastPaperDL }}">download</a>)</p> +{{ else }} +<p>{{ .Status }}</p> +{{ end }} +<table id='header'> + <tr> + <td class='inpt'> + <form method='post' action='/admin/add/'> + <input type='text' name='new-category' placeholder="Mathematics" value=''/> + <input class='btn' type="submit" value="New Category" /> + </form> + </td> + </tr> + {{ $categoryCount := len .Papers }} + {{ if gt $categoryCount 0 }} + <tr> + <td class='inpt'> + <form method='post' action='/admin/add/'> + <input type='text' name='dl-paper' placeholder="URL or DOI" value=''/> + <select class="btn" name="dl-category" id="category"> + {{ $lastUsedCategory := .LastUsedCategory }} + {{ if $lastUsedCategory }} + <option value="{{ .LastUsedCategory }}">{{ $lastUsedCategory }}</option> + {{ end }} + {{ range $category, $papers := .Papers }} + {{ if ne $category $lastUsedCategory }} + <option value="{{ $category }}">{{ $category }}</option> + {{ end }} + {{ end }} + </select> + <input class='btn' type="submit" value="Download" /> + </form> + </td> + </tr> + {{ end }} +</table> +{{ if gt $categoryCount 0 }} +<table class='tabs'> + <tr> + <td><a class='active' href='/admin/edit/'>Edit</a></td> + </tr> +</table> +<div class='content'> +{{ block "list" . }}{{ end }} +</div> +{{ end }} +{{ end }} diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..7de21f7 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,16 @@ +{{ template "layout.html" . }} +{{ define "content" }} +<table id='header'> +</table> +{{ $categoryCount := len .Papers }} +{{ if gt $categoryCount 0 }} +<table class='tabs'> + <td><a class='active' href='/admin/'>Manage</a></td> +</table> +<div class='content'> +{{ block "list" . }}{{ end }} +</div> +{{ else }} +<p>nothing here yet, <a style="text-decoration:underline;" href="/admin/">create a category</a> to start downloading papers</p> +{{ end }} +{{ end }} diff --git a/templates/layout.html b/templates/layout.html new file mode 100644 index 0000000..26130d0 --- /dev/null +++ b/templates/layout.html @@ -0,0 +1,296 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"/> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<title>Crane</title> +<style> +@media (min-width: 601px) { + div#crane { + font-size: 16px; + } +} +@media (max-width: 600px) { + div#crane { + font-size: 14px; + } +} + +div#crane { + font-family: monospace; + padding: 0em; + margin: 0em; + background: white; + padding: 4px; +} + +div#crane a { + color: blue; + text-decoration: none; +} + +div#crane table#header input[type="text"] { + font-family: inherit; + font-size: 100%; + display: block; + width: calc(100% - 1rem); + border: 1px solid #888; + border-color: #888; + padding: .375rem; + background-color: #fff; + background-clip: padding-box; + margin-bottom: .5em; + line-height: 1.5; + transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out; +} + +div#crane table#header .btn { + display: inline-block; + margin-bottom: 1rem; +} + +div#crane .btn { + font-family: inherit; + font-size: 85%; + color: black; + text-overflow: unset; + display: inline; + background: #e9ecef; + border: #343a40 1px solid; + padding: 2px 8px; + border-radius: 0; +} + +div#crane a:hover { + text-decoration: underline; +} +div#crane a { + color: #000; +} + +div#crane table { + border-collapse: collapse; +} + +div#crane table#header { + width: 100%; + margin-bottom: 1em; +} + +div#crane table#header td.inpt { + padding-left: 10px; + white-space: nowrap; + border-collapse: collapse; + color: #000; +} + +div#crane table#header td.main { + font-size: 250%; + padding-left: 10px; + white-space: nowrap; + border-collapse: collapse; +} + +div#crane table#header td.form { + text-align: left; + vertical-align: bottom; + padding-bottom: 2px; + white-space: nowrap; +} + +div#crane table#header td.form form, +div#crane table#header td.form input, +div#crane table#header td.form select { +} + +div#crane table#header td.sub { + color: #777; + border-top: solid 1px #ccc; + padding-left: 10px; +} + +div#crane table.tabs { + border-bottom: solid 2px #ccc; + border-collapse: nowrap; + margin-top: 1em; + margin-bottom: 0px; + width: 100%; +} + +div#crane table.tabs td { + padding: 0px 0px 0px; + vertical-align: bottom; +} + +div#crane table.tabs td a { + font-size: 90%; + padding: 2px 0.75em; + color: black; + background-color: #ccc; +} + +div#crane table.tabls td.form { + text-align: right; +} + +div#crane table.tabs td.form form { + padding-bottom: 2px; + white-space: normal; + padding-left: 1em; +} + +div#crane table.tabs td.form input, +div#crane table.tabs td.form select { +} + +div#crane div.content { + margin-top: 1em; + padding-bottom: 1em; + border-bottom: solid 2px #ccc; +} + +div#crane table.list { + width: 100%; + border: none; + border-collapse: collapse; +} + +div#crane table.list tr { + background: white; +} + +div#crane table.list:first-child tr:first-child td:first-child { + padding-top: 0em; +} + +div#crane table.list td.sub { + padding-left: 4em; + font-size: 80%; +} + +div#crane table.list th { + font-weight: bold; + /* color: #888; + border-top: dashed 1px #888; + border-bottom: dashed 1px #888; + */ + padding: 0.1em 0.5em 0.05em 0.5em; + vertical-align: baseline; +} + +div#crane table.list td { + border: none; + padding: 0.1em 0.5em 0.1em 0.5em; +} + +div#crane table.list td.title { + text-decoration: underline; + padding-left: 1.5em; +} + +div#crane table.list td.authors { + max-width: 10em; +} + +div#crane table.list td.year { + max-width: 5em; +} + +div#crane table.list td.doi { + max-width: 5em; +} + +div#crane table.list td a { + color: black; +} + +div#crane table.list td a:hover { + color: #00f; +} + +div#crane img { + border: none; +} + +div#crane td#content { + vertical-align: top; + padding: 1em 2em 1em 1em; + border: none; +} + +div#crane table.nowrap td { + white-space: normal; +} + +div#crane .left { + text-align: left; +} + +div#crane .right { + text-align: right; +} + +div#crane table.list td.papersection { + font-weight: bold; + padding-top: 1em; + padding-bottom: .5em; + color: black; +} + +div#crane table.list td.sublevel-paper { +} + +div#crane div.footer { + margin-top: 0.5em; + text-align: center; + font-size: 80%; + color: #ccc; +} + +div#crane div.footer a { + color: #ccc; + text-decoration: none; +} + +div#crane div.footer a:hover { + text-decoration: underline; +} + +* { line-height: 1.25em; } + +div#crane { + max-width: 55em; + margin: auto; + -moz-tab-size: 4; + tab-size: 4; +} + +div#crane table.list th a { + color: inherit; +} + +div#crane table.list tr.nohover-highlight:hover:nth-child(even) { + background: inherit; +} + +div#crane table.blob td.linenumbers a:target { + color: goldenrod; + text-decoration: underline; + outline: none; +} + +</style> +</head> +<body> +<center> +<div id='crane'> +<table id='header'> + <tr><td class='main'><a href="/">Crane</a></td></tr> + <tr><td class='sub'>Research literature archival and categorization</td></tr> +</table> +{{ block "content" . }}{{ end }} +<div class='footer'><a href='https://git.jordan.im/crane'>crane</a></div> +</div> +</center> +</body> +</html> diff --git a/templates/list.html b/templates/list.html new file mode 100644 index 0000000..718a732 --- /dev/null +++ b/templates/list.html @@ -0,0 +1,29 @@ +{{ define "list" }} +<table summary='paper list' class='list nowrap'> +{{ range $category, $papers := .Papers }} + {{ $paperCount := len $papers }} + {{ if ge $paperCount 1 }} + <tr class='nohover-highlight'> + <td colspan='4' class='papersection'>{{ $category }}</td> + </tr> + {{ range $path, $paper := $papers }} + <tr> + {{ if $paper.Meta.Title }} + <td class="sublevel-paper title"><a href='/download/{{ $path }}' title='{{ $paper.Meta.Title }}'>{{ $paper.Meta.Title }}</a></td> + {{ else }} + <td class="sublevel-paper title"><a href='/download/{{ $path }}' title='{{ $paper.PaperName }}'>{{ $paper.PaperName }}</a></td> + {{ end }} + </tr> + <tr> + {{ if $paper.Meta.Title }} + <td class="sub">author: {{ $contCount := len $paper.Meta.Contributors }} {{ if gt $contCount 0 }}{{ $author := index $paper.Meta.Contributors 0 }}<a href='/?a={{ $author.LastName }}'>{{ $author.LastName }}{{ if gt $contCount 1 }} et al.{{ end }}{{ end }}</a> yr: <a href="?y={{ $paper.Meta.PubYear }}">{{ $paper.Meta.PubYear }}</a> doi: <a href="https://doi.org/{{ $paper.Meta.DOI }}">{{ $paper.Meta.DOI }}</a> journal: <font color="black">{{ $paper.Meta.Journal }}</font></td> + {{ else }} + <td></td> + {{ end }} + </tr> + {{ end }} + {{ else }} + {{ end }} +{{ end }} +</table> +{{ end }} |