Sha256: da2240abf90dbf315ff1f518e2d96579913bae94e0b867f1ff92919dc290ddcb

Contents?: true

Size: 701 Bytes

Versions: 3

Compression:

Stored size: 701 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', style = :idle)
    ::Uv.parse(code, 'xhtml', lang, false, style).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

3 entries across 3 versions & 1 rubygems

Version Path
brighter_planet_layout-0.5.6 app/helpers/brighter_planet_helper.rb
brighter_planet_layout-0.5.5 app/helpers/brighter_planet_helper.rb
brighter_planet_layout-0.5.4 app/helpers/brighter_planet_helper.rb