diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/guff/views/html/page.cr | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/guff/views/html/page.cr b/src/guff/views/html/page.cr index c300070..a902e0b 100644 --- a/src/guff/views/html/page.cr +++ b/src/guff/views/html/page.cr @@ -1,5 +1,6 @@ require "ecr/macros" require "html" +require "../../page-features" module Guff class PageHTMLView @@ -26,6 +27,7 @@ module Guff @scripts = [] of String @styles = [] of String @metas = [] of Hash(String, String) + @features = {} of String => Bool end def body_attrs @@ -45,7 +47,7 @@ module Guff def page_footers : String @scripts.map { |path| - FORMATS[:style] % [h(path)] + FORMATS[:script] % [h(path)] }.join("") end @@ -61,6 +63,17 @@ module Guff "text/html; charset=%s" % [@charset] end + def add_feature(key : String) + unless @features.has_key?(key) + Guff::PageFeatures.add(key, self) + @features[key] = true + end + end + + def add_features(features : Array(String)) + features.each { |key| add_feature(key) } + end + ECR.def_to_s("./src/guff/views/ecrs/page.ecr") end end |