Initial checkin

This commit is contained in:
2022-05-24 18:03:31 +09:30
commit 881c618041
31 changed files with 19870 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
<!doctype html>
<html class="no-js" lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>linkwallet</title>
<link rel="stylesheet" href="/assets/css/foundation.css">
<link rel="stylesheet" href="/assets/css/app.css">
<script src="/assets/js/htmx.min.js" defer></script>
</head>
<body>
<div class="top-bar">
<div class="top-bar-left">
<ul class="dropdown menu" data-dropdown-menu>
<li class="menu-text">linkwallet</li>
<li><a href="/">Home</a></li>
<li>
<a href="#">Admin</a>
<ul class="menu vertical">
<li><a href="/manage">Manage links</a></li>
</ul>
</li>
</ul>
</div>
<div class="top-bar-right">
<ul class="menu">
<li><a href="https://github.com">gh</a></li>
<!-- <li><input type="search" placeholder="Search"></li>
<li><button type="button" class="button">Search</button></li> -->
</ul>
</div>
</div>
<div class="grid-container">
{{ if eq .page "root" }}
{{ template "search.html" . }}
{{ else if eq .page "manage" }}
{{ template "manage.html" . }}
{{ end }}
{{/* template "foundation_sample.html" . */}}
</div>
<script src="/assets/js/vendor/jquery.js"></script>
<script src="/assets/js/vendor/what-input.js"></script>
<script src="/assets/js/vendor/foundation.js"></script>
<script src="/assets/js/app.js"></script>
</body>
</html>

View File

@@ -0,0 +1,27 @@
<div class="large-8 medium-8 cell" id="add-url-form" >
<h5>Add a new URL</h5>
<span>[<a hx-get="/bulk_add" hx-target="#add-url-form" href="#">bulk</a>]</span>
<form onsubmit="return false">
<div class="grid-x grid-padding-x">
<div class="large-6 cell">
<label>Paste a URL</label>
<input type="text" name="url"
hx-post="/add"
hx-target="#add-url-form" hx-trigger=""
/>
</div>
<div class="large-6 cell">
{{ template "tags_widget.html" . }}
</div>
</div>
</form>
{{ if .error }}
<p class="error">{{ .error }}</p>
{{ else }}
{{ if .bm }}
Bookmark added - ID: {{ .bm.ID }} URL: {{ .bm.URL }}
{{ end }}
{{ end }}
</div>

View File

@@ -0,0 +1,36 @@
<div class="large-8 medium-8 cell" id="add-url-form" >
<h5>Add URLs in bulk</h5>
<span>[<a hx-get="/single_add" hx-target="#add-url-form" href="#">single</a>]</span>
<form onsubmit="return false">
<div class="grid-x grid-padding-x">
<div class="large-12 cell">
<label>Paste URL's, one per line</label>
<textarea type="text" name="urls" rows="10"
></textarea>
</div>
</div>
<button
class="button"
hx-post="/add_bulk"
hx-indicator="#htmx-indicator-bulk"
hx-target="#add-url-form">
add
</button>
<span id="htmx-indicator-bulk" class="htmx-indicator">
<img src="/assets/image/beating.gif" /> adding...
</span>
</form>
{{ if .errors }}
<ul>
{{ range .errors }}
<li class="error">{{ . }}</li>
{{ end }}
</ul>
{{ else }}
{{ if .added }}
Added {{ .added }} urls
{{ end }}
{{ end }}
</div>

View File

