aboutsummaryrefslogtreecommitdiff
path: root/src/guff/views/html/test.cr
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-03-10 00:22:20 -0500
committerPaul Duncan <pabs@pablotron.org>2016-03-10 00:22:20 -0500
commitf2691054f86ad45e90eb8473569def04ae3d95cd (patch)
treea347ba1972c4797f54988e4a3bdeae5dfa0583d1 /src/guff/views/html/test.cr
parent9f8c1fce2c94c9fb040586740e28b3e83a3cc41f (diff)
downloadold-guff-f2691054f86ad45e90eb8473569def04ae3d95cd.tar.bz2
old-guff-f2691054f86ad45e90eb8473569def04ae3d95cd.zip
add blog test page
Diffstat (limited to 'src/guff/views/html/test.cr')
-rw-r--r--src/guff/views/html/test.cr33
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