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