Module: Cyborg::Helpers::AssetsHelper

Defined in:
lib/cyborg/helpers/asset_helpers.rb

Instance Method Summary collapse

Instance Method Details

#asset_tagsObject



40
41
42
# File 'lib/cyborg/helpers/asset_helpers.rb', line 40

def asset_tags
  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(*args) ⇒ Object



48
49
50
51
52
53
54
55
56
# File 'lib/cyborg/helpers/asset_helpers.rb', line 48

def favicon_tag(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  source = args.first || 'favicon.ico'
  tag('link', {
    :rel  => 'shortcut icon',
    :type => 'image/x-icon',
    :href => "/images/assets/#{Cyborg.plugin.name}/#{source}"
  }.merge!(options.symbolize_keys))
end

#javascript_tag(*args) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/cyborg/helpers/asset_helpers.rb', line 20

def javascript_tag(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  tags = ''

  puts "searching for: #{javascript_url(args)}"
  javascript_url(args).each do |url|
    tags += javascript_include_tag url, options
  end

  tags.html_safe
end

#javascript_url(*args) ⇒ Object



36
37
38
# File 'lib/cyborg/helpers/asset_helpers.rb', line 36

def javascript_url(*args)
  Cyborg.plugin.javascripts.urls(args)
end

#pin_tab_icon_tag(path, color = "black") ⇒ Object



44
45
46
# File 'lib/cyborg/helpers/asset_helpers.rb', line 44

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
# File 'lib/cyborg/helpers/asset_helpers.rb', line 9

def stylesheet_tag(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  tags = ''

  stylesheet_url(args).each do |url|
    tags += stylesheet_link_tag url, options
  end

  tags.html_safe
end

#stylesheet_url(*args) ⇒ Object



32
33
34
# File 'lib/cyborg/helpers/asset_helpers.rb', line 32

def stylesheet_url(*args)
  Cyborg.plugin.stylesheets.urls(args)
end