Sha256: 3318f52ad6fef9450161f4e623d0664dbe5354536761f1a680200c8ce3041c2d

Contents?: true

Size: 916 Bytes

Versions: 3

Compression:

Stored size: 916 Bytes

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 a two leves depth:
  #
  #   	<%= location(link_to(leve1.name, level1.url),link_to(leve2.name, level2.url)) %>
  #
	def location(*stack)
		location_body = t('location.base')
		stack.collect {|level|
			location_body << t('location.separator') + level
		}

		location_div = capture do
			render :partial => "location/location", :locals=>{:location_body => location_body}
		end
	end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
social_stream-0.4.4 app/helpers/location_helper.rb
social_stream-0.4.3 app/helpers/location_helper.rb
social_stream-0.4.2 app/helpers/location_helper.rb