aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/guff/views/blog/list.cr19
-rw-r--r--src/guff/views/template-html.cr3
-rw-r--r--src/views/blog/list-item.ecr4
3 files changed, 15 insertions, 11 deletions
diff --git a/src/guff/views/blog/list.cr b/src/guff/views/blog/list.cr
index a98131e..00bd587 100644
--- a/src/guff/views/blog/list.cr
+++ b/src/guff/views/blog/list.cr
@@ -19,15 +19,16 @@ class Guff::Views::Blog::ListView < Guff::Views::TemplateHTMLView
theme_id: site["theme_id"].as(Int64).to_i32,
theme_slug: site["theme_slug"].as(String),
template_id: "blog-list.html",
- data: {
- "name" => TITLE,
- "body" => String.build do |io|
- # render items
- results.rows.each do |row|
- ListItemView.new(context, row).to_s(io)
- end
- end,
- },
)
+
+ self.data = {
+ "name" => TITLE,
+ "body" => String.build do |io|
+ # render items
+ results.rows.each do |row|
+ theme_templates["blog-list-item.html"].run(io, row)
+ end
+ end,
+ } of String => String
end
end
diff --git a/src/guff/views/template-html.cr b/src/guff/views/template-html.cr
index 6ad5859..b7cd8e0 100644
--- a/src/guff/views/template-html.cr
+++ b/src/guff/views/template-html.cr
@@ -1,12 +1,13 @@
class Guff::Views::TemplateHTMLView < Guff::Views::HTMLView
getter :theme_templates
+ property :data
def initialize(
context : Context,
@theme_id : Int32,
@theme_slug : String,
@template_id : String,
- @data : Hash(String, String),
+ @data : Hash(String, String) = {} of String => String,
@extra_assets : Theme::Assets? = nil,
)
super(context)
diff --git a/src/views/blog/list-item.ecr b/src/views/blog/list-item.ecr
index 23b868e..9a3bc72 100644
--- a/src/views/blog/list-item.ecr
+++ b/src/views/blog/list-item.ecr
@@ -1,4 +1,6 @@
-<div class='post'>
+<%
+ # deprecated: replaced with theme templates
+%><div class='post'>
<b><%= h(@item["name"]) %></b><br/>
<b>
by <%= h(@item["user_name"]) %>