@@ -0,0 +1,148 @@
<div class="grid-x grid-padding-x">
<div class="large-12 cell">
<h1>Welcome to Foundation</h1>
</div>
</div>
<div class="grid-x grid-padding-x">
<div class="large-12 cell">
<div class="callout">
<h3>We&rsquo;re stoked you want to try Foundation! </h3>
<p>To get going, this file (index.html) includes some basic styles you can modify, play around with, or totally destroy to get going.</p>
<p>Once you've exhausted the fun in this document, you should check out:</p>
<div class="grid-x grid-padding-x">
<div class="large-4 medium-4 cell">
<p><a href="https://get.foundation/sites/docs/">Foundation Documentation</a><br />Everything you need to know about using the framework.</p>
</div>
<div class="large-4 medium-4 cell">
<p><a href="https://github.com/foundation/foundation-sites/discussions">Foundation Forum</a><br />Join the Foundation community to ask a question or show off your knowlege.</p>
</div>
</div>
<div class="grid-x grid-padding-x">
<div class="large-4 medium-4 medium-push-2 cell">
<p><a href="https://github.com/foundation/foundation-sites">Foundation on Github</a><br />Latest code, issue reports, feature requests and more.</p>
</div>
<div class="large-4 medium-4 medium-pull-2 cell">
<p><a href="https://twitter.com/FoundationCSS">@FoundationCSS</a><br />Ping us on Twitter if you have questions. When you build something with this we'd love to see it.</p>
</div>
</div>
</div>
</div>
</div>
<div class="grid-x grid-padding-x">
<div class="large-8 medium-8 cell">
<h5>Here&rsquo;s your basic grid:</h5>
<!-- Grid Example -->
<div class="grid-x grid-padding-x">
<div class="large-12 cell">
<div class="primary callout">
<p><strong>This is a twelve cell section in a grid-x.</strong> Each of these includes a div.callout element so you can see where the cell are - it's not required at all for the grid.</p>
</div>
</div>
</div>
<div class="grid-x grid-padding-x">
<div class="large-6 medium-6 cell">
<div class="primary callout">
<p>Six cell</p>
</div>
</div>
<div class="large-6 medium-6 cell">
<div class="primary callout">
<p>Six cell</p>
</div>
</div>
</div>
<div class="grid-x grid-padding-x">
<div class="large-4 medium-4 small-4 cell">
<div class="primary callout">
<p>Four cell</p>
</div>
</div>
<div class="large-4 medium-4 small-4 cell">
<div class="primary callout">
<p>Four cell</p>
</div>
</div>
<div class="large-4 medium-4 small-4 cell">
<div class="primary callout">
<p>Four cell</p>
</div>
</div>
</div>
<hr />
<h5>We bet you&rsquo;ll need a form somewhere:</h5>
<form>
<div class="grid-x grid-padding-x">
<div class="large-12 cell">
<label>Input Label</label>
<input type="text" placeholder="large-12.cell" />
</div>
</div>
<div class="grid-x grid-padding-x">
<div class="large-4 medium-4 cell">
<label>Input Label</label>
<input type="text" placeholder="large-4.cell" />
</div>
<div class="large-4 medium-4 cell">
<label>Input Label</label>
<input type="text" placeholder="large-4.cell" />
</div>
<div class="large-4 medium-4 cell">
<div class="grid-x">
<label>Input Label</label>
<div class="input-group">
<input type="text" placeholder="small-9.cell" class="input-group-field" />
<span class="input-group-label">.com</span>
</div>
</div>
</div>
</div>
<div class="grid-x grid-padding-x">
<div class="large-12 cell">
<label>Select Box</label>
<select>
<option value="husker">Husker</option>
<option value="starbuck">Starbuck</option>
<option value="hotdog">Hot Dog</option>
<option value="apollo">Apollo</option>
</select>
</div>
</div>
<div class="grid-x grid-padding-x">
<div class="large-6 medium-6 cell">
<label>Choose Your Favorite</label>
<input type="radio" name="pokemon" value="Red" id="pokemonRed"><label for="pokemonRed">Radio 1</label>
<input type="radio" name="pokemon" value="Blue" id="pokemonBlue"><label for="pokemonBlue">Radio 2</label>
</div>
<div class="large-6 medium-6 cell">
<label>Check these out</label>
<input id="checkbox1" type="checkbox"><label for="checkbox1">Checkbox 1</label>
<input id="checkbox2" type="checkbox"><label for="checkbox2">Checkbox 2</label>
</div>
</div>
<div class="grid-x grid-padding-x">
<div class="large-12 cell">
<label>Textarea Label</label>
<textarea placeholder="small-12.cell"></textarea>
</div>
</div>
</form>
</div>
<div class="large-4 medium-4 cell">
<h5>Try one of these buttons:</h5>
<p><a href="#" class="button">Simple Button</a><br/>
<a href="#" class="success button">Success Btn</a><br/>
<a href="#" class="alert button">Alert Btn</a><br/>
<a href="#" class="secondary button">Secondary Btn</a></p>
<div class="callout">
<h5>So many components, girl!</h5>
<p>A whole kitchen sink of goodies comes with Foundation. Check out the docs to see them all, along with details on making them your own.</p>
<a href="https://get.foundation/sites/docs/" class="small button">Go to Foundation Docs</a>
</div>
</div>
</div>

