Module: AssetTagHelper
- Defined in:
- app/helpers/asset_tag_helper.rb
Defined Under Namespace
Classes: Configuration
Class Attribute Summary collapse
-
.configuration ⇒ Object
Returns the value of attribute configuration.
Class Method Summary collapse
Instance Method Summary collapse
- #cf_image_tag(source, opts = {}) ⇒ Object
-
#cf_javascript_include_tag(*sources) ⇒ Object
actual helper code.
- #cf_stylesheet_link_tag(*sources) ⇒ Object
Class Attribute Details
.configuration ⇒ Object
Returns the value of attribute configuration.
3 4 5 |
# File 'app/helpers/asset_tag_helper.rb', line 3 def configuration @configuration end |
Class Method Details
.configure {|configuration| ... } ⇒ Object
6 7 8 9 10 11 12 |
# File 'app/helpers/asset_tag_helper.rb', line 6 def self.configure self.configuration ||= Configuration.new yield(configuration) # get rid of trailing /. configuration.cloud_front_url = configuration.cloud_front_url.gsub(/\/$/, '') end |
Instance Method Details
#cf_image_tag(source, opts = {}) ⇒ Object
27 28 29 |
# File 'app/helpers/asset_tag_helper.rb', line 27 def cf_image_tag(source, opts={}) raw image_tag(source, opts).gsub(/src="\//, "src=\"#{AssetTagHelper.configuration.cloud_front_url}/") end |
#cf_javascript_include_tag(*sources) ⇒ Object
actual helper code
23 24 25 |
# File 'app/helpers/asset_tag_helper.rb', line 23 def cf_javascript_include_tag(*sources) raw javascript_include_tag(*sources).gsub(/src="\//, "src=\"#{AssetTagHelper.configuration.cloud_front_url}/") end |
#cf_stylesheet_link_tag(*sources) ⇒ Object
31 32 33 |
# File 'app/helpers/asset_tag_helper.rb', line 31 def cf_stylesheet_link_tag(*sources) raw stylesheet_link_tag(*sources).gsub(/href="\//, "href=\"#{AssetTagHelper.configuration.cloud_front_url}/") end |