Search results slightly prettier
Former-commit-id: 518b86ee61c4816e346824e36ca2b8afc5a887ae [formerly d0e4ab7a725aa0dcf35acc0965e685563d33590e] [formerly 3eeb7807675ab03f3eb3ba9a2fb0f612c1ae742d [formerly 522d50333f7d3711c33a77db436c6dd75a8999b7]] Former-commit-id: 311dbbb9e90be32928fdca3087bae73e574610fd [formerly fbf64faddb2a189f675b4652cd170418bbbf48f7] Former-commit-id: 834138c56639871c32ad7f393440aee6a7281a9a
This commit is contained in:
		
							parent
							
								
									9c2609995a
								
							
						
					
					
						commit
						412ac9c9d6
					
				| 
						 | 
				
			
			@ -20,7 +20,11 @@
 | 
			
		|||
        <span v-if="search.length === 0 && commands.length === 0">{{ text }}</span>
 | 
			
		||||
        <ul v-else-if="search.length > 0">
 | 
			
		||||
          <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>
 | 
			
		||||
        </ul>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -184,10 +188,12 @@ export default {
 | 
			
		|||
      // In case of being a search.
 | 
			
		||||
      api.search(path, this.value,
 | 
			
		||||
        (event) => {
 | 
			
		||||
          let url = event.data
 | 
			
		||||
          if (url[0] === '/') url = url.substring(1)
 | 
			
		||||
          let response = JSON.parse(event.data)
 | 
			
		||||
          if (response.path[0] === '/') {
 | 
			
		||||
            response.path = response.path.substring(1)
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          this.search.push(url)
 | 
			
		||||
          this.search.push(response)
 | 
			
		||||
          this.scrollable.scrollTop = this.scrollable.scrollHeight
 | 
			
		||||
        },
 | 
			
		||||
        (event) => {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -177,11 +177,24 @@ header .search-button {
 | 
			
		|||
 | 
			
		||||
#search.active #result i {
 | 
			
		||||
  color: #ccc;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#search.active #result > p > i {
 | 
			
		||||
  text-align: center;
 | 
			
		||||
  margin: 0 auto;
 | 
			
		||||
  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 {
 | 
			
		||||
  color: rgba(255, 255, 255, .5);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
7327806da8feadd5f82e2286efb2e2dd44109d3e
 | 
			
		||||
| 
						 | 
				
			
			@ -2,6 +2,7 @@ package filemanager
 | 
			
		|||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"mime"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"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 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue