Sha256: 939a87fe6d749b1008d50eb7762d51290f2d279b3d67581265744f5e1f8855aa

Contents?: true

Size: 686 Bytes

Versions: 9

Compression:

Stored size: 686 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 = '', &blk)
    if ::BrighterPlanet.layout.application_name == 'Brighter Planet'
      path.insert 0, '/'
    else
      path.insert 0, 'http://brighterplanet.com/'
    end
    if block_given?
      link_to path, &blk
    else
      link_to text, path
    end
  end
  
  def brighter_planet_layout_cdn_url(path)
    ::BrighterPlanet.layout.cdn_url path, request.protocol
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
brighter_planet_layout-0.5.3 app/helpers/brighter_planet_helper.rb
brighter_planet_layout-0.5.2 app/helpers/brighter_planet_helper.rb
brighter_planet_layout-0.5.1 app/helpers/brighter_planet_helper.rb
brighter_planet_layout-0.4.5 app/helpers/brighter_planet_helper.rb
brighter_planet_layout-0.4.4 app/helpers/brighter_planet_helper.rb
brighter_planet_layout-0.4.3 app/helpers/brighter_planet_helper.rb
brighter_planet_layout-0.4.2 app/helpers/brighter_planet_helper.rb
brighter_planet_layout-0.4.1 app/helpers/brighter_planet_helper.rb
brighter_planet_layout-0.4.0 app/helpers/brighter_planet_helper.rb