aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/themes/default/guff-manifest.json4
-rw-r--r--src/guff/views/page.cr12
2 files changed, 12 insertions, 4 deletions
diff --git a/data/themes/default/guff-manifest.json b/data/themes/default/guff-manifest.json
index 2f402df..44e7abe 100644
--- a/data/themes/default/guff-manifest.json
+++ b/data/themes/default/guff-manifest.json
@@ -8,7 +8,7 @@
},
"assets": {
- "scripts": [],
- "styles": []
+ "scripts": ["script.js"],
+ "styles": ["style.css"]
}
}
diff --git a/src/guff/views/page.cr b/src/guff/views/page.cr
index eb53dec..b1019a6 100644
--- a/src/guff/views/page.cr
+++ b/src/guff/views/page.cr
@@ -12,12 +12,16 @@ class Guff::Views::PageView < Guff::Views::HTMLView
end
private def scripts
- super(theme_assets.scripts)
+ super(theme_assets.scripts.map { |val|
+ "/guff/themes/%s/%s" % [theme_slug, val]
+ })
# TODO: allow page-specific scripts
end
private def styles
- super(theme_assets.styles)
+ super(theme_assets.styles.map { |val|
+ "/guff/themes/%s/%s" % [theme_slug, val]
+ })
# TODO: allow page-specific styles
end
@@ -25,5 +29,9 @@ class Guff::Views::PageView < Guff::Views::HTMLView
@context.models.theme.assets(@theme_id)
end
+ private def theme_slug : String
+ @theme_slug ||= @context.models.theme.get(@theme_id)["theme_slug"] as String
+ end
+
ECR.def_to_s("src/views/page.ecr")
end