Module: Reusable::Rails::Helpers::Html5Helper::InstanceMethods
- Defined in:
- lib/reusable/rails/helpers/html5_helper.rb
Instance Method Summary collapse
-
#google_account_id ⇒ String
Fetch the Google Account ID for this application from either the ‘GOOGLE_ACCOUNT_ID’ environment variable or from the config/google.yml file.
-
#google_api_key ⇒ String
Fetch the Google API ID for this application from either the ‘GOOGLE_API_ID’ environment variable or from the config/google.yml file.
-
#google_cdn_jquery(version = '1.6.2') ⇒ String
Generates the Google API code for serving jQuery either compressed or uncompressed.
- #ie_body(attrs = {}, &block) ⇒ Object
- #ie_html(attrs = {}, &block) ⇒ Object
-
#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.
-
#remote_jquery(version = '1.6.2') ⇒ String
Generates the jQuery file extension for including jQuery from the Google CDN.
Instance Method Details
#google_account_id ⇒ String
Fetch the Google Account ID for this application from either the ‘GOOGLE_ACCOUNT_ID’ environment variable or from the config/google.yml file.
39 40 41 |
# File 'lib/reusable/rails/helpers/html5_helper.rb', line 39 def google_account_id ENV['GOOGLE_ACCOUNT_ID'] or google_config(:google_account_id) end |
#google_api_key ⇒ String
Fetch the Google API ID for this application from either the ‘GOOGLE_API_ID’ environment variable or from the config/google.yml file.
49 50 51 |
# File 'lib/reusable/rails/helpers/html5_helper.rb', line 49 def google_api_key ENV['GOOGLE_API_KEY'] or google_config(:google_api_key) end |
#google_cdn_jquery(version = '1.6.2') ⇒ String
Generates the Google API code for serving jQuery either compressed or uncompressed.
58 59 60 61 62 63 64 |
# File 'lib/reusable/rails/helpers/html5_helper.rb', line 58 def google_cdn_jquery(version='1.6.2') if Rails.env.development? "'jquery', '#{version}', {uncompressed:true}" else "'jquery', '#{version}'" end end |
#ie_body(attrs = {}, &block) ⇒ Object
29 30 31 |
# File 'lib/reusable/rails/helpers/html5_helper.rb', line 29 def ie_body(attrs={}, &block) ie_tag(:body, attrs, &block) end |
#ie_html(attrs = {}, &block) ⇒ Object
25 26 27 |
# File 'lib/reusable/rails/helpers/html5_helper.rb', line 25 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
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/reusable/rails/helpers/html5_helper.rb', line 13 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 |
#remote_jquery(version = '1.6.2') ⇒ String
Generates the jQuery file extension for including jQuery from the Google CDN
71 72 73 74 75 76 77 |
# File 'lib/reusable/rails/helpers/html5_helper.rb', line 71 def remote_jquery(version='1.6.2') if Rails.env.development? "#{version}/jquery.js" else "#{version}/jquery.min.js" end end |