Sha256: 9a2911fb69399c8fd90fd7f15791923756d44fd400196bd35b346cac8501b4b1

Contents?: true

Size: 653 Bytes

Versions: 7

Compression:

Stored size: 653 Bytes

Contents

# code: 
# * George Moschovitis  <gm@navel.gr>
#
# (c) 2004 Navel, all rights reserved.
# $Id: tabs.rb 101 2004-10-22 12:35:39Z gmosx $

module N; module UI

	# Render a tabs bar
	#
	# Example:
	#
	# #{N::UI.tabs(request,
	#		["Page1", "Page2", "Page3"]
	#	}
	#
	def self.tabs(request, options, param)
		tabs = []
	
		selected = request.get(param, 0)
		
		options.each_with_index { |opt, idx|
			if idx == selected
				tabs << %|<strong>#{opt}</strong>|
			else
				tabs << %|<a href="#{request.expand_uri(param => idx)}">#{opt}</a>|
			end
		}
		
		return %|<div class="tabs">#{tabs.join('<span class="sep">|</span>')}</div>| 
	end
	
end; end # module

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
nitro-0.10.0 lib/nitro/ui/tabs.rb
nitro-0.2.0 lib/n/ui/tabs.rb
nitro-0.3.0 lib/n/ui/tabs.rb
nitro-0.7.0 lib/nitro/ui/tabs.rb
nitro-0.8.0 lib/nitro/ui/tabs.rb
nitro-0.9.3 lib/nitro/ui/tabs.rb
nitro-0.9.5 lib/nitro/ui/tabs.rb