29
web/templates/manage.html Normal file
View File

@@ -0,0 +1,29 @@
<div class="grid-x grid-padding-x">
<div class="large-12 cell">
<h5>Manage:
</h5>
<table>
<tr><th>id</th><th>url</th><th>created</th><th>scraped</th></tr>
{{ range .bookmarks }}
<tr>
<th>{{ .ID }}</th>
<td>
<a href="{{ .URL }}">{{ .Info.Title }}</a>
<br>
<a href="{{ .URL }}">{{ niceURL .URL }}</a>
</td>
<td>{{ (nicetime .TimestampCreated).HumanDuration }} ago</td>
<td>{{ (nicetime .TimestampLastScraped).HumanDuration }} ago</td>
<td>
<button class="button" hx-post="/scrape/{{ .ID }}">scrape</button>
</td>
</tr>
{{ end }}
</table>
</div>
</div>

41
web/templates/search.html Normal file
View File

@@ -0,0 +1,41 @@
<div class="grid-x grid-padding-x">
<div class="large-8 medium-8 cell">
<h5>Search:
<span id="htmx-indicator-search" class="htmx-indicator">
<img src="/assets/image/beating.gif" /> Searching...
</span>
</h5>
<form onsubmit="return false">
<div class="grid-x grid-padding-x">
<div class="large-12 cell">
<label>Free text</label>
<input type="text" name="query" placeholder="" hx-post="/search"
hx-trigger="keyup changed delay:50ms, search" hx-target="#search-results"
hx-indicator="#htmx-indicator-search" />
</div>
</div>
</form>
<div id="search-results">
</div>
</div>
{{ template "add_url_form.html" . }}
<!-- <div class="large-4 medium-4 cell">
<h5>Try one of these buttons:</h5>
<p><a href="#" class="button">Simple Button</a><br />
<a href="#" class="success button">Success Btn</a><br />
<a href="#" class="alert button">Alert Btn</a><br />
<a href="#" class="secondary button">Secondary Btn</a>
</p>
<div class="callout">
<h5>So many components, girl!</h5>
<p>A whole kitchen sink of goodies comes with Foundation. Check out the docs to see them all, along with
details on making them your own.</p>
<a href="https://get.foundation/sites/docs/" class="small button">Go to Foundation Docs</a>
</div>
</div> -->
</div>

View File

@@ -0,0 +1,5 @@
<ul>
{{ range .results }}
<li><a href="{{ .URL }}">{{ .Info.Title }}</a> - {{ .URL }}</li>
{{ end }}
</ul>

View File

@@ -0,0 +1,28 @@
<div id="label-widget">
<div class="grid-x grid-padding-x">
<div class="small-3 medium-2 large-1 cell">
</div>
<div class="small-9 medium-10 large-5 cell"
hx-post="/tags"
hx-target="#label-widget"
hx-trigger="change">
<label for="tag-entry"
class="Xtext-right Xmiddle">Tags</label>
<input id="tag-entry" type="text" name="tag" placeholder="enter tags" />
</div>
<div class="small-12 large-6 cell">
{{ range .tags }}
<a href="#"
title="remove {{ . }}"
hx-trigger="click"
hx-target="#label-widget"
hx-post="/tags?remove={{ . }}">
{{ . }}
</a>
{{ end }}
<input type="hidden" name="tags_hidden" value="{{ .tags_hidden }}">
</div>
</div>
</div>