Gallery: Retain search filters when toggling card types
This commit is contained in:
parent
3d01fc55f4
commit
fae995e486
|
@ -7,6 +7,7 @@ import (
|
|||
"html/template"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -211,6 +212,10 @@ func QueryPlus(r *http.Request) func(...interface{}) template.URL {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Sort them deterministically.
|
||||
sort.Strings(parts)
|
||||
|
||||
return template.URL(strings.Join(parts, "&"))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -212,10 +212,10 @@
|
|||
<div class="tabs is-toggle is-small is-hidden-mobile">
|
||||
<ul>
|
||||
<li{{if eq .ViewStyle "cards"}} class="is-active"{{end}}>
|
||||
<a href="{{.Request.URL.Path}}?view=cards">Cards</a>
|
||||
<a href="{{.Request.URL.Path}}?{{QueryPlus "view" "cards"}}">Cards</a>
|
||||
</li>
|
||||
<li{{if eq .ViewStyle "full"}} class="is-active"{{end}}>
|
||||
<a href="{{.Request.URL.Path}}?view=full">Full</a>
|
||||
<a href="{{.Request.URL.Path}}?{{QueryPlus "view" "full"}}">Full</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -345,6 +345,9 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Retain cards vs. full parameter -->
|
||||
<input type="hidden" name="view" value="{{.ViewStyle}}">
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user