Search results slightly prettier
parent
1234ee32e4
commit
522d50333f
|
@ -20,7 +20,11 @@
|
||||||
<span v-if="search.length === 0 && commands.length === 0">{{ text }}</span>
|
<span v-if="search.length === 0 && commands.length === 0">{{ text }}</span>
|
||||||
<ul v-else-if="search.length > 0">
|
<ul v-else-if="search.length > 0">
|
||||||
<li v-for="s in search">
|
<li v-for="s in search">
|
||||||
<router-link @click.native="close" :to="'./' + s">./{{ s }}</router-link>
|
<router-link @click.native="close" :to="'./' + s.path">
|
||||||
|
<i v-if="s.dir" class="material-icons">folder</i>
|
||||||
|
<i v-else class="material-icons">insert_drive_file</i>
|
||||||
|
<span>./{{ s.path }}</span>
|
||||||
|
</router-link>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -184,10 +188,12 @@ export default {
|
||||||
// In case of being a search.
|
// In case of being a search.
|
||||||
api.search(path, this.value,
|
api.search(path, this.value,
|
||||||
(event) => {
|
(event) => {
|
||||||
let url = event.data
|
let response = JSON.parse(event.data)
|
||||||
if (url[0] === '/') url = url.substring(1)
|
if (response.path[0] === '/') {
|
||||||
|
response.path = response.path.substring(1)
|
||||||
|
}
|
||||||
|
|
||||||
this.search.push(url)
|
this.search.push(response)
|
||||||
this.scrollable.scrollTop = this.scrollable.scrollHeight
|
this.scrollable.scrollTop = this.scrollable.scrollHeight
|
||||||
},
|
},
|
||||||
(event) => {
|
(event) => {
|
||||||
|
|
|
@ -177,11 +177,24 @@ header .search-button {
|
||||||
|
|
||||||
#search.active #result i {
|
#search.active #result i {
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#search.active #result > p > i {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
display: table;
|
display: table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#search.active #result ul li a {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: .3em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#search.active #result ul li a i {
|
||||||
|
margin-right: .3em;
|
||||||
|
}
|
||||||
|
|
||||||
#search::-webkit-input-placeholder {
|
#search::-webkit-input-placeholder {
|
||||||
color: rgba(255, 255, 255, .5);
|
color: rgba(255, 255, 255, .5);
|
||||||
}
|
}
|
||||||
|
|
2318
rice-box.go
2318
rice-box.go
File diff suppressed because one or more lines are too long
|
@ -2,6 +2,7 @@ package filemanager
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
"mime"
|
"mime"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
@ -321,7 +322,12 @@ func search(c *RequestContext, w http.ResponseWriter, r *http.Request) (int, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return conn.WriteMessage(websocket.TextMessage, []byte(path))
|
response, _ := json.Marshal(map[string]interface{}{
|
||||||
|
"dir": f.IsDir(),
|
||||||
|
"path": path,
|
||||||
|
})
|
||||||
|
|
||||||
|
return conn.WriteMessage(websocket.TextMessage, response)
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue