فهرست منبع

[GinS] Keep search term in input

cgars 7 سال پیش
والد
کامیت
2a907baa4c
2فایلهای تغییر یافته به همراه2 افزوده شده و 1 حذف شده
  1. 1 0
      routes/search.go
  2. 1 1
      templates/explore/search_ext.tmpl

+ 1 - 0
routes/search.go

@@ -56,6 +56,7 @@ func ExploreData(c *context.Context) {
 	c.Data["PageIsExploreData"] = true
 
 	keywords := c.Query("q")
+	c.Data["Keywords"] = keywords
 	sType, err := strconv.ParseInt(c.Query("stype"), 10, 0)
 	if err != nil {
 		logrus.Errorf("Serach type not understood:%+v", err)

+ 1 - 1
templates/explore/search_ext.tmpl

@@ -1,6 +1,6 @@
 <form class="ui form labeled ">
 	<div class="ui fluid action input">
-		<input name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr " explore.search"}}..." autofocus>
+		<input name="q" value="{{.Keywords}}" placeholder="{{if not .Keywords}}{{.i18n.Tr " explore.search"}}...{{end}}" autofocus>
 		<select class="ui dropdown" name="stype" id="search-type-select">
 			<option value="0" {{if eq .opsel 0}}selected{{end}}>Match</option>
 			<option value="1" {{if eq .opsel 1}}selected{{end}}>Fuzzy Term</option>