aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-03-13 19:09:40 -0400
committerPaul Duncan <pabs@pablotron.org>2016-03-13 19:09:40 -0400
commit13abd228f1cfb9d43ee1a14299d57ae0523e1cab (patch)
tree87b80f4968487f06f396c22502762d8bfc1705d0 /src
parentefdf5cae3d465d853dd7593aa75ae7101c5b8d39 (diff)
downloadold-guff-13abd228f1cfb9d43ee1a14299d57ae0523e1cab.tar.bz2
old-guff-13abd228f1cfb9d43ee1a14299d57ae0523e1cab.zip
add add_feature{,s}
Diffstat (limited to 'src')
-rw-r--r--src/guff/views/html/page.cr15
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