Module: Cyborg::Helpers::AssetsHelper
- Defined in:
- lib/cyborg/helpers/asset_helpers.rb
Instance Method Summary collapse
- #asset_tags ⇒ Object
- #cyborg_asset_url(file) ⇒ Object
- #favicon_tag(source = 'favicon.ico', options = {}) ⇒ Object
- #javascript_tag(*args) ⇒ Object
- #javascript_url(*args) ⇒ Object
- #pin_tab_icon_tag(path, color = "black") ⇒ Object
- #stylesheet_tag(*args) ⇒ Object
- #stylesheet_url(*args) ⇒ Object
Instance Method Details
#asset_tags ⇒ Object
42 43 44 |
# File 'lib/cyborg/helpers/asset_helpers.rb', line 42 def stylesheet_tag + javascript_tag end |
#cyborg_asset_url(file) ⇒ Object
5 6 7 |
# File 'lib/cyborg/helpers/asset_helpers.rb', line 5 def cyborg_asset_url(file) Cyborg.plugin.asset_url(file) end |
#favicon_tag(source = 'favicon.ico', options = {}) ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/cyborg/helpers/asset_helpers.rb', line 50 def favicon_tag(source='favicon.ico', ={}) tag('link', { :rel => 'shortcut icon', :type => 'image/x-icon', :href => cyborg_asset_url(source) }.merge!(.symbolize_keys)) end |
#javascript_tag(*args) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/cyborg/helpers/asset_helpers.rb', line 21 def javascript_tag(*args) = args.last.is_a?(Hash) ? args.pop : {} = '' puts "searching for: #{javascript_url(args)}" javascript_url(args).each do |url| url += '.gz' if Cyborg.production? += javascript_include_tag(url, ) end .html_safe end |
#javascript_url(*args) ⇒ Object
38 39 40 |
# File 'lib/cyborg/helpers/asset_helpers.rb', line 38 def javascript_url(*args) Cyborg.plugin.javascripts.urls(args) end |
#pin_tab_icon_tag(path, color = "black") ⇒ Object
46 47 48 |
# File 'lib/cyborg/helpers/asset_helpers.rb', line 46 def pin_tab_icon_tag(path, color="black") %Q{<link rel="mask-icon" mask href="#{cyborg_asset_url(path)}" color="#{color}">}.html_safe end |
#stylesheet_tag(*args) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/cyborg/helpers/asset_helpers.rb', line 9 def stylesheet_tag(*args) = args.last.is_a?(Hash) ? args.pop : {} = '' stylesheet_url(args).each do |url| url += '.gz' if Cyborg.production? += stylesheet_link_tag(url, ) end .html_safe end |
#stylesheet_url(*args) ⇒ Object
34 35 36 |
# File 'lib/cyborg/helpers/asset_helpers.rb', line 34 def stylesheet_url(*args) Cyborg.plugin.stylesheets.urls(args) end |