Add config page, and configuration for the base URL, so the bookmarklet will work on remote machines.
This commit is contained in:
@@ -21,11 +21,12 @@
|
||||
<li>
|
||||
<a href="#">Admin</a>
|
||||
<ul class="menu vertical">
|
||||
<li><a href="/config">Configuration</a></li>
|
||||
<li><a href="/manage">Manage links</a></li>
|
||||
<li><a href="/export">Export all URLs</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="javascript:void(window.open('http://localhost:8080/bookmarklet?url=' +encodeURIComponent(window.location), 'windowName', 'width=640,height=480'))">Bookmarklet</a></li>
|
||||
<li><a href="javascript:void(window.open('{{ .config.BaseURL }}/bookmarklet?url=' +encodeURIComponent(window.location), 'windowName', 'width=640,height=480'))">Bookmarklet</a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
@@ -50,6 +51,8 @@
|
||||
{{ template "bookmarklet.html" . }}
|
||||
{{ else if eq .page "manage" }}
|
||||
{{ template "manage.html" . }}
|
||||
{{ else if eq .page "config" }}
|
||||
{{ template "config.html" . }}
|
||||
{{ end }}
|
||||
{{/* template "foundation_sample.html" . */}}
|
||||
</div>
|
||||
|
||||
7
web/templates/config.html
Normal file
7
web/templates/config.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<div class="grid-x grid-padding-x">
|
||||
<div class="large-12 cell">
|
||||
|
||||
<h5>Configuration</h5>
|
||||
{{ template "config_form.html" . }}
|
||||
</div>
|
||||
</div>
|
||||
12
web/templates/config_form.html
Normal file
12
web/templates/config_form.html
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
<form onsubmit="false;" id="config-form" hx-target="#config-form">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Base URL</th>
|
||||
<td>
|
||||
<input type="text" name="baseurl" value="{{ .config.BaseURL }}">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p><a class="button" hx-post="/config">save</a></p>
|
||||
</form>
|
||||
Reference in New Issue
Block a user