diff options
| author | Paul Duncan <pabs@pablotron.org> | 2016-03-13 19:09:40 -0400 | 
|---|---|---|
| committer | Paul Duncan <pabs@pablotron.org> | 2016-03-13 19:09:40 -0400 | 
| commit | 13abd228f1cfb9d43ee1a14299d57ae0523e1cab (patch) | |
| tree | 87b80f4968487f06f396c22502762d8bfc1705d0 /src | |
| parent | efdf5cae3d465d853dd7593aa75ae7101c5b8d39 (diff) | |
| download | old-guff-13abd228f1cfb9d43ee1a14299d57ae0523e1cab.tar.xz old-guff-13abd228f1cfb9d43ee1a14299d57ae0523e1cab.zip  | |
add add_feature{,s}
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  | 
