Sha256: 13b05506e98c318026de119672d5040e9329b0682be4cbe8392a61b09906ca44

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

module ActivesupportOverride
  def stylesheet_link_tag(path, media='screen')
    '<link href="'+path_to_css(path)+'" media="'+media+'" rel="stylesheet" type="text/css" />'
  end

  def javascript_include_tag(path)
    '<script src="'+path_to_js(path)+'"></script>'
  end

  def meta_tag(type, content)
    '<meta name="'+type+'" content="'+content+'" />'
  end

  def meta_tag_http(type, content)
    '<meta http-equiv="'+type+'" content="'+content+'" />'
  end

  def link_tag(source, relation, type='')
    type = " type='#{type}'" if type
    '<link rel="'+relation+'" href="'+source+'"'+type+'/>'
  end

  def path_to_css(path)
    return path if external_path?(path)
    return "css/#{path}" if file_exists? "css/#{path}"
    path
  end

  def path_to_js(path)
    return path if external_path? path
    return "js/#{path}" if file_exists? "js/#{path}"
    path
  end

  def path_to_image(path)
    return path if external_path? path
    return "images/#{path}" if file_exists? "images/#{path}"
    path
  end

  def external_path? path
    path.start_with?('//') || path.start_with?('http')
  end

  def url_for(options = '')
   return options
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
easy_html_creator-1.3.2 lib/generator/helper/activesupport_override.rb
easy_html_creator-1.3.1 lib/generator/helper/activesupport_override.rb
easy_html_creator-1.3.0 lib/generator/helper/activesupport_override.rb