Sha256: 460ac348ea928121f5db2d8a32e3a54e37d48b1cf1b1545a4a567b2d1ec08655

Contents?: true

Size: 783 Bytes

Versions: 12

Compression:

Stored size: 783 Bytes

Contents

require 'uv'
module BrighterPlanetHelper
  def render_or_nothing(*args)
    begin
      render(*args)
    rescue ::ActionView::MissingTemplate
      nil
    end
  end

  def syntax(code, lang = 'ruby')
    ::Uv.parse(code, 'xhtml', lang, false, :idle).html_safe
  end
  
  def link_to_homesite(text, path = '')
    if ::BrighterPlanetLayout.application_name == 'Brighter Planet'
      path.insert 0, '/'
    else
      path.insert 0, 'http://brighterplanet.com/'
    end
    link_to text, path
  end
  
  def brighter_planet_layout_cdn_url(path)
    if ::Rails.env.production? and not ::ENV['DISABLE_BRIGHTER_PLANET_LAYOUT_CDN'] == 'true'
      [ request.protocol, ::BrighterPlanetLayout::CDN, "/#{::BrighterPlanetLayout::VERSION}", path ].join
    else
      path
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
brighter_planet_layout-0.3.10 app/helpers/brighter_planet_helper.rb
brighter_planet_layout-0.3.9 app/helpers/brighter_planet_helper.rb
brighter_planet_layout-0.3.8 app/helpers/brighter_planet_helper.rb
brighter_planet_layout-0.3.7 app/helpers/brighter_planet_helper.rb
brighter_planet_layout-0.3.6 app/helpers/brighter_planet_helper.rb
brighter_planet_layout-0.3.5 app/helpers/brighter_planet_helper.rb
brighter_planet_layout-0.3.4 app/helpers/brighter_planet_helper.rb
brighter_planet_layout-0.3.3 app/helpers/brighter_planet_helper.rb
brighter_planet_layout-0.3.2 app/helpers/brighter_planet_helper.rb
brighter_planet_layout-0.3.1 app/helpers/brighter_planet_helper.rb
brighter_planet_layout-ruby19-0.3.0 app/helpers/brighter_planet_helper.rb
brighter_planet_layout-0.3.0 app/helpers/brighter_planet_helper.rb