diff options
Diffstat (limited to 'src/guff/views/html/test.cr')
-rw-r--r-- | src/guff/views/html/test.cr | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/guff/views/html/test.cr b/src/guff/views/html/test.cr new file mode 100644 index 0000000..e31ebdb --- /dev/null +++ b/src/guff/views/html/test.cr @@ -0,0 +1,33 @@ +require "html" +require "ecr/macros" +require "./page" + +class Guff::TestHTMLView + TITLE = "Guff Tests" + + def self.run(models, context : HTTP::Server::Context) + new(models).run(context) + end + + def initialize(@models : Models) + end + + def run(context) + page = PageHTMLView.new(TITLE, self.to_s) + context.response.content_type = page.content_type + context.response.puts page + end + + private def posts(state : String) + @models.post.get_posts( + tags: [["_blog"]], + filters: { state: state } + ) + end + + def h(s : String) + HTML.escape(s || "") + end + + ECR.def_to_s("./src/guff/views/ecrs/test.ecr") +end |