aboutsummaryrefslogtreecommitdiff
path: root/src/guff
diff options
context:
space:
mode:
Diffstat (limited to 'src/guff')
-rw-r--r--src/guff/html-page-view.cr37
-rw-r--r--src/guff/views/page.ecr13
2 files changed, 50 insertions, 0 deletions
diff --git a/src/guff/html-page-view.cr b/src/guff/html-page-view.cr
new file mode 100644
index 0000000..3ec33fe
--- /dev/null
+++ b/src/guff/html-page-view.cr
@@ -0,0 +1,37 @@
+require "ecr/macros"
+require "html"
+
+module Guff
+ class HTMLPageView
+ property :title
+ property :body
+ property :scripts
+ property :styles
+ property :metas
+ property :body_id
+ property :body_class
+
+ def initialize(@title = "" : String, @body = "" : String)
+ @scripts = [] of String
+ @styles = [] of String
+ @metas = [] of Hash(String, String)
+ end
+
+ def page_headers : String
+ # TODO
+ ""
+ end
+
+ def page_footers : String
+ # TODO
+ ""
+ end
+
+ def h(s : String?) : String
+ s ? HTML.escape(s) : ""
+ end
+
+
+ ECR.def_to_s("./src/guff/views/page.ecr")
+ end
+end
diff --git a/src/guff/views/page.ecr b/src/guff/views/page.ecr
new file mode 100644
index 0000000..505731a
--- /dev/null
+++ b/src/guff/views/page.ecr
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html lang='en-US'>
+ <head>
+ <title><%= h(@title) %></title>
+ <%= page_headers %>
+ </head>
+
+ <body id='<%= @body_id %>' class='<%= body_class %>'><%=
+ @body
+ %></body>
+
+ <%= page_footers %>
+</html>