if .This.Namespaces, ui draws dropdown for namespaces

master
Bel LaPointe 2022-02-18 07:07:01 -07:00
parent fa499c200e
commit 08dfb715d3
6 changed files with 30 additions and 8 deletions

View File

@ -7,7 +7,7 @@
</header>
<body class="fullscreen tb_fullscreen lr_fullscreen" style="position: absolute">
<div class="rows" style="height: inherit;">
{{ template "_searchbar" }}
{{ template "_topbar" . }}
<div class="columns thic_flex tb_buffer" style="height: calc(100% - 4rem);">
{{ template "_filetree" . }}
<div class="thic_flex lr_fullscreen" style="margin-left: 1em; width: 5px;">

View File

@ -37,11 +37,12 @@ func main() {
}
data := map[string]interface{}{
"This": map[string]interface{}{
"ID": "id00/id11",
"Title": "title id11",
"ReadOnly": false,
"PID": "id00",
"PTitle": "title id00",
"Namespaces": []string{"datastore", "dp-orchestration"},
"ID": "id00/id11",
"Title": "title id11",
"ReadOnly": false,
"PID": "id00",
"PTitle": "title id00",
"Content": `# hello
## world

View File

@ -7,7 +7,7 @@
</header>
<body class="fullscreen tb_fullscreen lr_fullscreen" style="position: absolute">
<div class="rows" style="height: inherit;">
{{ template "_searchbar" }}
{{ template "_topbar" . }}
<div class="columns thic_flex tb_buffer" style="height: calc(100% - 4rem);">
{{ template "_filetree" . }}
<div class="thic_flex lr_fullscreen" style="margin-left: 1em; width: 5px;">

View File

@ -0,0 +1,15 @@
{{ define "_namespace" }}
<script>
function setNamespace() {
document.getElementById("namespace").disabled = true
window.location.href = `${window.location.protocol}`+"//"+`${window.location.host}/ui/files/${document.getElementById("namespace").value}`
}
</script>
{{ if .This.Namespaces }}
<select id="namespace" onchange="setNamespace()" style="max-width: 7rem;">
{{ range .This.Namespaces }}
<option>{{ . }}</option>
{{ end }}
</select>
{{ end }}
{{ end }}

View File

@ -1,5 +1,5 @@
{{ define "_searchbar" }}
<form class="columns" action="/ui/search" method="GET">
<form class="columns thic_flex" action="/ui/search" method="GET">
<input class="thic_flex" type="text" name="q" placeholder="space delimited search regexp"/>
<input class="info lil_btn" type="submit" value="search"/>
</form>

View File

@ -0,0 +1,6 @@
{{ define "_topbar" }}
<div class="columns lr_fullscreen">
{{ template "_namespace" . }}
{{ template "_searchbar" . }}
</div>
{{ end }}