Module: LayoutHelper

Defined in:
lib/generators/seivan/html5/templates/layout_helper.rb

Instance Method Summary collapse

Instance Method Details

#ie_body(attrs = {}, &block) ⇒ Object



19
20
21
# File 'lib/generators/seivan/html5/templates/layout_helper.rb', line 19

def ie_body(attrs={}, &block)
  ie_tag(:body, attrs, &block)
end

#ie_html(attrs = {}, &block) ⇒ Object



15
16
17
# File 'lib/generators/seivan/html5/templates/layout_helper.rb', line 15

def ie_html(attrs={}, &block)
  ie_tag(:html, attrs, &block)
end

#ie_tag(name = :body, attrs = {}, &block) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/generators/seivan/html5/templates/layout_helper.rb', line 2

def ie_tag(name=:body, attrs={}, &block)
  attrs.symbolize_keys!
  haml_concat("<!--[if lt IE 7 ]> #{ tag(name, add_class('ie6', attrs), true) } <![endif]-->".html_safe)
  haml_concat("<!--[if IE 7 ]>    #{ tag(name, add_class('ie7', attrs), true) } <![endif]-->".html_safe)
  haml_concat("<!--[if IE 8 ]>    #{ tag(name, add_class('ie8', attrs), true) } <![endif]-->".html_safe)
  haml_concat("<!--[if IE 9 ]>    #{ tag(name, add_class('ie9', attrs), true) } <![endif]-->".html_safe)
  haml_concat("<!--[if (gt IE 9)|!(IE)]><!-->".html_safe)
  haml_tag name, attrs do
    haml_concat("<!--<![endif]-->".html_safe)
    block.call
  end
end