Keep search query on reload
This commit is contained in:
@@ -71,10 +71,11 @@ class NoteView(staticFileResolver: StaticFileResolver) : View(staticFileResolver
|
||||
fun search(
|
||||
jwtPayload: JwtPayload,
|
||||
notes: List<PersistedNoteMetadata>,
|
||||
query: String,
|
||||
numberOfDeletedNotes: Int,
|
||||
) = renderPage("Notes", jwtPayload = jwtPayload) {
|
||||
div("container mx-auto p-4") {
|
||||
noteListHeader(numberOfDeletedNotes)
|
||||
noteListHeader(numberOfDeletedNotes, query)
|
||||
noteTable(notes)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import kotlinx.html.*
|
||||
import kotlinx.html.ButtonType.submit
|
||||
import kotlinx.html.FormMethod.post
|
||||
|
||||
fun DIV.noteListHeader(numberOfDeletedNotes: Int) {
|
||||
fun DIV.noteListHeader(numberOfDeletedNotes: Int, query: String = "") {
|
||||
div("flex justify-between mb-4") {
|
||||
h1("text-2xl underline") { +"Notes" }
|
||||
span {
|
||||
@@ -23,7 +23,9 @@ fun DIV.noteListHeader(numberOfDeletedNotes: Int) {
|
||||
input(
|
||||
name = "search",
|
||||
classes = "$colors rounded w-3/4 border appearance-none focus:outline-none text-base p-2"
|
||||
)
|
||||
) {
|
||||
attributes["value"] = query
|
||||
}
|
||||
button(type = submit, classes = "btn btn-green w-1/4") {
|
||||
+"search"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user