Sha256: 186c32b1528f645fe122747164968ce19a31528a769fd85f3185c37beefa20de

Contents?: true

Size: 1.16 KB

Versions: 150

Compression:

Stored size: 1.16 KB

Contents

module LocationHelper
  
  # Renders the location stack for your view. You can add as many stack levels as you wish.
  #
  # Usage:  
  # <%= location(level1,leve2,level3,level4,....) %> 
  #
  # Output: 
  # base > level1 > level2 > level3 > level 4
  #
  # Default configuration:
  # base => "You are here" ("location.base" on config/locales)
  # separator => ">" ("location.separator" on config/locales)
  #
  # Styles and HTML wrapping:
  # partial => location/_location.html.erb 
  #
  # Example:  
  # 	Render a location with two leves depth:
  #
  #   	<%= location(link_to(leve1.name, level1.url),link_to(leve2.name, level2.url)) %>
  #
  def location(*stack)
    
    location_body = render :partial => "location/location_body", :locals=>{:stack => stack}
    
    location_div = capture do
      render :partial => "location/location", :locals=>{:location_body => location_body}
    end
    
    case request.format
      when Mime::JS
      response = <<-EOJ

          $('#map_location').html("#{ escape_javascript(location_div) }");
          EOJ
      
      response.html_safe
    else
      content_for(:location) do
        location_div
      end
    end
    
  end
end

Version data entries

150 entries across 150 versions & 4 rubygems

Version Path
social_stream-0.16.1 base/app/helpers/location_helper.rb
social_stream-base-0.11.0 app/helpers/location_helper.rb
social_stream-0.15.8 base/app/helpers/location_helper.rb
social_stream-base-0.10.11 app/helpers/location_helper.rb
social_stream-0.15.7 base/app/helpers/location_helper.rb
social_stream-base-0.10.10 app/helpers/location_helper.rb
social_stream-0.15.6 base/app/helpers/location_helper.rb
social_stream-base-0.10.9 app/helpers/location_helper.rb
social_stream-0.15.5 base/app/helpers/location_helper.rb
social_stream-base-0.10.8 app/helpers/location_helper.rb
social_stream-0.15.4 base/app/helpers/location_helper.rb
social_stream-base-0.10.7 app/helpers/location_helper.rb
social_stream-0.15.1 base/app/helpers/location_helper.rb
social_stream-0.15.0 base/app/helpers/location_helper.rb
social_stream-base-0.10.6 app/helpers/location_helper.rb
social_stream-0.14.1 base/app/helpers/location_helper.rb
social_stream-base-0.10.5 app/helpers/location_helper.rb
social_stream-0.14.0 base/app/helpers/location_helper.rb
social_stream-base-0.10.4 app/helpers/location_helper.rb
social_stream-0.13.3 base/app/helpers/location_helper.rb