aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/themes/blank/templates/blog-list-item.html8
-rw-r--r--data/themes/blank/templates/blog-list.html17
-rw-r--r--data/themes/blank/templates/post-blog.html15
-rw-r--r--data/themes/blank/templates/post-page.html (renamed from data/themes/blank/templates/page.html)2
-rw-r--r--data/themes/blank/templates/post-project.html22
-rw-r--r--data/themes/default/templates/post-blog.html (renamed from data/themes/default/templates/blog-post.html)2
-rw-r--r--data/themes/default/templates/post-page.html (renamed from data/themes/default/templates/page.html)2
-rw-r--r--data/themes/default/templates/post-project.html (renamed from data/themes/default/templates/project.html)4
-rw-r--r--src/guff/handlers.cr8
-rw-r--r--src/guff/views/blog/list-item.cr7
-rw-r--r--src/guff/views/blog/list.cr2
-rw-r--r--src/guff/views/posts/blog.cr (renamed from src/guff/views/blog/post.cr)4
-rw-r--r--src/guff/views/posts/page.cr (renamed from src/guff/views/page.cr)6
-rw-r--r--src/guff/views/posts/project.cr13
-rw-r--r--src/guff/views/project.cr13
15 files changed, 90 insertions, 35 deletions
diff --git a/data/themes/blank/templates/blog-list-item.html b/data/themes/blank/templates/blog-list-item.html
new file mode 100644
index 0000000..f2c6c9f
--- /dev/null
+++ b/data/themes/blank/templates/blog-list-item.html
@@ -0,0 +1,8 @@
+<div class='guff-blog-list-item'>
+ <b>%{name|h}</b><br/>
+ <b>
+ by <span class='user'>%{user_name|h}</span>
+ on <span class='date'>%{posted_at_text|h}</span>
+ </b><br/><br/>
+ %{body}
+</div>
diff --git a/data/themes/blank/templates/blog-list.html b/data/themes/blank/templates/blog-list.html
new file mode 100644
index 0000000..0ed98f0
--- /dev/null
+++ b/data/themes/blank/templates/blog-list.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang='en-US'>
+ <head>
+ <meta charset="utf-8"/>
+ <title>%{name|h}</title>
+
+ %{styles}
+ </head>
+
+ <body class='guff-blog-list'>
+ <div class='posts'>%{
+ body
+ }</div><!-- posts -->
+ </body>
+
+ %{scripts}
+</html>
diff --git a/data/themes/blank/templates/post-blog.html b/data/themes/blank/templates/post-blog.html
new file mode 100644
index 0000000..ec99b37
--- /dev/null
+++ b/data/themes/blank/templates/post-blog.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html lang='en-US'>
+ <head>
+ <meta charset="utf-8"/>
+ <title>%{name|h}</title>
+
+ %{styles}
+ </head>
+
+ <body class='guff-post-blog'>
+ %{body}
+ </body>
+
+ %{scripts}
+</html>
diff --git a/data/themes/blank/templates/page.html b/data/themes/blank/templates/post-page.html
index 78737aa..264d152 100644
--- a/data/themes/blank/templates/page.html
+++ b/data/themes/blank/templates/post-page.html
@@ -7,7 +7,7 @@
%{styles}
</head>
- <body>
+ <body class='guff-post-page'>
%{body}
</body>
diff --git a/data/themes/blank/templates/post-project.html b/data/themes/blank/templates/post-project.html
new file mode 100644
index 0000000..3fd5a76
--- /dev/null
+++ b/data/themes/blank/templates/post-project.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html lang='en-US'>
+ <head>
+ <meta charset="utf-8"/>
+ <title>%{name | h}</title>
+
+ %{styles}
+ </head>
+
+ <body class='guff-post-project'>
+ %{body}
+
+ <p>
+ <a
+ href='%{repo_url|h}'
+ title='View %{name|h} Git repository.'
+ >%{repo_url|h}</a>
+ </p>
+ </body>
+
+ %{scripts}
+</html>
diff --git a/data/themes/default/templates/blog-post.html b/data/themes/default/templates/post-blog.html
index f1eaeb4..0facb3b 100644
--- a/data/themes/default/templates/blog-post.html
+++ b/data/themes/default/templates/post-blog.html
@@ -7,7 +7,7 @@
%{styles}
</head>
- <body class='guff-blog-post'>
+ <body class='guff-post-blog'>
<b>blog post: %{name|h}</b><br/>
<b>
by <span class='user'>%{user_name|h}</span>
diff --git a/data/themes/default/templates/page.html b/data/themes/default/templates/post-page.html
index 24f2290..fdd4523 100644
--- a/data/themes/default/templates/page.html
+++ b/data/themes/default/templates/post-page.html
@@ -9,7 +9,7 @@
%{styles}
</head>
- <body class='guff-page'>
+ <body class='guff-post-page'>
<div class='post'>
<b>page: %{name | h}</b><br/>
<b>
diff --git a/data/themes/default/templates/project.html b/data/themes/default/templates/post-project.html
index c62227a..725cab0 100644
--- a/data/themes/default/templates/project.html
+++ b/data/themes/default/templates/post-project.html
@@ -2,12 +2,12 @@
<html lang='en-US'>
<head>
<meta charset="utf-8"/>
- <title>Project: %{name | h}</title>
+ <title>%{name | h}</title>
%{styles}
</head>
- <body class='guff-project'>
+ <body class='guff-post-project'>
<b>Project: %{name | h}</b><br/>
%{body}
diff --git a/src/guff/handlers.cr b/src/guff/handlers.cr
index 8c3e550..ce52b6a 100644
--- a/src/guff/handlers.cr
+++ b/src/guff/handlers.cr
@@ -357,7 +357,7 @@ module Guff::Handlers
context.response.content_type = "text/html; charset=utf-8"
context.response.status_code = 200
- Views::PageView.new(@context, r).to_s(context.response)
+ Views::Posts::Page.new(@context, r).to_s(context.response)
else
# unknown page
call_next(context)
@@ -400,7 +400,7 @@ module Guff::Handlers
context.response.content_type = "text/html; charset=utf-8"
context.response.status_code = 200
- Views::ProjectView.new(@context, r).to_s(context.response)
+ Views::Posts::Project.new(@context, r).to_s(context.response)
else
# redirect to project
context.response.headers["location"] = path + "/"
@@ -451,7 +451,7 @@ module Guff::Handlers
context.response.content_type = "text/html; charset=utf-8"
context.response.status_code = 200
- Views::Blog::PostView.new(@context, site_id, r).to_s(context.response)
+ Views::Posts::Blog.new(@context, site_id, r).to_s(context.response)
else
# unknown page
call_next(context)
@@ -505,7 +505,7 @@ module Guff::Handlers
context.response.content_type = "text/html; charset=utf-8"
context.response.status_code = 200
- Views::Blog::ListView.new(@context, site_id, r).to_s(context.response)
+ Views::Blog::List.new(@context, site_id, r).to_s(context.response)
else
# unknown page
call_next(context)
diff --git a/src/guff/views/blog/list-item.cr b/src/guff/views/blog/list-item.cr
deleted file mode 100644
index 12add51..0000000
--- a/src/guff/views/blog/list-item.cr
+++ /dev/null
@@ -1,7 +0,0 @@
-class Guff::Views::Blog::ListItemView < Guff::Views::HTMLView
- def initialize(context : Context, @item : Hash(String, String))
- super(context)
- end
-
- ECR.def_to_s("src/views/blog/list-item.ecr")
-end
diff --git a/src/guff/views/blog/list.cr b/src/guff/views/blog/list.cr
index 00bd587..f97aea6 100644
--- a/src/guff/views/blog/list.cr
+++ b/src/guff/views/blog/list.cr
@@ -3,7 +3,7 @@ require "../template-html"
#
# TODO: add y/m/d/page
#
-class Guff::Views::Blog::ListView < Guff::Views::TemplateHTMLView
+class Guff::Views::Blog::List < Guff::Views::TemplateHTMLView
TITLE = "Blog List"
def initialize(
diff --git a/src/guff/views/blog/post.cr b/src/guff/views/posts/blog.cr
index 4bc5282..6634bca 100644
--- a/src/guff/views/blog/post.cr
+++ b/src/guff/views/posts/blog.cr
@@ -1,6 +1,6 @@
require "../template-html"
-class Guff::Views::Blog::PostView < Guff::Views::TemplateHTMLView
+class Guff::Views::Posts::Blog < Guff::Views::TemplateHTMLView
def initialize(
context : Context,
site_id : Int64,
@@ -13,7 +13,7 @@ class Guff::Views::Blog::PostView < Guff::Views::TemplateHTMLView
context: context,
theme_id: site["theme_id"].as(Int64).to_i32,
theme_slug: site["theme_slug"].as(String),
- template_id: "blog-post.html",
+ template_id: "post-blog.html",
data: item,
)
end
diff --git a/src/guff/views/page.cr b/src/guff/views/posts/page.cr
index 7d386c2..55f5004 100644
--- a/src/guff/views/page.cr
+++ b/src/guff/views/posts/page.cr
@@ -1,12 +1,12 @@
-require "./template-html"
+require "../template-html"
-class Guff::Views::PageView < Guff::Views::TemplateHTMLView
+class Guff::Views::Posts::Page < Guff::Views::TemplateHTMLView
def initialize(context : Context, @item : Hash(String, String))
super(
context: context,
theme_id: @item["active_theme_id"].not_nil!.to_i32 as Int32,
theme_slug: @item["active_theme_slug"].not_nil!.to_s as String,
- template_id: "page.html",
+ template_id: "post-page.html",
data: @item,
extra_assets: context.models.page.assets(@item["post_id"].to_i64) as Theme::Assets,
)
diff --git a/src/guff/views/posts/project.cr b/src/guff/views/posts/project.cr
new file mode 100644
index 0000000..3da0a64
--- /dev/null
+++ b/src/guff/views/posts/project.cr
@@ -0,0 +1,13 @@
+require "../template-html"
+
+class Guff::Views::Posts::Project < Guff::Views::TemplateHTMLView
+ def initialize(context : Context, @item : Hash(String, String))
+ super(
+ context: context,
+ theme_id: @item["theme_id"].to_i32,
+ theme_slug: @item["theme_slug"],
+ template_id: "post-project.html",
+ data: @item,
+ )
+ end
+end
diff --git a/src/guff/views/project.cr b/src/guff/views/project.cr
deleted file mode 100644
index fc91b5c..0000000
--- a/src/guff/views/project.cr
+++ /dev/null
@@ -1,13 +0,0 @@
-require "./template-html"
-
-class Guff::Views::ProjectView < Guff::Views::TemplateHTMLView
- def initialize(context : Context, @item : Hash(String, String))
- super(
- context: context,
- theme_id: @item["theme_id"].not_nil!.to_i32 as Int32,
- theme_slug: @item["theme_slug"].not_nil!.to_s as String,
- template_id: "project.html",
- data: @item,
- )
- end
-end