diff options
author | Paul Duncan <pabs@pablotron.org> | 2016-03-10 09:25:07 -0500 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2016-03-10 09:25:07 -0500 |
commit | 5d7cd9615840341d2ccab1d8b7acfd49d6a5b743 (patch) | |
tree | f2ff9b9f47280826123e962efb95202af11f225a /src/guff/views/html | |
parent | adfc9a07d407a9e29bcd7d8af4f24bf7d75c9fe6 (diff) | |
download | old-guff-5d7cd9615840341d2ccab1d8b7acfd49d6a5b743.tar.bz2 old-guff-5d7cd9615840341d2ccab1d8b7acfd49d6a5b743.zip |
rename test to test-blog
Diffstat (limited to 'src/guff/views/html')
-rw-r--r-- | src/guff/views/html/test-blog.cr | 65 | ||||
-rw-r--r-- | src/guff/views/html/test.cr | 33 |
2 files changed, 65 insertions, 33 deletions
diff --git a/src/guff/views/html/test-blog.cr b/src/guff/views/html/test-blog.cr new file mode 100644 index 0000000..9ad91f3 --- /dev/null +++ b/src/guff/views/html/test-blog.cr @@ -0,0 +1,65 @@ +require "html" +require "ecr/macros" +require "./page" + +class Guff::TestBlogHTMLView + TITLE = "Guff Blog Test" + + POST_SETS = [{ + id: "draft", + name: "Drafts", + + actions: [{ + id: "posted", + name: "Post", + }, { + id: "deleted", + name: "Delete", + }], + }, { + id: "posted", + name: "Posted", + + actions: [{ + id: "draft", + name: "Draft", + }, { + id: "deleted", + name: "Delete", + }], + }, { + id: "deleted", + name: "Deleted Posts", + + actions: [{ + id: "draft", + name: "Draft", + }], + }] + + 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-blog.ecr") +end diff --git a/src/guff/views/html/test.cr b/src/guff/views/html/test.cr deleted file mode 100644 index 37317e5..0000000 --- a/src/guff/views/html/test.cr +++ /dev/null @@ -1,33 +0,0 @@ -require "html" -require "ecr/macros" -require "./page" - -class Guff::TestHTMLView - TITLE = "Guff Blog Test" - - 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 |