Browse Source

[GinS] Keep search type selection after searching

cgars 7 years ago
parent
commit
35d6539ee7
2 changed files with 5 additions and 4 deletions
  1. 1 0
      routes/search.go
  2. 4 4
      templates/explore/search_ext.tmpl

+ 1 - 0
routes/search.go

@@ -74,6 +74,7 @@ func ExploreData(c *context.Context) {
 		return
 	}
 	c.Data["Blobs"] = res.Blobs
+	c.Data["opsel"] = sType
 	c.HTML(200, EXPLORE_DATA)
 }
 

+ 4 - 4
templates/explore/search_ext.tmpl

@@ -2,10 +2,10 @@
 	<div class="ui fluid action input">
 		<input name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr " explore.search"}}..." autofocus>
 		<select class="ui dropdown" name="stype" id="search-type-select">
-			<option value="0">Match</option>
-			<option value="1">Fuzzy Term</option>
-			<option value="2">Wildcard Term</option>
-			<option value="3">Querry String</option>
+			<option value="0" {{if eq .opsel 0}}selected{{end}}>Match</option>
+			<option value="1" {{if eq .opsel 1}}selected{{end}}>Fuzzy Term</option>
+			<option value="2" {{if eq .opsel 2}}selected{{end}}>Wildcard Term</option>
+			<option value="3" {{if eq .opsel 3}}selected{{end}}>Querry String</option>
 		</select>
 		<button class="ui blue button">{{.i18n.Tr "explore.search"}}</button>
 	</div>