Keep using kilt for rendering

Directly using Crystal's ECR seems to be causing issues, so
don't use kemal's 'render' macro and patch 'content_for' to
have the same behavior as before Kemal v1.1.1
This commit is contained in:
Samantaz Fox
2022-04-10 22:53:03 +02:00
parent 84b6429ca6
commit 1f66d7ef74
5 changed files with 37 additions and 3 deletions

View File

@@ -48,13 +48,19 @@ module JSON::Serializable
end
end
macro templated(filename, template = "template", navbar_search = true)
macro templated(_filename, template = "template", navbar_search = true)
navbar_search = {{navbar_search}}
render "src/invidious/views/#{{{filename}}}.ecr", "src/invidious/views/#{{{template}}}.ecr"
{{ filename = "src/invidious/views/" + _filename + ".ecr" }}
{{ layout = "src/invidious/views/" + template + ".ecr" }}
__content_filename__ = {{filename}}
content = Kilt.render({{filename}})
Kilt.render({{layout}})
end
macro rendered(filename)
render "src/invidious/views/#{{{filename}}}.ecr"
Kilt.render("src/invidious/views/#{{{filename}}}.ecr")
end
# Similar to Kemals halt method but works in a