Skip to content

Commit

Permalink
added Filters.title
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianKirmaier committed Jan 15, 2025
1 parent b1a4293 commit d86df10
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,22 @@ object Filters {
})
}
}
def title(title: String): Filter = { route => { request =>
val r = route.apply(request)

Response(r.future.map {
case x: View =>
new View {
override def title: String = title
override def description: String = x.description
override def content: all.Node = x.realContent

override def fullscreen: Boolean = x.fullscreen
}
case x => x
})
}
}

def errorPage(): Filter = errorPage((request, ex) => Response.node(new Label("Error: " + ex.getMessage)))
def errorPage(biFunction: BiFunction[Request, Throwable, Response]): Filter = {
Expand Down

0 comments on commit d86df10

Please sign in to comment.