Blog/themes/blog/dashboard.gohtml

45 lines
1.8 KiB
Plaintext
Raw Permalink Normal View History

2024-03-21 07:25:12 +00:00
{{template "header" .}}
<div class="sub-title">- {{ .Title }} -</div>
<p>Search</p>
<div class="item-content">
<div class="search-box">
<input id="search-input" class="search-input" type="text">
<img onclick="searchArticle()" class="search-icon" src="/public/img/search.svg" alt="">
</div>
</div>
<p>Theme</p>
<div class="item-content">
<ul class="colors">
{{range $index, $color := .Config.ThemeOption }}
<li onclick="selectColor('{{ $index }}')" class="{{ if eq $color $.Config.ThemeColor }}active{{end}}" style="background-color: {{ $color }}"></li>
{{end}}
</ul>
</div>
<p>Action</p>
<div class="item-content">
<div class="action">
2024-05-03 14:42:59 +00:00
<a href="{{ .Config.Dashboard }}?action=updateArticle">更新文章</a>
2024-03-21 07:25:12 +00:00
</div>
</div>
{{ if .Data.msg }}
<div id="action-msg" class="action-msg">
{{range $msg := .Data.msg }}
<span>{{ $msg }}</span>
{{ end }}
<span class="close" onclick="document.getElementById('action-msg').remove()">x</span>
</div>
{{ end }}
<span class="action-tip">提示更新文章会执行git pull命令和你的仓库网络有关等待时间可能会稍长。</span>
<script>
function selectColor(index) {
2024-05-03 14:42:59 +00:00
window.location.href = '{{ .Config.Dashboard }}?theme=' + index
2024-03-21 07:25:12 +00:00
}
function searchArticle() {
var searchKey = document.getElementById('search-input').value;
searchKey = searchKey.replace(/^\s+|\s+$/g,"")
if("" === searchKey){return}
window.location.href = '/?search=' + searchKey
}
</script>
{{template "footer" .}}