Add query function
This commit is contained in:
@@ -11,10 +11,5 @@
|
||||
<label>Tx Name: <input name="name" type="text"></label></br>
|
||||
<input type="submit">
|
||||
</form>
|
||||
<h2>Scripts</h2>
|
||||
<ul>
|
||||
{{ range $k, $v := .Scripts }}
|
||||
<li><a href="/exec?name={{ $k }}">{{ $k }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ template "scripts" .Scripts }}
|
||||
{{ end }}
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
<ul>
|
||||
{{ with .User }}
|
||||
{{ .Email }}
|
||||
<li><a href="dashboard">儀表板</a></li>
|
||||
<li><a href="edit">編輯</a></li>
|
||||
<li><a href="download">下載</a></li>
|
||||
<li><a href="exec">查詢</a></li>
|
||||
<li><a href="query">查詢</a></li>
|
||||
{{ end }}
|
||||
</nav>
|
||||
{{ block "main" .Data }}
|
||||
|
||||
8
templates/layouts/scripts.html
Normal file
8
templates/layouts/scripts.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{{ define "scripts" }}
|
||||
<h3>常用指令</h3>
|
||||
<ul>
|
||||
{{ range $k, $v := . }}
|
||||
<li><a href="/query?query={{ urlquery $v }}">{{ $k }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
12
templates/query.html
Normal file
12
templates/query.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{{ define "title" }}查詢{{ end }}
|
||||
{{ define "main" }}
|
||||
<h1>查詢</h1>
|
||||
{{ with .Result }}
|
||||
<pre><code>{{ . }}</code></pre>
|
||||
{{ end }}
|
||||
<form action="/query" method="GET">
|
||||
<input type="text" name="query" value="{{ .Query }}" autofocus>
|
||||
<input type="submit" value="查詢">
|
||||
</form>
|
||||
{{ template "scripts" .Scripts }}
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user