Module: Html5::SlimRails::BoilerplateHelper

Defined in:
lib/html5/slim_rails/boilerplate_helper.rb

Instance Method Summary collapse

Instance Method Details

#google_account_idObject



27
28
29
# File 'lib/html5/slim_rails/boilerplate_helper.rb', line 27

def 
  ENV['GOOGLE_ACCOUNT_ID'] || google_config(:google_account_id)
end

#google_api_keyObject



31
32
33
# File 'lib/html5/slim_rails/boilerplate_helper.rb', line 31

def google_api_key
  ENV['GOOGLE_API_KEY'] || google_config(:google_api_key)
end

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



23
24
25
# File 'lib/html5/slim_rails/boilerplate_helper.rb', line 23

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

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



19
20
21
# File 'lib/html5/slim_rails/boilerplate_helper.rb', line 19

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

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

Create a named haml tag to wrap IE conditional around a block paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/html5/slim_rails/boilerplate_helper.rb', line 7

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 gt IE 8]><!-->".html_safe)
  haml_tag name, attrs do
    haml_concat("<!--<![endif]-->".html_safe)
    block.call
  end
end

#local_jquery(version) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/html5/slim_rails/boilerplate_helper.rb', line 43

def local_jquery(version)
  if ::Rails.env == 'development'
    "#{version}/jquery.js"
  else
    "#{version}/jquery.min.js"
  end
end

#remote_jquery(version) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/html5/slim_rails/boilerplate_helper.rb', line 35

def remote_jquery(version)
  if ::Rails.env == 'development'
    "'jquery', '#{version}', {uncompressed:true}"
  else
    "'jquery', '#{version}'"
  end
end